

<?php $__env->startSection('title', 'Senarai Sekolah KKM — Lebihan Buku'); ?>

<?php $__env->startSection('content_header'); ?>
    <h1><i class="fas fa-mosque mr-2"></i>Senarai Sekolah KKM — Lebihan Buku</h1>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
    <div class="mb-3">
        <a href="<?php echo e(route('supervisor.laporan.kkm-lebih-buku')); ?>" class="btn btn-outline-secondary btn-sm">
            <i class="fas fa-arrow-left mr-1"></i> Kembali ke Laporan Lebih Buku KKM
        </a>
    </div>

    <div class="d-flex justify-content-between align-items-center mb-3">
        <h5 class="text-muted mb-0">
            <i class="fas fa-list-ol mr-1"></i> Senarai Sekolah KKM Yang Ada Lebihan Buku
            — Daerah: <span class="badge badge-primary"><?php echo e($daerah); ?></span>
        </h5>
        <form method="GET" action="<?php echo e(route('supervisor.laporan.kkm-senarai-sekolah-lebihan')); ?>" class="form-inline">
            <label class="mr-2 text-muted"><i class="fas fa-calendar-alt mr-1"></i>Tahun:</label>
            <select name="tahun" class="form-control form-control-sm" onchange="this.form.submit()">
                <?php $__currentLoopData = $senarai_tahun; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $t): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($t); ?>" <?php echo e($t == $tahun ? 'selected' : ''); ?>><?php echo e($t); ?></option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </select>
        </form>
    </div>

    <div class="card card-outline card-success">
        <div class="card-header">
            <h3 class="card-title"><i class="fas fa-boxes mr-1"></i> Ringkasan Lebihan Buku KKM — Tahun <?php echo e($tahun); ?>

            </h3>
        </div>
        <div class="card-body p-0">
            <table class="table table-hover table-striped mb-0">
                <thead class="thead-light">
                    <tr>
                        <th>Bil</th>
                        <th>Nama Sekolah</th>
                        <th>Kod Sekolah</th>
                        <th class="text-center">Jumlah Lebihan Buku</th>
                        <th class="text-center">Tindakan</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__empty_1 = true; $__currentLoopData = $senarai; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $i => $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                        <?php $user = $item['user']; ?>
                        <tr>
                            <td><?php echo e($i + 1); ?></td>
                            <td><?php echo e($user->nama_sekolah ?? '-'); ?></td>
                            <td><span class="badge badge-primary"><?php echo e($user->kod_sekolah ?? '-'); ?></span></td>
                            <td
                                class="text-center font-weight-bold <?php echo e($item['total_lebihan'] < 0 ? 'text-danger' : 'text-success'); ?>">
                                <?php echo e(number_format($item['total_lebihan'])); ?>

                            </td>
                            <td class="text-center">
                                <a href="<?php echo e(route('supervisor.lihat-buku', $user->id)); ?>?from=kkm-senarai-sekolah-lebihan"
                                    class="btn btn-success btn-sm">
                                    <i class="fas fa-eye mr-1"></i>Detail
                                </a>
                            </td>
                        </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                        <tr>
                            <td colspan="5" class="text-center text-muted py-4">
                                <i class="fas fa-info-circle mr-1"></i> Tiada sekolah KKM dengan lebihan buku untuk tahun
                                <?php echo e($tahun); ?>.
                            </td>
                        </tr>
                    <?php endif; ?>
                </tbody>
                <?php if($senarai->isNotEmpty()): ?>
                    <tfoot class="thead-light">
                        <tr>
                            <th colspan="3" class="text-right">Jumlah Keseluruhan:</th>
                            <?php $grandTotal = $senarai->sum('total_lebihan'); ?>
                            <th class="text-center <?php echo e($grandTotal < 0 ? 'text-danger' : 'text-success'); ?>">
                                <?php echo e(number_format($grandTotal)); ?>

                            </th>
                            <th></th>
                        </tr>
                    </tfoot>
                <?php endif; ?>
            </table>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('adminlte::page', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\laragon\www\myspbt\resources\views/supervisor/laporan/kkm-senarai-sekolah-lebihan.blade.php ENDPATH**/ ?>