<?php $__env->startSection('title', 'Data Pegawai Sudah Pensiun'); ?>

<?php $__env->startSection('content'); ?>
<div class="content-header mb-4">
    <div class="d-flex justify-content-between align-items-center">
        <div>
            <h4 class="mb-1">Data Pegawai Sudah Pensiun</h4>
        </div>
        <div>
            <a href="<?php echo e(route('admin.dashboard.pensiun')); ?>" class="btn btn-outline-secondary">
                <i class="fas fa-arrow-left me-1"></i> Kembali
            </a>
        </div>
    </div>
</div>

<div class="card border-0 shadow-sm rounded-4">
    <div class="card-body p-0">
        <?php if($pegawai->isNotEmpty()): ?>
            <div class="table-responsive">
                <table class="table table-hover align-middle mb-0">
                    <thead class="bg-light">
                        <tr>
                            <th class="border-0 px-4 py-3" style="width: 5%">No</th>
                            <th class="border-0 px-4 py-3" style="width: 30%">Informasi Pegawai</th>
                            <th class="border-0 px-4 py-3" style="width: 30%">Jabatan Terakhir & Unit Kerja</th>
                            <th class="border-0 px-4 py-3" style="width: 15%">Usia Pensiun</th>
                            <th class="border-0 px-4 py-3" style="width: 20%">Tanggal Pensiun</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__currentLoopData = $pegawai; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $index => $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td class="px-4 py-3"><?php echo e($pegawai->firstItem() + $index); ?></td>
                                <td class="px-4 py-3">
                                    <div class="fw-bold text-dark"><?php echo e($item->nama_lengkap); ?></div>
                                    <div class="text-muted small">NIP. <?php echo e($item->nip); ?></div>
                                </td>
                                <td class="px-4 py-3">
                                    <div class="fw-medium"><?php echo e($item->jabatan?->nama_jabatan ?? '-'); ?></div>
                                    <div class="text-muted small"><?php echo e($item->unit_kerja); ?></div>
                                </td>
                                <td class="px-4 py-3">
                                    <span class="badge bg-secondary">
                                        <?php echo e($item->retirement_info['usia_pensiun'] ?? '-'); ?> Tahun
                                    </span>
                                </td>
                                <td class="px-4 py-3">
                                    <div class="fw-bold text-danger">
                                        <?php echo e(isset($item->retirement_info['tanggal_pensiun']) ? $item->retirement_info['tanggal_pensiun']->translatedFormat('d F Y') : '-'); ?>

                                    </div>
                                    <?php if(isset($item->retirement_info['tanggal_pensiun'])): ?>
                                        <?php
                                            $diff = now()->diff($item->retirement_info['tanggal_pensiun']);
                                            $years = $diff->y;
                                            $months = $diff->m;
                                        ?>
                                        <div class="small text-muted mt-1">
                                            Berlalu: 
                                            <?php if($years > 0): ?>
                                                <?php echo e($years); ?> thn, 
                                            <?php endif; ?>
                                            <?php echo e($months); ?> bln
                                        </div>
                                    <?php endif; ?>
                                </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                </table>
            </div>
            
            <?php if($pegawai->hasPages()): ?>
                <?php echo e($pegawai->links()); ?>

            <?php endif; ?>
        <?php else: ?>
            <div class="p-5 text-center text-muted">
                <i class="fas fa-box-open mb-3 fs-2"></i>
                <p class="mb-0">Tidak ada data pegawai yang sudah pensiun.</p>
            </div>
        <?php endif; ?>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\Skripsi-M\resources\views/admin/sudah-pensiun.blade.php ENDPATH**/ ?>