<?php $__env->startSection('title', 'Verifikasi Data Mustahik'); ?>
<?php $__env->startSection('topbar_title', 'Verifikasi Mustahik'); ?>

<?php $__env->startSection('content'); ?>
<div class="page-header" style="margin-bottom: 24px;">
    <div class="page-header-left">
        <h1 style="font-size: 24px;">Verifikasi Data Mustahik</h1>
    </div>
</div>

<div class="card" style="padding:16px 20px; margin-bottom:20px;">
    <form method="GET" action="<?php echo e(url('/amil/verifikasi')); ?>" style="display:flex; justify-content:space-between; align-items:center;">
        <div style="display:flex; gap:12px;">
            <div class="select-wrap" style="width:160px;">
                <select name="status" class="form-ctrl" onchange="this.form.submit()">
                    <option value="">Semua Status</option>
                    <option value="Pending"   <?php echo e(request('status') == 'Pending' ? 'selected' : ''); ?>>Pending</option>
                    <option value="Disetujui" <?php echo e(request('status') == 'Disetujui' ? 'selected' : ''); ?>>Disetujui</option>
                    <option value="Ditolak"   <?php echo e(request('status') == 'Ditolak' ? 'selected' : ''); ?>>Ditolak</option>
                </select>
            </div>
            <div class="select-wrap" style="width:200px;">
                <select name="wilayah" class="form-ctrl" onchange="this.form.submit()">
                    <option value="">Semua Wilayah</option>
                    <?php $__currentLoopData = $wilayahList; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $w): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($w->id_wilayah); ?>" <?php echo e(request('wilayah') == $w->id_wilayah ? 'selected' : ''); ?>>
                            RT <?php echo e(str_pad($w->rt, 2, '0', STR_PAD_LEFT)); ?> / RW <?php echo e(str_pad($w->rw, 2, '0', STR_PAD_LEFT)); ?>

                        </option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select>
            </div>
        </div>
        
        <div style="position:relative; width:280px;">
            <i class="bi bi-search" style="position:absolute; left:14px; top:50%; transform:translateY(-50%); color:var(--text-muted);"></i>
            <input type="text" name="search" class="form-ctrl" style="padding-left:40px;" placeholder="Cari Nama / NIK..." value="<?php echo e(request('search')); ?>">
            <?php if(request('search')): ?>
                <button type="submit" style="display:none;"></button>
            <?php endif; ?>
        </div>
    </form>
</div>

<div class="card">
    <table class="data-table">
        <thead>
            <tr>
                <th style="width:50px;">No</th>
                <th>Nama Mustahik</th>
                <th>Wilayah</th>
                <th>Kategori Asnaf</th>
                <th>Kondisi</th>
                <th>Tgl Pengajuan</th>
                <th>Status</th>
            </tr>
        </thead>
        <tbody>
            <?php $__empty_1 = true; $__currentLoopData = $dataVerifikasi; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $i => $m): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
            <tr>
                <td style="color:var(--text-muted);"><?php echo e($dataVerifikasi->firstItem() + $i); ?></td>
                <td>
                    <div style="font-weight:600; font-size:13.5px;"><?php echo e($m->nama_mustahik); ?></div>
                    <div style="font-size:12px; color:var(--text-muted); margin-top:2px;"><?php echo e($m->nik_kepala_kk); ?></div>
                </td>
                <td style="font-size:13px; color:var(--text-muted);">
                    <?php if($m->kk && $m->kk->wilayah): ?>
                        RT <?php echo e(str_pad($m->kk->wilayah->rt, 2, '0', STR_PAD_LEFT)); ?> / RW <?php echo e(str_pad($m->kk->wilayah->rw, 2, '0', STR_PAD_LEFT)); ?>

                    <?php else: ?>
                        -
                    <?php endif; ?>
                </td>
                <td>
                    <?php
                        $asnafClass = match($m->kategori_asnaf) {
                            'Fakir' => 'badge-fakir', 'Miskin' => 'badge-miskin',
                            'Gharim' => 'badge-gharim', 'Ibnu Sabil' => 'badge-sabil', default => 'badge-gray',
                        };
                    ?>
                    <span class="badge-pill <?php echo e($asnafClass); ?>"><?php echo e($m->kategori_asnaf); ?></span>
                </td>
                <td style="font-size:13px; color:var(--text-muted);">
                    <?php echo e($m->status_kondisi_warga); ?>, <?php echo e($m->pekerjaan); ?>

                </td>
                <td style="font-size:12.5px; color:var(--text-muted);">
                    <?php echo e(\Carbon\Carbon::parse($m->tanggal_pengajuan)->format('d M Y')); ?>

                </td>
                <td>
                    <?php
                        $statusClass = match($m->status) {
                            'Pending' => 'badge-orange', 'Disetujui' => 'badge-green', 'Ditolak' => 'badge-red', default => 'badge-gray',
                        };
                    ?>
                    <span class="badge-pill <?php echo e($statusClass); ?>" style="padding:6px 12px; font-size:11px;">
                        <?php echo e($m->status); ?>

                    </span>
                </td>
            </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
            <tr>
                <td colspan="7" style="text-align:center; padding:40px; color:var(--text-muted);">
                    <i class="bi bi-inbox" style="font-size:36px; display:block; margin-bottom:10px;"></i>
                    Tidak ada data pengajuan mustahik yang ditemukan.
                </td>
            </tr>
            <?php endif; ?>
        </tbody>
    </table>
    
    <div class="pagination-wrap">
        <span>Menampilkan <?php echo e($dataVerifikasi->firstItem() ?? 0); ?>-<?php echo e($dataVerifikasi->lastItem() ?? 0); ?> dari <?php echo e($dataVerifikasi->total()); ?> data</span>
        <div class="pagination-btns">
            <?php if($dataVerifikasi->onFirstPage()): ?>
                <button class="page-btn" disabled><i class="bi bi-chevron-left"></i></button>
            <?php else: ?>
                <a href="<?php echo e($dataVerifikasi->previousPageUrl()); ?>" class="page-btn"><i class="bi bi-chevron-left"></i></a>
            <?php endif; ?>

            <?php $__currentLoopData = $dataVerifikasi->getUrlRange(max(1, $dataVerifikasi->currentPage()-1), min($dataVerifikasi->lastPage(), $dataVerifikasi->currentPage()+1)); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $page => $url): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <a href="<?php echo e($url); ?>" class="page-btn <?php echo e($page == $dataVerifikasi->currentPage() ? 'active' : ''); ?>"><?php echo e($page); ?></a>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

            <?php if($dataVerifikasi->hasMorePages()): ?>
                <a href="<?php echo e($dataVerifikasi->nextPageUrl()); ?>" class="page-btn"><i class="bi bi-chevron-right"></i></a>
            <?php else: ?>
                <button class="page-btn" disabled><i class="bi bi-chevron-right"></i></button>
            <?php endif; ?>
        </div>
    </div>
</div>

<style>
.action-icon-btn {
    width: 28px; height: 28px; border-radius: 6px;
    background: #f3f4f6; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); transition: all .15s; font-size: 14px;
}
.action-icon-btn:hover { background: #e5e7eb; color: var(--text-dark); }
</style>

<?php $__env->stopSection(); ?>
<?php echo $__env->make(Auth::user()->int_role == 'superadmin' ? 'layouts.superadmin' : 'layouts.amil', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH D:\Skripsi\zakat-masjid\resources\views/amil/verifikasi_data_mustahik.blade.php ENDPATH**/ ?>