<?php $__env->startSection('title', 'Detalle Reporte De Migracion'); ?>

<?php $__env->startSection('content'); ?>
<style>
    .detail-card {
        background: #fff;
        border: 1px solid #d7e0ea;
        border-radius: 20px;
        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
        overflow: hidden;
    }

    .detail-card-header {
        background: linear-gradient(90deg, #1d4f7d 0%, #3678ad 100%);
        color: #fff;
        font-size: 1rem;
        font-weight: 800;
        padding: 16px 22px;
    }

    .detail-card-body {
        padding: 22px;
    }

    .detail-meta {
        background: #f7fafc;
        border: 1px solid #e2e8f0;
        border-radius: 16px;
        padding: 16px 18px;
    }

    .detail-meta-group {
        margin-bottom: 20px;
    }

    .detail-meta strong {
        color: #0f3d68;
        display: block;
        font-size: .82rem;
        margin-bottom: 4px;
        text-transform: uppercase;
    }

    .detail-meta-item {
        display: flex;
        flex-direction: column;
        gap: 4px;
        height: 100%;
        justify-content: center;
    }

    .detail-meta-item.general {
        gap: 10px;
    }

    .detail-meta-inline {
        display: flex;
        flex-wrap: nowrap;
        gap: 32px;
        align-items: flex-start;
        justify-content: space-between;
    }

    .detail-meta-inline > div {
        flex: 1 1 0;
        min-width: 0;
    }

    .detail-meta-item.ingreso {
        background: #eef6ff;
        border: 1px solid #bfd8ff;
        border-radius: 16px;
        color: #114a8b;
        padding: 16px 18px;
    }

    .detail-meta-item.egreso {
        background: #fff;
        border: 1px solid #ffd0d0;
        border-radius: 16px;
        color: #b42318;
        padding: 16px 18px;
    }

    .detail-meta-item .summary-value {
        font-size: 1.05rem;
        font-weight: 800;
        line-height: 1.35;
    }

    .detail-table thead th {
        background: #f0f6fb;
        color: #0f3d68;
        font-size: .82rem;
        font-weight: 800;
        text-transform: uppercase;
        white-space: nowrap;
    }

    .detail-table .project-column {
        min-width: 250px;
        white-space: normal;
        word-break: break-word;
    }

    .detail-table .action-column {
        min-width: 110px;
        white-space: nowrap;
    }

    .detail-row-ingreso td {
        background: #f2f8ff;
        color: #114a8b;
    }

    .detail-row-egreso td {
        background: #fff3f3;
        color: #b42318;
    }
</style>

<div class="container">
    <div class="row justify-content-center">
        <div class="col-xl-12">
            <div class="detail-card">
                <div class="detail-card-header">DETALLE DE MIGRACION BANCARIA</div>
                <div class="detail-card-body">
                    <div class="d-flex justify-content-between align-items-center flex-wrap gap-2 mb-3">
                        <h4 class="mb-0"><?php echo e($header->nombre_archivo); ?></h4>
                        <a href="<?php echo e(route('admin.reportedemigracion.index', array_filter(['id_sede' => $header->id_sede, 'year' => \Carbon\Carbon::parse($header->fecha_migracion)->format('Y'), 'month' => \Carbon\Carbon::parse($header->fecha_migracion)->format('m')]))); ?>" class="btn btn-outline-secondary btn-sm">
                            <i class="fas fa-arrow-left me-1"></i>Volver
                        </a>
                    </div>

                    <div class="row g-3 align-items-stretch detail-meta-group">
                        <div class="col-md-6">
                            <div class="detail-meta">
                                <div class="detail-meta-item general">
                                    <div class="detail-meta-inline">
                                        <div>
                                            <strong>Fecha Migracion</strong>
                                            <div><?php echo e(\Carbon\Carbon::parse($header->fecha_migracion)->format('d/m/Y H:i:s')); ?></div>
                                        </div>
                                        <div>
                                            <strong>Tipo Moneda</strong>
                                            <div><?php echo e($header->tipo_moneda_label); ?></div>
                                        </div>
                                        <div>
                                            <strong>Registros</strong>
                                            <div><?php echo e(number_format((int) $header->numero_registros, 0, '.', ',')); ?></div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="detail-meta-item ingreso">
                                <strong>Total Ingreso</strong>
                                <div class="summary-value">S/ <?php echo e(number_format((float) $header->total_ingreso_soles, 2, '.', ',')); ?></div>
                                <div class="summary-value">$ <?php echo e(number_format((float) $header->total_ingreso_dolares, 2, '.', ',')); ?></div>
                            </div>
                        </div>
                        <div class="col-md-3">
                            <div class="detail-meta-item egreso">
                                <strong>Total Egreso</strong>
                                <div class="summary-value">S/ <?php echo e(number_format((float) $header->total_egreso_soles, 2, '.', ',')); ?></div>
                                <div class="summary-value">$ <?php echo e(number_format((float) $header->total_egreso_dolares, 2, '.', ',')); ?></div>
                            </div>
                        </div>
                    </div>

                    <div class="table-responsive">
                        <table class="table table-bordered table-hover table-sm align-middle detail-table">
                            <thead>
                                <tr>
                                    <th>ITEM</th>
                                    <th>FECHA OPERACION</th>
                                    <th>DESCRIPCION</th>
                                    <th>NRO OPERACION</th>
                                    <th>CODIGO BANCO</th>
                                    <th>CODIGO ING/EGR</th>
                                    <th>TIPO MOV.</th>
                                    <th>TIPO CAMBIO</th>
                                    <th>MONTO SOLES</th>
                                    <th>MONTO DOLARES</th>
                                    <th class="project-column">PROYECTO</th>
                                    <?php if(!auth()->user()->isSuperAdmin()): ?>
                                        <th class="action-column">ACCIONES</th>
                                    <?php endif; ?>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr class="<?php echo e((int) $item->tipo_movimiento === 1 ? 'detail-row-ingreso' : 'detail-row-egreso'); ?>">
                                        <td class="text-center"><?php echo e($loop->iteration); ?></td>
                                        <td class="text-center"><?php echo e($item->fecha_operacion ? \Carbon\Carbon::parse($item->fecha_operacion)->format('d/m/Y') : '-'); ?></td>
                                        <td><?php echo e($item->descripcion ?: $item->detalle); ?></td>
                                        <td class="text-center"><?php echo e($item->numero_operacion); ?></td>
                                        <td class="text-center"><?php echo e($item->codigo_banco); ?></td>
                                        <td class="text-center"><?php echo e($item->codigo_ingreso_egreso); ?></td>
                                        <td class="text-center"><?php echo e((int) $item->tipo_movimiento === 1 ? 'INGRESO' : 'EGRESO'); ?></td>
                                        <td class="text-end"><?php echo e(number_format((float) $item->tipo_cambio, 4, '.', ',')); ?></td>
                                        <td class="text-end"><?php echo e(number_format((float) $item->monto, 2, '.', ',')); ?></td>
                                        <td class="text-end"><?php echo e(number_format((float) $item->monto_dolar, 2, '.', ',')); ?></td>
                                        <td class="project-column"><?php echo e($item->proyecto_label); ?></td>
                                        <?php if(!auth()->user()->isSuperAdmin()): ?>
                                            <td class="text-center action-column">
                                                <a href="<?php echo e(route('admin.reportedemigracion.edit', ['reportedemigracion' => $item->id, 'return_token' => request()->route('reportedemigracion')])); ?>" class="btn btn-sm btn-outline-primary">
                                                    Editar
                                                </a>
                                            </td>
                                        <?php endif; ?>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </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 D:\laragon\www\seminario\resources\views/Banco/reportedemigracion/show.blade.php ENDPATH**/ ?>