<?php $__env->startSection('title', 'Recibo de Trámite #' . $pago->id); ?>

<?php $__env->startSection('content'); ?>

<div class="bg-body-light">
    <div class="content content-full">
        <div class="d-flex flex-column flex-sm-row justify-content-sm-between align-items-sm-center py-2">
            <div class="flex-grow-1">
                <h1 class="h3 fw-bold mb-1">
                    <i class="fa fa-file-invoice-dollar text-success me-2"></i>
                    Recibo de Trámite
                    <span class="text-success">#<?php echo e(str_pad($pago->id, 6, '0', STR_PAD_LEFT)); ?></span>
                </h1>
                <h2 class="fs-base lh-base fw-medium text-muted mb-0">
                    <?php echo e($pago->descripcion); ?>

                </h2>
            </div>
            <div class="flex-shrink-0 mt-3 mt-sm-0 ms-sm-3 d-flex gap-2">
                <a href="<?php echo e(route('pagos-tramites.index')); ?>" class="btn btn-alt-secondary">
                    <i class="fa fa-arrow-left me-1"></i> Volver
                </a>
                <a href="<?php echo e(route('pagos-tramites.pdf', $pago->id)); ?>" target="_blank"
                   class="btn btn-alt-primary">
                    <i class="fa fa-print me-1"></i> Imprimir
                </a>
            </div>
        </div>
    </div>
</div>

<div class="content">

    <?php if(session('success')): ?>
        <div class="alert alert-success d-flex align-items-center mb-3">
            <i class="fa fa-check-circle me-2"></i>
            <p class="mb-0"><?php echo e(session('success')); ?></p>
            <button type="button" class="btn-close ms-auto" data-bs-dismiss="alert"></button>
        </div>
    <?php endif; ?>

    <?php if(session('info')): ?>
        <div class="alert alert-info d-flex align-items-center mb-3">
            <i class="fa fa-info-circle me-2"></i>
            <p class="mb-0"><?php echo e(session('info')); ?></p>
            <button type="button" class="btn-close ms-auto" data-bs-dismiss="alert"></button>
        </div>
    <?php endif; ?>

    <?php
        // Etiquetas de tipo de pago (igual que el switch de ver_pagos.php)
        $tipoLabels = [
            0 => ['label' => 'Impuestos',              'color' => 'secondary', 'icon' => 'fa-receipt'],
            1 => ['label' => 'Minuta',                 'color' => 'primary',   'icon' => 'fa-file-alt'],
            2 => ['label' => 'Transferencia',          'color' => 'info',      'icon' => 'fa-exchange-alt'],
            3 => ['label' => 'Protocolo',              'color' => 'dark',      'icon' => 'fa-book'],
            4 => ['label' => 'Plano de Lote',          'color' => 'success',   'icon' => 'fa-map'],
            5 => ['label' => 'Visado de Plano',        'color' => 'warning',   'icon' => 'fa-stamp'],
            6 => ['label' => 'Minuta Datos Técnicos',  'color' => 'purple',    'icon' => 'fa-file-contract'],
            7 => ['label' => 'Derechos Reales',        'color' => 'danger',    'icon' => 'fa-landmark'],
        ];
        $tipoInfo = $tipoLabels[$pago->tipo] ?? ['label' => 'Otros', 'color' => 'secondary', 'icon' => 'fa-question'];
    ?>

    <div class="row">

        
        <div class="col-xl-7">
            <div class="block block-rounded">
                <div class="block-header block-header-default border-bottom">
                    <h3 class="block-title">
                        <i class="fa <?php echo e($tipoInfo['icon']); ?> text-<?php echo e($tipoInfo['color']); ?> me-2"></i>
                        Información del Pago
                    </h3>
                    <div class="block-options">
                        <span class="badge bg-<?php echo e($tipoInfo['color']); ?> px-3 py-2">
                            <?php echo e(strtoupper($tipoInfo['label'])); ?>

                        </span>
                    </div>
                </div>
                <div class="block-content p-0">
                    <table class="table table-vcenter table-sm fs-sm mb-0">
                        <tbody>
                            <tr>
                                <td class="fw-semibold bg-body-light" style="width:35%">N° Recibo</td>
                                <td class="fw-bold fs-base text-success">
                                    <?php echo e(str_pad($pago->id, 6, '0', STR_PAD_LEFT)); ?>

                                </td>
                            </tr>
                            <tr>
                                <td class="fw-semibold bg-body-light">Fecha</td>
                                <td><?php echo e(\App\Helpers\FechaHelper::bdToLocal($pago->fecha)); ?></td>
                            </tr>
                            <tr>
                                <td class="fw-semibold bg-body-light">Cliente</td>
                                <td>
                                    <div class="fw-semibold"><?php echo e($cliente->nombre ?? '—'); ?></div>
                                    <div class="text-muted fs-xs">ID: <?php echo e($pago->idcliente); ?></div>
                                </td>
                            </tr>
                            <tr>
                                <td class="fw-semibold bg-body-light">Concepto / Descripción</td>
                                <td><?php echo e($pago->descripcion); ?></td>
                            </tr>
                            <tr>
                                <td class="fw-semibold bg-body-light">Tipo de Cambio</td>
                                <td><?php echo e(number_format($pago->tc, 2)); ?> Bs/$us</td>
                            </tr>
                            <?php if($pago->obs): ?>
                            <tr>
                                <td class="fw-semibold bg-body-light align-top">Observaciones</td>
                                <td class="text-muted fst-italic"><?php echo e($pago->obs); ?></td>
                            </tr>
                            <?php endif; ?>
                        </tbody>
                    </table>
                </div>
            </div>

            
            <div class="block block-rounded">
                <div class="block-header block-header-default border-bottom">
                    <h3 class="block-title">
                        <i class="fa fa-map-marker-alt text-muted me-2"></i>
                        Ubicación del Lote
                    </h3>
                </div>
                <div class="block-content p-0">
                    <table class="table table-vcenter table-sm fs-sm mb-0">
                        <tbody>
                            <tr>
                                <td class="fw-semibold bg-body-light" style="width:35%">Manzano / Lote</td>
                                <td>
                                    <span class="badge bg-dark me-1">Mzo: <?php echo e($pago->manzano); ?></span>
                                    <span class="badge bg-primary">Lote: <?php echo e($pago->lote); ?></span>
                                </td>
                            </tr>
                            <tr>
                                <td class="fw-semibold bg-body-light">Contrato</td>
                                <td>
                                    <a href="<?php echo e(route('contratos.show', $pago->idcontrato)); ?>"
                                       class="fw-bold text-primary">
                                        <i class="fa fa-file-contract me-1"></i>#<?php echo e($pago->idcontrato); ?>

                                    </a>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>

        
        <div class="col-xl-5">

            
            <div class="block block-rounded">
                <div class="block-header block-header-default border-bottom">
                    <h3 class="block-title">
                        <i class="fa fa-coins text-warning me-2"></i>Importes
                    </h3>
                </div>
                <div class="block-content">
                    <div class="row g-3 text-center">
                        <div class="col-6">
                            <div class="p-3 bg-body-light rounded border">
                                <div class="fs-xs text-muted text-uppercase fw-semibold mb-1">
                                    Bolivianos
                                </div>
                                <div class="fs-3 fw-bold text-dark">
                                    <?php echo e($pago->montobs ? number_format($pago->montobs, 2) : '—'); ?>

                                </div>
                                <div class="fs-xs text-muted">Bs.</div>
                            </div>
                        </div>
                        <div class="col-6">
                            <div class="p-3 bg-body-light rounded border">
                                <div class="fs-xs text-muted text-uppercase fw-semibold mb-1">
                                    Dólares
                                </div>
                                <div class="fs-3 fw-bold text-success">
                                    <?php echo e($pago->montosus ? number_format($pago->montosus, 2) : '—'); ?>

                                </div>
                                <div class="fs-xs text-muted">$us</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            
            <div class="block block-rounded">
                <div class="block-header block-header-default border-bottom">
                    <h3 class="block-title">
                        <i class="fa fa-info-circle text-muted me-2"></i>Estado
                    </h3>
                </div>
                <div class="block-content text-center py-4">
                    <?php if($pago->anul == 0): ?>
                        <i class="fa fa-check-circle fa-3x text-success mb-2"></i>
                        <div class="fw-bold text-success fs-5">VIGENTE</div>
                        <div class="text-muted fs-sm mt-1">Recibo emitido correctamente</div>
                    <?php else: ?>
                        <i class="fa fa-ban fa-3x text-danger mb-2"></i>
                        <div class="fw-bold text-danger fs-5">ANULADO</div>
                        <div class="text-muted fs-sm mt-1">Este recibo fue dado de baja</div>
                    <?php endif; ?>
                </div>
            </div>

            
            <?php if($pago->anul == 0 && session('tipo_usuario') == 1): ?>
            <div class="block block-rounded border border-danger border-opacity-25">
                <div class="block-content block-content-full">
                    <p class="text-muted fs-sm mb-2">
                        <i class="fa fa-shield-alt me-1"></i>
                        Zona Administrativa — la anulación es irreversible.
                    </p>
                    <form method="POST"
                          action="<?php echo e(route('pagos-tramites.anular', $pago->id)); ?>"
                          onsubmit="return confirm('¿Confirma la anulación del recibo #<?php echo e($pago->id); ?>?')">
                        <?php echo csrf_field(); ?>
                        <?php echo method_field('DELETE'); ?>
                        <button type="submit" class="btn btn-sm btn-alt-danger w-100">
                            <i class="fa fa-ban me-1"></i> Anular Recibo
                        </button>
                    </form>
                </div>
            </div>
            <?php endif; ?>

        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/proyect-laravel/cosmos-app/resources/views/pagos_tramites/show.blade.php ENDPATH**/ ?>