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

<?php
    $monthValue = strtolower((string) $selectedMonth) === 'all' ? 'all' : str_pad((string) $selectedMonth, 2, '0', STR_PAD_LEFT);
?>

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

    .migration-panel-header {
        background: linear-gradient(90deg, #1d4f7d 0%, #3678ad 100%);
        color: #fff;
        font-size: 1.05rem;
        font-weight: 800;
        letter-spacing: .04em;
        padding: 18px 24px;
    }

    .migration-panel-body {
        padding: 28px 24px 30px;
    }

    .migration-label {
        color: #0f3d68;
        display: block;
        font-size: 1rem;
        font-weight: 800;
        letter-spacing: .03em;
        margin-bottom: 10px;
        text-transform: uppercase;
    }

    .migration-select {
        border: 1px solid #ccd7e4;
        border-radius: 16px;
        font-size: 1.05rem;
        min-height: 48px;
        padding: 10px 16px;
    }

    .migration-search-btn {
        background: linear-gradient(90deg, #1f5687 0%, #2d6ca0 100%);
        border: 0;
        border-radius: 999px;
        color: #fff;
        font-size: 1.05rem;
        font-weight: 800;
        letter-spacing: .35em;
        min-width: 138px;
        padding: 12px 24px;
        text-transform: uppercase;
    }

    .migration-search-btn:hover {
        color: #fff;
        opacity: .95;
    }

    .migration-table-wrap {
        background: #fff;
        border: 1px solid #d7e0ea;
        border-radius: 18px;
        margin-top: 24px;
        overflow: hidden;
        box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    }

    .migration-table-wrap .table {
        margin-bottom: 0;
    }

    .migration-table-wrap thead th {
        background: #f0f6fb;
        border-bottom-width: 1px;
        color: #0f3d68;
        font-size: .9rem;
        font-weight: 800;
        text-transform: uppercase;
        white-space: nowrap;
    }

    .btn-view-detail {
        border-radius: 999px;
        height: 38px;
        width: 38px;
    }

    .btn-download-file {
        border-radius: 999px;
        height: 38px;
        width: 38px;
    }
</style>

<div class="container">
    <div class="row justify-content-center">
        <div class="col-xl-11">
            <div class="migration-panel">
                <div class="migration-panel-header">REPORTE DE MIGRACION DE DATOS (BANCOS)</div>
                <div class="migration-panel-body">
                    <form method="GET" action="<?php echo e(route('admin.reportedemigracion.index')); ?>">
                        <div class="row g-4 align-items-end">
                            <?php if($esSuperAdmin): ?>
                                <div class="col-md-4">
                                    <label for="id_sede" class="migration-label">SEDE</label>
                                    <select name="id_sede" id="id_sede" class="form-select migration-select" required>
                                        <option value="">Seleccione</option>
                                        <?php $__currentLoopData = $sedes; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $sede): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <option value="<?php echo e($sede->id); ?>" <?php echo e((string) $idSede === (string) $sede->id ? 'selected' : ''); ?>>
                                                <?php echo e($sede->sede); ?>

                                            </option>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                </div>
                            <?php endif; ?>

                            <div class="col-md-<?php echo e($esSuperAdmin ? '3' : '4'); ?>">
                                <label for="year" class="migration-label">ANO A REPORTAR</label>
                                <select name="year" id="year" class="form-select migration-select" required>
                                    <option value="">Seleccione</option>
                                    <?php $__currentLoopData = $availableYears; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $year): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($year); ?>" <?php echo e((string) $selectedYear === (string) $year ? 'selected' : ''); ?>>
                                            <?php echo e($year); ?>

                                        </option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                            </div>

                            <div class="col-md-<?php echo e($esSuperAdmin ? '3' : '4'); ?>">
                                <label for="month" class="migration-label">MES A REPORTAR</label>
                                <select name="month" id="month" class="form-select migration-select">
                                    <option value="all" <?php echo e($monthValue === 'all' ? 'selected' : ''); ?>>Todos</option>
                                    <?php $__currentLoopData = $months; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value => $label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($value); ?>" <?php echo e($monthValue === $value ? 'selected' : ''); ?>>
                                            <?php echo e($label); ?>

                                        </option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                            </div>

                            <div class="col-md-<?php echo e($esSuperAdmin ? '2' : '4'); ?>">
                                <button type="submit" class="btn migration-search-btn">BUSCAR</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>

            <?php if($hasSearched): ?>
                <div class="migration-table-wrap">
                    <div class="table-responsive">
                        <table class="table table-bordered table-hover align-middle">
                            <thead>
                                <tr>
                                    <th>ITEM</th>
                                    <th>NOMBRE ARCHIVO</th>
                                    <th>FECHA MIGRACION</th>
                                    <th>TIPO MONEDA</th>
                                    <th>NUMERO DE REGISTROS</th>
                                    <th>DESCARGAR</th>
                                    <th>VER</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $__empty_1 = true; $__currentLoopData = $summary; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <tr>
                                        <td class="text-center"><?php echo e($row->item); ?></td>
                                        <td><?php echo e($row->nombre_archivo); ?></td>
                                        <td class="text-center"><?php echo e(\Carbon\Carbon::parse($row->fecha_migracion)->format('d/m/Y H:i:s')); ?></td>
                                        <td class="text-center"><?php echo e((int) $row->tipo_moneda === 1 ? 'SOLES' : 'DOLARES'); ?></td>
                                        <td class="text-center"><?php echo e(number_format((int) $row->numero_registros, 0, '.', ',')); ?></td>
                                        <td class="text-center">
                                            <a href="<?php echo e(route('admin.reportedemigracion.download', $row->token)); ?>" class="btn btn-outline-success btn-sm btn-download-file" title="Descargar archivo migrado">
                                                <i class="fas fa-download"></i>
                                            </a>
                                        </td>
                                        <td class="text-center">
                                            <a href="<?php echo e(route('admin.reportedemigracion.show', $row->token)); ?>" class="btn btn-outline-primary btn-sm btn-view-detail" title="Ver detalle">
                                                <i class="fas fa-search"></i>
                                            </a>
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <tr>
                                        <td colspan="7" class="text-center py-4">No existen migraciones para el filtro seleccionado.</td>
                                    </tr>
                                <?php endif; ?>
                            </tbody>
                        </table>
                    </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 /home/seminari/public_html/seminario/resources/views/Banco/reportedemigracion/index.blade.php ENDPATH**/ ?>