

<?php $__env->startSection('title', ''); ?>

<?php $__env->startSection('content'); ?>

<style>
    .bg-pink { background-color: #6b353dff !important; }
    .table-fixed th, .table-fixed td { white-space: nowrap; }
    .table-bordered th, .table-bordered td { border: 1px solid #dee2e6 !important; }
    .small-col { width: 120px; }
    .phone-col { width: 140px; }
</style>

<div class="card">
    <div class="card-header bg-pink text-white d-flex justify-content-between align-items-center">
            <div>
                <h5 class="mb-0"><i class="bi bi-star me-1"></i> Walimurid</h5>
                <p class="mb-0 small text-white-50">Halaman Data Walimurid Peserta Didik</p>
            </div>
        </div>
        <?php
            $activePeriode = \App\Models\Periode::where('status', \App\Models\Periode::STATUS_AKTIF)->first();
            $tahunPel = $activePeriode->tahun_pelajaran ?? '-';
            $semester = $activePeriode->semester ?? '-';
        ?>
        <div class="card-body">
            <div class="mb-3 d-flex justify-content-between align-items-start">
                <div>
                    <h5 class="mb-1">Data Walimurid Peserta Didik</h5>
                    <div class="small text-muted">Tahun Pelajaran: <strong><?php echo e($tahunPel); ?></strong> &nbsp;|&nbsp; Semester: <strong><?php echo e($semester); ?></strong></div>
                </div>
             </div>

            <form method="GET" class="mb-3">
                <div class="row g-2 align-items-end">
                    <div class="col-md-6">
                        <label class="form-label">Pilih Kelas</label>
                        <select name="kelas_id" class="form-select" onchange="this.form.submit()">
                            <option value="">-- Pilih Kelas --</option>
                            <?php $__currentLoopData = $kelasList ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $k): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($k->id); ?>" <?php if(isset($selected) && $selected && $selected->id == $k->id): ?> selected <?php endif; ?>><?php echo e($k->nama); ?></option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                    </div>
                    <div class="col-md-6">
                        <a href="<?php echo e(url('admin/pendukung/walimurid')); ?>" class="btn btn-secondary">Reset</a>
                    </div>
                </div>
            </form>

            <?php if(isset($selected) && $selected): ?>
                <div class="mb-2"><strong>Menampilkan data untuk :</strong> <?php echo e($selected->nama); ?> </div>

                <div class="table-responsive">
                    <table class="table table-striped table-sm table-fixed table-bordered">
                        <thead>
                            <tr>
                                <th>Nama Peserta Didik</th>
                                <th class="small-col">NIS</th>
                                <th class="small-col">NISN</th>
                                <th class="small-col">Tempat Lahir</th>
                                <th class="small-col">Tanggal Lahir</th>
                                <th>Nama Ayah</th>
                                <th class="small-col">Pekerjaan Ayah</th>
                                <th>Nama Ibu</th>
                                <th class="small-col">Pekerjaan Ibu</th>
                                <th>Alamat</th>
                                <th class="phone-col">Nomor HP/WA</th>
                                <th class="small-col">Aksi</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__empty_1 = true; $__currentLoopData = $pesertas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                <tr>
                                    <td><?php echo e($p->nama ?? '-'); ?></td>
                                    <td><?php echo e($p->nis ?? '-'); ?></td>
                                    <td><?php echo e($p->nisn ?? '-'); ?></td>
                                    <td><?php echo e($p->tempat_lahir ?? '-'); ?></td>
                                    <td>
                                        <?php if(!empty($p->tanggal_lahir) && $p->tanggal_lahir instanceof \Illuminate\Support\Carbon): ?> <?php echo e($p->tanggal_lahir->format('Y-m-d')); ?> <?php else: ?> <?php echo e($p->tanggal_lahir ?? '-'); ?> <?php endif; ?>
                                    </td>
                                    <td><?php echo e($p->nama_ayah ?? '-'); ?></td>
                                    <td><?php echo e($p->pekerjaan_ayah ?? '-'); ?></td>
                                    <td><?php echo e($p->nama_ibu ?? '-'); ?></td>
                                    <td><?php echo e($p->pekerjaan_ibu ?? '-'); ?></td>
                                    <td><?php echo e($p->alamat ?? '-'); ?></td>
                                    <td><?php echo e($p->nomor_hp ?? ($p->hp ?? '-')); ?></td>
                                    <td class="small-col">
                                        <a href="<?php echo e(url('admin/pendukung/walimurid/'.$p->id.'/edit')); ?>" class="btn btn-sm btn-primary me-1" title="Edit"><i class="bi bi-pencil"></i></a>
                                        <form action="<?php echo e(url('admin/pendukung/walimurid/'.$p->id)); ?>" method="POST" class="d-inline" onsubmit="return confirm('Hapus data ini?');">
                                            <?php echo csrf_field(); ?>
                                            <?php echo method_field('DELETE'); ?>
                                            <button type="submit" class="btn btn-sm btn-danger" title="Hapus"><i class="bi bi-trash"></i></button>
                                        </form>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                <tr>
                                    <td colspan="12" class="text-center">Tidak ada data peserta untuk kelas ini.</td>
                                </tr>
                            <?php endif; ?>
                        </tbody>
                    </table>
                </div>
            <?php endif; ?>

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

<?php echo $__env->make('admin.layout', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\App\laravel\laravel\resources\views/admin/pendukung/walimurid/index.blade.php ENDPATH**/ ?>