<?php require_once '../auth/cek_login.php';
require_role('admin');
include 'header.php';
$tahun = $profil_header['tahun_pelajaran'] ?? '2025/2026';
$kelasList = $conn->query("SELECT DISTINCT kelas FROM siswa WHERE kelas IS NOT NULL AND kelas<>'' ORDER BY kelas");
?>
<h3 class="fw-bold mb-3">Berita Acara Pelaksanaan Ujian</h3>
<form method="get" action="../cetak/berita_acara.php" target="_blank" class="card p-4">
    <div class="row g-3">
        <div class="col-md-4"><label>Hari</label><input name="hari" class="form-control" placeholder="Contoh: Senin" required></div>
        <div class="col-md-4"><label>Tanggal</label><input type="date" name="tanggal" class="form-control" value="<?= date('Y-m-d') ?>" required></div>
        <div class="col-md-4"><label>Waktu</label><input name="waktu" class="form-control" value="08.00 - 10.00 WITA" required></div>
        <div class="col-md-4"><label>Mata Ujian</label><input name="mata_ujian" class="form-control" placeholder="Contoh: Bahasa Indonesia" required></div>
        <div class="col-md-4"><label>Kelas/Ruang</label><select name="kelas" class="form-select"><option value="">Semua Kelas</option><?php while($k=$kelasList->fetch_assoc()): ?><option value="<?= e($k['kelas']) ?>"><?= e($k['kelas']) ?></option><?php endwhile; ?></select></div>
        <div class="col-md-4"><label>Tahun Pelajaran</label><input name="tahun_pelajaran" class="form-control" value="<?= e($tahun) ?>"></div>
        <div class="col-md-4"><label>Jumlah Hadir</label><input type="number" name="hadir" class="form-control" placeholder="Kosongkan untuk otomatis"></div>
        <div class="col-md-4"><label>Jumlah Tidak Hadir</label><input type="number" name="tidak_hadir" class="form-control" value="0"></div>
        <div class="col-md-4"><label>Ruang Ujian</label><input name="ruang" class="form-control" placeholder="Contoh: Ruang 1"></div>
        <div class="col-md-6"><label>Pengawas 1</label><input name="pengawas1" class="form-control"></div>
        <div class="col-md-6"><label>Pengawas 2</label><input name="pengawas2" class="form-control"></div>
        <div class="col-md-12"><label>Catatan/Kejadian</label><textarea name="catatan" class="form-control" rows="3">Pelaksanaan ujian berjalan dengan tertib dan lancar.</textarea></div>
    </div>
    <button class="btn btn-primary mt-3"><i class="fa fa-print"></i> Cetak Berita Acara</button>
</form>
<?php include 'footer.php'; ?>
