<?= $this->session->flashdata('pesan'); ?>
<div class="card">
    <div class="card-header d-flex justify-content-between align-items-center w-100">
        <h3 class="card-title mb-1" style="margin-top: 5px;">Halaman Tambah Prestasi Santri</h3>
    </div>
    <div class="col-lg-6 mt-2 ml-2 mb-4">
        <form action="<?= base_url('prestasisantri/tambah_aksi') ?>" method="POST">
            <input type="hidden" id="id_santri" name="id_santri">
            <div class="form-group">
                <label>NIS</label>
                <input type="text" id="NIS" name="NIS" class="form-control" data-url="<?= base_url('prestasisantri/get_nis_autocomplete') ?>" value="<?= set_value('NIS') ?>" placeholder="Input NIS">
                <?= form_error('NIS', '<div class="text-small text-danger">', '</div>'); ?>
            </div>
            <div class="form-group">
                <label>Nama Santri</label>
                <input type="text" id="nama_santri" name="nama_santri" class="form-control" data-url="<?= base_url('prestasisantri/get_nis_autocomplete') ?>" value="<?= set_value('nama_santri') ?>" placeholder="Input Nama Santri" readonly>
                <?= form_error('nama_santri', '<div class="text-small text-danger">', '</div>'); ?>
            </div>
            <div class="form-group">
                <label>Kelas Diniah</label>
                <!-- Tampilkan ke user (teks kelas, misal: "Al-Wadhih Banat") -->
                <input type="text" id="kelas_diniyah_display" class="form-control" value="<?= set_value('kelas_diniyah_display') ?>" placeholder="Kelas Diniyah" readonly>
                <!-- Disimpan ke database (berupa angka: 1, 2, 3, dst) -->
                <input type="hidden" name="kelas_diniyah" id="kelas_diniyah" value="<?= set_value('kelas_diniyah') ?>">
                <?= form_error('kelas_diniyah', '<div class="text-small text-danger">', '</div>'); ?>
            </div>
            <div class="form-group">
                <label>Prestasi</label>
                <input type="text" name="prestasi" class="form-control" value="<?= set_value('prestasi'); ?>" placeholder="Input Prestasi">
                <?= form_error('prestasi', '<div class="text-small text-danger">', '</div>'); ?>
            </div>
            <div class="form-group">
                <label>Perlombaan</label>
                <input type="text" name="perlombaan" class="form-control" value="<?= set_value('perlombaan'); ?>" placeholder="Input Perlombaan">
                <?= form_error('perlombaan', '<div class="text-small text-danger">', '</div>'); ?>
            </div>
            <div class="form-group">
                <label>Agenda</label>
                <input type="text" name="agenda" class="form-control" value="<?= set_value('agenda'); ?>" placeholder="Input Agenda">
                <?= form_error('agenda', '<div class="text-small text-danger">', '</div>'); ?>
            </div>
            <div class="form-group">
                <label>Tanggal</label>
                <input type="text" id="tanggal" name="tanggal" class="form-control"
                    value="<?= set_value('tanggal'); ?>" placeholder="dd/mm/yyyy">
                <?= form_error('tanggal', '<div class="text-small text-danger">', '</div>'); ?>
            </div>
            <div class="form-group">
                <label>Bukti Prestasi</label>
                <input type="text" name="bukti_prestasi" class="form-control" value="<?= set_value('bukti_prestasi'); ?>" placeholder="Input Link Drive Bukti Prestasi">
            </div>
            <a href="<?= base_url('prestasisantri') ?>" class="btn btn-danger btn-sm">
                <i class="fas fa-solid fa-angle-left"></i> Kembali
            </a>
            <button type="submit" class="btn btn-primary btn-sm"><i class="fas fa-save"></i> Simpan </button>
        </form>
    </div>
</div>

<script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
<script>
    flatpickr("#tanggal", {
        dateFormat: "d/m/Y" // Menampilkan dalam format dd/mm/yyyy
    });
</script>