<?php $__env->startSection('title', 'Daftar Laporan - KITA AKADEMIK'); ?>
<?php $__env->startSection('page-title', 'Daftar Laporan & Aduan'); ?>

<?php $__env->startSection('content'); ?>
<div class="row">
    <div class="col-12">
        <!-- Search & Filter Card -->
        <div class="card card-custom p-4 mb-4">
            <form action="<?php echo e(route('laporan.index')); ?>" method="GET" class="row g-3 align-items-end">
                <div class="col-md-4">
                    <label for="search" class="form-label small fw-bold text-muted">CARI JUDUL</label>
                    <div class="input-group">
                        <span class="input-group-text bg-white border-end-0 text-muted"><i class="fa-solid fa-magnifying-glass"></i></span>
                        <input type="text" class="form-control border-start-0 ps-0" id="search" name="search" placeholder="Masukkan judul..." value="<?php echo e(request('search')); ?>">
                    </div>
                </div>

                <div class="col-md-3">
                    <label for="tipe_laporan" class="form-label small fw-bold text-muted">KATEGORI LAPORAN</label>
                    <select class="form-select" id="tipe_laporan" name="tipe_laporan">
                        <option value="">Semua Kategori</option>
                        <option value="preventif_konseling" <?php echo e(request('tipe_laporan') === 'preventif_konseling' ? 'selected' : ''); ?>>1. Preventif & Bimbingan</option>
                        <option value="kekerasan_bullying" <?php echo e(request('tipe_laporan') === 'kekerasan_bullying' ? 'selected' : ''); ?>>2. Kekerasan & Bullying</option>
                        <option value="integritas_akademik" <?php echo e(request('tipe_laporan') === 'integritas_akademik' ? 'selected' : ''); ?>>3. Integritas Akademik</option>
                    </select>
                </div>

                <div class="col-md-3">
                    <label for="status" class="form-label small fw-bold text-muted">STATUS LAPORAN</label>
                    <select class="form-select" id="status" name="status">
                        <option value="">Semua Status</option>
                        <option value="diajukan" <?php echo e(request('status') === 'diajukan' ? 'selected' : ''); ?>>Diajukan</option>
                        <option value="menunggu_satgas" <?php echo e(request('status') === 'menunggu_satgas' ? 'selected' : ''); ?>>Antrean Satgas</option>
                        <option value="menunggu_penilai" <?php echo e(request('status') === 'menunggu_penilai' ? 'selected' : ''); ?>>Antrean Tim Penilai</option>
                        <option value="menunggu_psikolog" <?php echo e(request('status') === 'menunggu_psikolog' ? 'selected' : ''); ?>>Antrean Psikolog</option>
                        <option value="menunggu_rektor" <?php echo e(request('status') === 'menunggu_rektor' ? 'selected' : ''); ?>>Menunggu Rektor</option>
                        <option value="selesai" <?php echo e(request('status') === 'selesai' ? 'selected' : ''); ?>>Selesai</option>
                    </select>
                </div>

                <div class="col-md-2 d-flex gap-2">
                    <button type="submit" class="btn btn-primary w-100 py-2 fw-semibold">
                        <i class="fa-solid fa-filter"></i> Saring
                    </button>
                    <a href="<?php echo e(route('laporan.index')); ?>" class="btn btn-light w-100 py-2 text-muted fw-semibold">
                        Reset
                    </a>
                </div>
            </form>
        </div>

        <!-- Listing Card -->
        <div class="card card-custom p-4">
            <?php if($laporans->isEmpty()): ?>
                <div class="text-center py-5">
                    <div class="fs-1 text-muted mb-3"><i class="fa-solid fa-file-excel"></i></div>
                    <h6 class="fw-bold text-muted">Laporan Tidak Ditemukan</h6>
                    <p class="text-muted small mb-0">Cobalah untuk menyesuaikan filter pencarian Anda.</p>
                </div>
            <?php else: ?>
                <div class="table-responsive">
                    <table class="table table-hover align-middle mb-0">
                        <thead>
                            <tr class="text-muted" style="font-size: 0.85rem;">
                                <th>KASUS ID</th>
                                <th>PELAPOR / PTS</th>
                                <th>KATEGORI</th>
                                <th>JUDUL LAPORAN</th>
                                <th>TANGGAL MASUK</th>
                                <th>STATUS</th>
                                <th class="text-center">AKSI</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__currentLoopData = $laporans; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $lap): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td><span class="badge bg-dark text-white fw-bold">#K-<?php echo e(str_pad($lap->id, 4, '0', STR_PAD_LEFT)); ?></span></td>
                                <td>
                                    <div class="fw-semibold text-dark"><?php echo e($lap->pelapor_nama); ?></div>
                                    <small class="text-muted"><?php echo e($lap->pts_nama); ?></small>
                                </td>
                                <td>
                                    <?php if($lap->tipe_laporan === 'preventif_konseling'): ?>
                                        <span class="badge bg-info-subtle text-info">Preventif Konseling</span>
                                    <?php elseif($lap->tipe_laporan === 'kekerasan_bullying'): ?>
                                        <span class="badge bg-danger-subtle text-danger">Kekerasan / Bullying</span>
                                    <?php elseif($lap->tipe_laporan === 'integritas_akademik'): ?>
                                        <span class="badge bg-warning-subtle text-warning">Integritas Akademik</span>
                                    <?php endif; ?>
                                </td>
                                <td>
                                    <div class="fw-bold text-slate-800 text-truncate" style="max-width: 250px;"><?php echo e($lap->judul); ?></div>
                                    <small class="text-muted text-truncate d-block" style="max-width: 250px;"><?php echo e(Str::limit($lap->deskripsi, 50)); ?></small>
                                </td>
                                <td>
                                    <div><?php echo e($lap->created_at->format('d M Y')); ?></div>
                                    <small class="text-muted"><?php echo e($lap->created_at->format('H:i')); ?> WIB</small>
                                </td>
                                <td>
                                    <?php if($lap->dipantau_lldikti): ?>
                                        <span class="badge bg-info text-dark py-1.5 px-3 rounded-pill mb-1 d-inline-block"><i class="fa-solid fa-eye me-1"></i> Dipantau LLDIKTI</span><br>
                                    <?php endif; ?>
                                    <?php echo $__env->make('laporan._status_badge', ['status' => $lap->status], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                                </td>
                                <td class="text-center">
                                    <a href="<?php echo e(route('laporan.show', $lap->id)); ?>" class="btn btn-sm btn-primary rounded-pill px-3 fw-bold">
                                        <i class="fa-solid fa-folder-open"></i> Detail
                                    </a>
                                </td>
                            </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>

                <div class="mt-4">
                    <?php echo e($laporans->links()); ?>

                </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 C:\laragon\www\SIM-KITA-LLDIKTI-3\resources\views/laporan/index.blade.php ENDPATH**/ ?>