<?php $__env->startSection('title', 'Detail Pegawai — ' . $pegawai->nama_lengkap); ?>
<?php $__env->startSection('page_title', 'Detail Pegawai'); ?>

<?php $__env->startSection('style'); ?>
<style>
/* ── Typography & Base ───────────────────────────────── */
.dp-page { font-family: inherit; }

/* ── Hero ────────────────────────────────────────────── */
.dp-hero {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    background: #f4f1e9;
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 10px;
}
.dp-hero-avatar {
    width: 58px; height: 58px;
    flex: 0 0 58px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #dceeff 0%, #c8def8 100%);
    color: #2f6ea6;
    border-radius: 12px;
    font-size: 1.5rem;
}
.dp-hero-info { flex: 1; min-width: 0; }
.dp-hero-name {
    margin: 0 0 .2rem;
    font-size: 1.18rem; font-weight: 800;
    color: #1a2d3e; line-height: 1.2;
}
.dp-hero-sub {
    margin: 0;
    font-size: .82rem; color: #6c757d;
    display: flex; align-items: center; flex-wrap: wrap; gap: .35rem;
}
.dp-hero-actions { display: flex; gap: .5rem; flex-shrink: 0; }
.dp-hero-dot { color: #bdc8d2; }

/* ── Status Badge ────────────────────────────────────── */
.vs-badge {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .3rem .65rem; border-radius: 20px;
    font-size: .73rem; font-weight: 700; letter-spacing: .03em;
}
.vs-badge.approved { background: #e4f5ec; color: #1a7a47; }
.vs-badge.pending  { background: #fff3d9; color: #8a5500; }
.vs-badge.rejected { background: #fde8e8; color: #9b2020; }

/* ── Section Card ────────────────────────────────────── */
.dp-card {
    background: #f4f1e9;
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1.1rem;
}
.dp-card-head {
    display: flex; align-items: center; gap: .65rem;
    padding: .8rem 1.1rem;
    border-bottom: 1px solid #eef1f5;
    background: #fafbfc;
}
.dp-card-icon {
    width: 28px; height: 28px; flex: 0 0 28px;
    display: flex; align-items: center; justify-content: center;
    background: #e8f2fc; color: #2f6ea6;
    border-radius: 6px; font-size: .75rem;
}
.dp-card-title {
    margin: 0;
    font-size: .88rem; font-weight: 750; color: #1e2e3e;
}
.dp-card-badge {
    margin-left: auto;
    font-size: .72rem; color: #8a96a3;
    background: #eef1f5; padding: .15rem .5rem;
    border-radius: 20px; font-weight: 600;
}
.dp-card-body { padding: 1.1rem; }
.dp-card-table { padding: 0; }

/* ── Info Grid ───────────────────────────────────────── */
.ig-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.75rem; }
.ig-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem 1.5rem; }
.ig-full { display: grid; grid-template-columns: 1fr; gap: .75rem; }

.ig-field {}
.ig-label {
    display: block; margin-bottom: .22rem;
    font-size: .68rem; font-weight: 700; letter-spacing: .06em;
    color: #9aa6b4; text-transform: uppercase;
}
.ig-value {
    font-size: .9rem; font-weight: 600; color: #1e2e3e;
    word-break: break-word; line-height: 1.4;
}
.ig-value.hero-val {
    font-size: 1.05rem; font-weight: 800;
}
.ig-value a { color: #2f6ea6; text-decoration: none; }
.ig-value a:hover { text-decoration: underline; }
.ig-sub {
    display: block; margin-top: .2rem;
    font-size: .76rem; color: #8a96a3; font-weight: 500;
}
.ig-divider {
    border: none; border-top: 1px solid #eef1f5;
    margin: .9rem 0;
}

/* ── Pensiun highlight tiles ─────────────────────────── */
.pensiun-highlight {
    display: grid; grid-template-columns: 1fr 1fr 1fr;
    gap: .75rem; margin-bottom: .9rem;
}
.ph-tile {
    text-align: center; padding: .9rem .75rem;
    background: #f5f8ff; border: 1px solid #dde8f8;
    border-radius: 8px;
}
.ph-tile .ph-number {
    font-size: 1.45rem; font-weight: 800; color: #1a3d6e; line-height: 1;
}
.ph-tile .ph-unit {
    font-size: .72rem; font-weight: 600; color: #6480a0;
}
.ph-tile .ph-label {
    margin-top: .3rem; font-size: .68rem;
    color: #8a96a3; text-transform: uppercase; letter-spacing: .05em;
}

/* ── Warning surface ─────────────────────────────────── */
.warn-box {
    display: flex; gap: .65rem; align-items: flex-start;
    padding: .75rem .9rem; border-radius: 7px;
    background: #fffbec; border: 1px solid #f0d878;
    color: #7a4e00; font-size: .83rem; margin-top: .75rem;
}
.warn-box i { flex: 0 0 auto; margin-top: .1rem; color: #cc9800; }

/* ── Info box (locked) ───────────────────────────────── */
.info-box {
    display: flex; gap: .6rem; align-items: flex-start;
    padding: .7rem .9rem; border-radius: 7px;
    background: #f0f7ff; border: 1px solid #c3dcf3;
    color: #2a5e88; font-size: .82rem;
}
.info-box i { flex: 0 0 auto; margin-top: .15rem; }

/* ── File List ───────────────────────────────────────── */
.dp-file-list { margin: 0; padding: 0; list-style: none; }
.dp-file-item {
    display: flex; align-items: center; gap: .6rem;
    padding: .6rem 1.1rem;
    border-bottom: 1px solid #eef1f5;
    transition: background .15s;
}
.dp-file-item:last-child { border-bottom: none; }
.dp-file-item:hover { background: #f6f9fc; }
.dp-file-icon { color: #e55; flex: 0 0 auto; font-size: .9rem; }
.dp-file-name {
    flex: 1; min-width: 0; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
    font-size: .85rem; font-weight: 600; color: #2f6ea6;
    text-decoration: none;
}
.dp-file-name:hover { text-decoration: underline; }
.dp-file-date { font-size: .74rem; color: #9aa6b4; flex-shrink: 0; }

/* ── Clean Table ─────────────────────────────────────── */
.tbl-clean { margin: 0; }
.tbl-clean thead th {
    padding: .6rem .9rem;
    font-size: .68rem; font-weight: 700; letter-spacing: .05em;
    text-transform: uppercase; color: #7a8c9c;
    background: #f5f7fa; border-bottom: 1px solid #e6ebf0;
    white-space: nowrap;
}
.tbl-clean tbody td {
    padding: .75rem .9rem;
    font-size: .85rem; color: #2a3c4e;
    border-color: #eef1f5; vertical-align: middle;
}
.tbl-clean tbody tr:hover td { background: #f8fafc; }

/* ── Status Pills (table) ────────────────────────────── */
.spill {
    display: inline-flex; padding: .22rem .55rem;
    border-radius: 20px; font-size: .7rem; font-weight: 700;
}
.spill.aktif    { background: #e4f5ec; color: #1a7a47; }
.spill.selesai  { background: #eef1f5; color: #5a6676; }

/* ── Sidebar ─────────────────────────────────────────── */
.sv-card {
    background: #f4f1e9; border: 1px solid rgba(0,0,0,0.05);
    border-radius: 10px; overflow: hidden; margin-bottom: 1.1rem;
}
.sv-head {
    display: flex; align-items: center; gap: .65rem;
    padding: .8rem 1.1rem; border-bottom: 1px solid #eef1f5;
    background: #fafbfc;
}
.sv-status-block {
    margin: 1rem;
    padding: 1rem; border-radius: 8px; text-align: center;
}
.sv-status-block.approved { background: #e4f5ec; }
.sv-status-block.pending  { background: #fff3d9; }
.sv-status-block.rejected { background: #fde8e8; }
.sv-status-icon { font-size: 1.65rem; margin-bottom: .35rem; }
.sv-status-block.approved .sv-status-icon { color: #1a7a47; }
.sv-status-block.pending  .sv-status-icon { color: #8a5500; }
.sv-status-block.rejected .sv-status-icon { color: #9b2020; }
.sv-status-text {
    font-size: .75rem; font-weight: 800;
    letter-spacing: .08em; text-transform: uppercase;
}
.sv-status-block.approved .sv-status-text { color: #1a7a47; }
.sv-status-block.pending  .sv-status-text { color: #8a5500; }
.sv-status-block.rejected .sv-status-text { color: #9b2020; }
.sv-form-area { padding: .25rem 1.1rem 1.1rem; }
.sv-label { font-size: .75rem; font-weight: 700; color: #5a6e80; }

/* ── Riwayat Validasi ────────────────────────────────── */
.rv-list { padding: .25rem 1.1rem .5rem; }
.rv-item {
    padding: .6rem 0;
    border-bottom: 1px solid #eef1f5;
}
.rv-item:last-child { border-bottom: none; }
.rv-time {
    font-size: .72rem; color: #9aa6b4; margin-bottom: .22rem;
    display: flex; align-items: center; gap: .25rem;
}
.rv-desc { font-size: .8rem; color: #2a3c4e; line-height: 1.4; }
.rv-note {
    font-size: .76rem; color: #7a8796;
    font-style: italic; margin-top: .15rem;
}

/* ── Meta Card ───────────────────────────────────────── */
.meta-card {
    background: #f4f1e9; border: 1px solid rgba(0,0,0,0.05);
    border-radius: 10px; overflow: hidden; margin-bottom: 1.1rem;
}
.meta-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: .6rem 1.1rem; border-bottom: 1px solid #eef1f5;
    font-size: .8rem;
}
.meta-row:last-child { border-bottom: none; }
.meta-key { color: #8a96a3; font-weight: 500; }
.meta-val { color: #2a3c4e; font-weight: 700; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 767.98px) {
    .dp-hero { flex-direction: column; align-items: flex-start; }
    .dp-hero-actions { flex-wrap: wrap; }
    .ig-3 { grid-template-columns: 1fr 1fr; }
    .pensiun-highlight { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 575.98px) {
    .ig-2, .ig-3 { grid-template-columns: 1fr; }
    .pensiun-highlight { grid-template-columns: 1fr; }
}
</style>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<?php
    $statusClass = match($pegawai->status_validasi) { 'disetujui' => 'approved', 'pending' => 'pending', default => 'rejected' };
    $statusIcon  = match($pegawai->status_validasi) { 'disetujui' => 'fa-check-circle', 'pending' => 'fa-hourglass-half', default => 'fa-times-circle' };
    $statusLabel = match($pegawai->status_validasi) { 'disetujui' => 'Disetujui', 'pending' => 'Menunggu Validasi', default => 'Ditolak' };
?>


<div class="dp-hero">
    <div class="dp-hero-avatar"><i class="fas fa-user"></i></div>
    <div class="dp-hero-info">
        <p class="dp-hero-name"><?php echo e($pegawai->nama_lengkap); ?></p>
        <p class="dp-hero-sub">
            <span>NIP <?php echo e($pegawai->nip); ?></span>
            <span class="dp-hero-dot">&bull;</span>
            <span><?php echo e($pegawai->jabatan->nama_jabatan_lengkap ?? 'Jabatan belum ditetapkan'); ?></span>
            <span class="dp-hero-dot">&bull;</span>
            <span class="vs-badge <?php echo e($statusClass); ?>"><i class="fas <?php echo e($statusIcon); ?>"></i> <?php echo e($statusLabel); ?></span>
        </p>
    </div>
    <div class="dp-hero-actions">
        <a href="<?php echo e($pegawai->status_validasi === 'disetujui' ? route('admin.pegawai.index') : route('admin.pegawai.submissions')); ?>"
            class="btn btn-outline-secondary btn-sm">
            <i class="fas fa-arrow-left"></i> Kembali
        </a>
        <?php if($pegawai->status_validasi === 'disetujui'): ?>
            <a href="<?php echo e(route('admin.pegawai.edit', $pegawai)); ?>" class="btn btn-primary btn-sm">
                <i class="fas fa-edit"></i> Edit Data
            </a>
        <?php endif; ?>
    </div>
</div>

<div class="row g-3">


<div class="col-lg-8">

    
    <div class="dp-card">
        <div class="dp-card-head">
            <div class="dp-card-icon"><i class="fas fa-id-card"></i></div>
            <h6 class="dp-card-title">Informasi Pribadi</h6>
        </div>
        <div class="dp-card-body">

            
            <div class="ig-2">
                <div class="ig-field">
                    <span class="ig-label">NIP</span>
                    <div class="ig-value hero-val font-monospace"><?php echo e($pegawai->nip); ?></div>
                </div>
                <div class="ig-field">
                    <span class="ig-label">Nama Lengkap</span>
                    <div class="ig-value hero-val"><?php echo e($pegawai->nama_lengkap); ?></div>
                </div>
            </div>

            <hr class="ig-divider">

            
            <div class="ig-2">
                <div class="ig-field">
                    <span class="ig-label">Tempat Lahir</span>
                    <div class="ig-value"><?php echo e($pegawai->tempat_lahir); ?></div>
                </div>
                <div class="ig-field">
                    <span class="ig-label">Tanggal Lahir</span>
                    <div class="ig-value"><?php echo e($pegawai->tanggal_lahir->format('d F Y')); ?></div>
                </div>
                <div class="ig-field">
                    <span class="ig-label">Jenis Kelamin</span>
                    <div class="ig-value"><?php echo e($pegawai->jenis_kelamin); ?></div>
                </div>
                <div class="ig-field">
                    <span class="ig-label">Golongan / Pangkat</span>
                    <div class="ig-value"><?php echo e($pegawai->golongan ?? '—'); ?></div>
                </div>
            </div>

            <hr class="ig-divider">

            
            <div class="ig-2">
                <div class="ig-field">
                    <span class="ig-label">Pendidikan Terakhir</span>
                    <div class="ig-value"><?php echo e($pegawai->pendidikan_terakhir); ?></div>
                </div>
                <div class="ig-field">
                    <span class="ig-label">Nomor Telepon</span>
                    <div class="ig-value"><?php echo e($pegawai->no_hp); ?></div>
                </div>
            </div>

            <div style="margin-top:.9rem;" class="ig-full">
                <div class="ig-field">
                    <span class="ig-label">Email</span>
                    <div class="ig-value"><a href="mailto:<?php echo e($pegawai->email); ?>"><?php echo e($pegawai->email); ?></a></div>
                </div>
                <div class="ig-field">
                    <span class="ig-label">Alamat Lengkap</span>
                    <div class="ig-value" style="color:#2a3c4e;"><?php echo e($pegawai->alamat); ?></div>
                </div>
            </div>

        </div>
    </div>

    
    <div class="dp-card">
        <div class="dp-card-head">
            <div class="dp-card-icon"><i class="fas fa-briefcase"></i></div>
            <h6 class="dp-card-title">Informasi Jabatan</h6>
        </div>
        <div class="dp-card-body">
            <div class="ig-3">
                <div class="ig-field">
                    <span class="ig-label">Unit Kerja</span>
                    <div class="ig-value"><?php echo e($pegawai->unit_kerja); ?></div>
                </div>
                <div class="ig-field">
                    <span class="ig-label">Jabatan Fungsional</span>
                    <div class="ig-value">
                        <?php echo e($pegawai->jabatan->nama_jabatan ?? '—'); ?>

                        <?php if($pegawai->jabatan): ?>
                            <span class="ig-sub">Jenjang: <?php echo e($pegawai->jabatan->jenjang_label); ?> &bull; <?php echo e($pegawai->jabatan->kategori); ?></span>
                        <?php endif; ?>
                    </div>
                </div>
                <div class="ig-field">
                    <span class="ig-label">TMT Jabatan</span>
                    <div class="ig-value"><?php echo e($pegawai->tanggal_mulai_jabatan->format('d F Y')); ?></div>
                </div>
            </div>
        </div>
    </div>

    
    <?php if($pegawai->retirement_info): ?>
    <div class="dp-card">
        <div class="dp-card-head">
            <div class="dp-card-icon"><i class="fas fa-calendar-alt"></i></div>
            <h6 class="dp-card-title">Perkiraan Pensiun</h6>
        </div>
        <div class="dp-card-body">

            
            <div class="pensiun-highlight">
                <div class="ph-tile">
                    <div class="ph-number"><?php echo e($pegawai->retirement_info['usia_pensiun']); ?></div>
                    <div class="ph-unit">tahun</div>
                    <div class="ph-label">Batas Usia</div>
                </div>
                <div class="ph-tile">
                    <div class="ph-number"><?php echo e($pegawai->retirement_info['tahun_pensiun']); ?></div>
                    <div class="ph-unit">&nbsp;</div>
                    <div class="ph-label">Tahun Pensiun</div>
                </div>
                <div class="ph-tile">
                    <div class="ph-number" style="font-size:1.05rem;"><?php echo e($pegawai->retirement_info['kategori']); ?></div>
                    <div class="ph-unit">&nbsp;</div>
                    <div class="ph-label">Kategori JF</div>
                </div>
            </div>

            <div class="ig-2">
                <div class="ig-field">
                    <span class="ig-label">Perkiraan Tanggal Pensiun</span>
                    <div class="ig-value"><?php echo e($pegawai->retirement_info['tanggal_pensiun']->format('d F Y')); ?></div>
                </div>
                <div class="ig-field">
                    <span class="ig-label">Golongan Umum Jenjang</span>
                    <div class="ig-value"><?php echo e($pegawai->retirement_info['rentang_golongan']); ?></div>
                </div>
            </div>

            <?php if($pegawai->retirement_info['peringatan_golongan']): ?>
                <div class="warn-box">
                    <i class="fas fa-exclamation-triangle"></i>
                    <span><?php echo e($pegawai->retirement_info['peringatan_golongan']); ?></span>
                </div>
            <?php endif; ?>

        </div>
    </div>
    <?php endif; ?>

    
    <?php if($pegawai->files->count() > 0): ?>
    <div class="dp-card">
        <div class="dp-card-head">
            <div class="dp-card-icon"><i class="fas fa-file-alt"></i></div>
            <h6 class="dp-card-title">Dokumen Pendukung</h6>
            <span class="dp-card-badge"><?php echo e($pegawai->files->count()); ?> file</span>
        </div>
        <div class="dp-card-table">
            <ul class="dp-file-list">
                <?php $__currentLoopData = $pegawai->files; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $file): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <li class="dp-file-item">
                        <i class="fas fa-file-pdf dp-file-icon"></i>
                        <a href="<?php echo e(URL::temporarySignedRoute('pegawai.files.show', now()->addHours(2), ['file' => $file->id])); ?>"
                            class="dp-file-name" target="_blank"><?php echo e($file->nama_file); ?></a>
                        <span class="dp-file-date"><?php echo e($file->created_at->format('d-m-Y')); ?></span>
                    </li>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </ul>
        </div>
    </div>
    <?php endif; ?>

    
    <?php if($pegawai->jabatanHistories->count() > 0 || $pegawai->jabatan): ?>
    <div class="dp-card">
        <div class="dp-card-head">
            <div class="dp-card-icon"><i class="fas fa-history"></i></div>
            <h6 class="dp-card-title">Riwayat Jabatan</h6>
        </div>
        <div class="dp-card-table">
            <div class="table-responsive">
                <table class="table tbl-clean">
                    <thead>
                        <tr>
                            <th>Jabatan</th>
                            <th>Jenjang</th>
                            <th>TMT</th>
                            <th>Selesai</th>
                            <th>Nomor SK</th>
                            <th>Status</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                            $riwayatSelesai = $pegawai->jabatanHistories->where('status','selesai')->sortBy('tanggal_mulai_jabatan')->values();
                            $riwayatAktif   = $pegawai->jabatanHistories->where('status','aktif')->sortByDesc('created_at')->first();
                        ?>
                        <?php $__currentLoopData = $riwayatSelesai; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $h): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <?php
                                $jabatanRiwayat = $h->jabatan_sebelumnya ?? $h->jabatan->nama_jabatan ?? $h->nama_jabatan ?? '—';
                                $jenjangRiwayat = $h->jenjang_sebelumnya ?? $h->jabatan->jenjang_label ?? $h->jenjang ?? '—';
                                $jenjangSuffix  = ' - ' . $jenjangRiwayat;
                                $riwayatNext    = $riwayatSelesai->get($loop->index + 1);
                                $tahunTmt     = $h->tanggal_mulai_jabatan?->format('Y') ?? '—';
                                $tahunSelesai = $riwayatNext?->tanggal_mulai_jabatan?->format('Y')
                                    ?? $pegawai->tanggal_mulai_jabatan?->format('Y') ?? '—';
                                if ($jenjangRiwayat !== '—' && str_ends_with($jabatanRiwayat, $jenjangSuffix)) {
                                    $jabatanRiwayat = substr($jabatanRiwayat, 0, -strlen($jenjangSuffix));
                                }
                            ?>
                            <tr>
                                <td><?php echo e($jabatanRiwayat); ?></td>
                                <td style="color:#6a7c8e;font-size:.8rem;"><?php echo e($jenjangRiwayat); ?></td>
                                <td style="font-size:.8rem;"><?php echo e($tahunTmt); ?></td>
                                <td style="font-size:.8rem;"><?php echo e($tahunSelesai); ?></td>
                                <td style="font-size:.8rem;"><?php echo e($h->nomor_sk ?? '—'); ?></td>
                                <td><span class="spill selesai">Selesai</span></td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        <?php if($pegawai->jabatan): ?>
                            <tr>
                                <td><strong><?php echo e($pegawai->jabatan->nama_jabatan); ?></strong></td>
                                <td style="color:#6a7c8e;font-size:.8rem;"><?php echo e($pegawai->jabatan->jenjang_label); ?></td>
                                <td style="font-size:.8rem;"><?php echo e($pegawai->tanggal_mulai_jabatan?->format('Y') ?? '—'); ?></td>
                                <td style="font-size:.8rem; color:#ccc;">—</td>
                                <td style="font-size:.8rem;"><?php echo e($riwayatAktif?->nomor_sk ?? '—'); ?></td>
                                <td><span class="spill aktif">Aktif</span></td>
                            </tr>
                        <?php endif; ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <?php endif; ?>

</div>


<div class="col-lg-4">

    
    <div class="sv-card">
        <div class="sv-head">
            <div class="dp-card-icon"><i class="fas fa-shield-alt"></i></div>
            <h6 class="dp-card-title">Status Validasi</h6>
        </div>

        <div class="sv-status-block <?php echo e($statusClass); ?>">
            <div class="sv-status-icon"><i class="fas <?php echo e($statusIcon); ?>"></i></div>
            <div class="sv-status-text"><?php echo e($statusLabel); ?></div>
        </div>

        <?php if($pegawai->status_validasi === 'ditolak' && $pegawai->catatan_penolakan): ?>
            <div style="margin: 0 1rem .75rem;">
                <div class="warn-box">
                    <i class="fas fa-comment-dots"></i>
                    <span><strong>Alasan:</strong> <?php echo e($pegawai->catatan_penolakan); ?></span>
                </div>
            </div>
        <?php endif; ?>

        <?php if($pegawai->status_validasi !== 'disetujui'): ?>
            <div class="sv-form-area">
                <form id="validationForm" action="<?php echo e(route('admin.pegawai.validation', $pegawai)); ?>" method="POST">
                    <?php echo csrf_field(); ?>
                    <div class="mb-3">
                        <label for="status_validasi" class="form-label sv-label">Ubah Status Validasi</label>
                        <select id="status_validasi" name="status_validasi"
                            class="form-select form-select-sm <?php $__errorArgs = ['status_validasi'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>" required>
                            <option value="pending"   <?php if(old('status_validasi', $pegawai->status_validasi) === 'pending'): echo 'selected'; endif; ?>>Menunggu Validasi</option>
                            <option value="disetujui" <?php if(old('status_validasi', $pegawai->status_validasi) === 'disetujui'): echo 'selected'; endif; ?>>Disetujui</option>
                            <option value="ditolak"   <?php if(old('status_validasi', $pegawai->status_validasi) === 'ditolak'): echo 'selected'; endif; ?>>Ditolak</option>
                        </select>
                        <?php $__errorArgs = ['status_validasi'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="invalid-feedback"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>
                    <div class="mb-3">
                        <label for="catatan_validasi" class="form-label sv-label">Catatan Validasi</label>
                        <textarea id="catatan_validasi" name="catatan_validasi" rows="3"
                            class="form-control form-control-sm <?php $__errorArgs = ['catatan_validasi'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?> is-invalid <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>"
                            placeholder="Tambahkan catatan..."><?php echo e(old('catatan_validasi')); ?></textarea>
                        <div class="form-text" style="font-size:.72rem;">Wajib diisi jika status ditolak.</div>
                        <?php $__errorArgs = ['catatan_validasi'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><div class="invalid-feedback"><?php echo e($message); ?></div><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>
                    <button type="submit" class="btn btn-primary btn-sm w-100">
                        <i class="fas fa-save"></i> Simpan Validasi
                    </button>
                </form>
            </div>
        <?php else: ?>
            <div style="margin: 0 1rem 1rem;">
                <div class="info-box">
                    <i class="fas fa-lock"></i>
                    <span>Data sudah disetujui. Status tidak dapat diubah kembali.</span>
                </div>
            </div>
        <?php endif; ?>
    </div>

    
    <?php if($pegawai->validationHistories->count() > 0): ?>
    <div class="sv-card">
        <div class="sv-head">
            <div class="dp-card-icon"><i class="fas fa-clipboard-list"></i></div>
            <h6 class="dp-card-title">Riwayat Validasi</h6>
            <span class="dp-card-badge"><?php echo e($pegawai->validationHistories->count()); ?></span>
        </div>
        <div class="rv-list">
            <?php $__currentLoopData = $pegawai->validationHistories->sortByDesc('created_at')->take(5); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $history): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <div class="rv-item">
                    <div class="rv-time">
                        <i class="fas fa-clock" style="font-size:.65rem;"></i>
                        <?php echo e($history->created_at->format('d M Y, H:i')); ?>

                    </div>
                    <div class="rv-desc">
                        <strong><?php echo e($history->admin->name ?? '—'); ?></strong>
                        mengubah dari
                        <strong><?php echo e($history->status_sebelumnya_label); ?></strong>
                        ke <strong><?php echo e($history->status_baru_label); ?></strong>
                    </div>
                    <?php if($history->catatan): ?>
                        <div class="rv-note">"<?php echo e($history->catatan); ?>"</div>
                    <?php endif; ?>
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </div>
    </div>
    <?php endif; ?>

    
    <div class="meta-card">
        <div class="meta-row">
            <span class="meta-key"><i class="fas fa-plus-circle" style="font-size:.65rem;"></i> Dibuat</span>
            <span class="meta-val"><?php echo e($pegawai->created_at->format('d M Y, H:i')); ?></span>
        </div>
        <div class="meta-row">
            <span class="meta-key"><i class="fas fa-pencil-alt" style="font-size:.65rem;"></i> Diperbarui</span>
            <span class="meta-val"><?php echo e($pegawai->updated_at->format('d M Y, H:i')); ?></span>
        </div>
    </div>

</div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('script'); ?>
<script>
document.addEventListener('DOMContentLoaded', function () {
    const validationForm = document.getElementById('validationForm');
    if (validationForm) {
        validationForm.addEventListener('submit', function (e) {
            e.preventDefault();
            
            Swal.fire({
                title: 'Konfirmasi Validasi',
                text: "Apakah Anda yakin ingin menyimpan perubahan status validasi ini?",
                icon: 'question',
                showCancelButton: true,
                confirmButtonColor: '#4a3728',
                cancelButtonColor: '#d33',
                confirmButtonText: 'Ya, Simpan!',
                cancelButtonText: 'Batal'
            }).then((result) => {
                if (result.isConfirmed) {
                    Swal.fire({
                        title: 'Memproses...',
                        html: 'Sedang menyimpan data dan mengirim email pemberitahuan.<br>Mohon tunggu sebentar.',
                        allowOutsideClick: false,
                        allowEscapeKey: false,
                        showConfirmButton: false,
                        didOpen: () => {
                            Swal.showLoading();
                        }
                    });
                    
                    validationForm.submit();
                }
            });
        });
    }
});
</script>
<?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/pegawai/show.blade.php ENDPATH**/ ?>