<?= $this->extend('layout/default') ?>

<?= $this->section('content') ?>
<div class="container pt-100 pb-100">
    <div class="row justify-content-center">
        <div class="col-lg-8">
            <div class="card shadow border-0" style="border-radius: 20px;">
                <div class="card-header bg-primary text-white py-3" style="border-radius: 20px 20px 0 0;">
                    <h5 class="mb-0 fw-bold text-white"><i class="fa fa-user-edit me-2"></i> Edit Data Siswa</h5>
                </div>
                <div class="card-body p-4">
                    <form action="<?= base_url('admin/kelulusan/update_siswa') ?>" method="post">
                        <?= csrf_field() ?>
                        <input type="hidden" name="id_lulus" value="<?= $s['id_lulus'] ?>">
                        
                        <div class="row mb-3">
                            <div class="col-md-6">
                                <label class="fw-bold mb-1">NISN</label>
                                <input type="text" name="nisn" class="form-control" value="<?= $s['nisn'] ?>" required>
                            </div>
                            <div class="col-md-6">
                                <label class="fw-bold mb-1">NIS (Nomor Induk Siswa)</label>
                                <input type="text" name="nis" class="form-control" value="<?= $s['nis'] ?>" required>
                            </div>
                        </div>

                        <div class="mb-3">
                            <label class="fw-bold mb-1">Nama Siswa</label>
                            <input type="text" name="nama_siswa" class="form-control" value="<?= $s['nama_siswa'] ?>" required>
                        </div>

                        <div class="row mb-3">
                            <div class="col-md-6">
                                <label class="fw-bold mb-1">Tempat Lahir</label>
                                <input type="text" name="tempat_lahir" class="form-control" value="<?= $s['tempat_lahir'] ?>" required>
                            </div>
                            <div class="col-md-6">
                                <label class="fw-bold mb-1 text-danger">Tanggal Lahir (Verifikasi)</label>
                                <input type="date" name="tanggal_lahir" class="form-control" value="<?= $s['tanggal_lahir'] ?>" required>
                            </div>
                        </div>

                        <div class="row mb-3">
                            <div class="col-md-6">
                                <label class="fw-bold mb-1 text-danger">Nama Ibu Kandung / Orang Tua</label>
                                <input type="text" name="nama_ibu" class="form-control" value="<?= $s['nama_ibu'] ?>" required placeholder="Sesuai Buku Induk">
                            </div>
                            <div class="col-md-6">
                                <label class="fw-bold mb-1">Status Kelulusan</label>
                                <select name="status" class="form-control">
                                    <option value="LULUS" <?= $s['status']=='LULUS'?'selected':'' ?>>LULUS</option>
                                    <option value="TIDAK LULUS" <?= $s['status']=='TIDAK LULUS'?'selected':'' ?>>TIDAK LULUS</option>
                                </select>
                            </div>
                        </div>

                        <div class="row mb-3">
                            <div class="col-md-8">
                                <label class="fw-bold mb-1">Peminatan / Jurusan</label>
                                <input type="text" name="jurusan" class="form-control" value="<?= $s['jurusan'] ?>" required>
                            </div>
                            <div class="col-md-4">
                                <label class="fw-bold mb-1 text-primary">Rata-Rata Nilai</label>
                                <input type="text" name="rata_rata_nilai" class="form-control" value="<?= $s['rata_rata_nilai'] ?>" required placeholder="Contoh: 85.50">
                            </div>
                        </div>

                        <div class="mb-4">
                            <label class="fw-bold mb-1">Keterangan Tambahan</label>
                            <textarea name="keterangan" class="form-control" rows="2"><?= $s['keterangan'] ?></textarea>
                            <small class="text-muted">Muncul sebagai pesan di halaman cek kelulusan siswa.</small>
                        </div>

                        <div class="d-flex justify-content-between align-items-center">
                            <a href="<?= base_url('admin/kelulusan') ?>" class="btn btn-light px-4 rounded-pill border">Batal</a>
                            <button type="submit" class="btn btn-primary px-5 rounded-pill fw-bold shadow">SIMPAN PERUBAHAN</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<?= $this->endSection() ?>