<?= $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 Data SPP Santri</h3>
    </div>
    <div class="col-lg-6 mt-2 ml-2 mb-4">
        <form action="<?= base_url('informasisppsantri/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('informasisppsantri/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('informasisppsantri/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 Diniyah</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>Bulan</label>
                <select class="custom-select" id="inputGroupSelect02" name="bulan">
                    <option selected>Pilih Bulan</option>
                    <option value="1" <?= set_select('bulan', '1'); ?>>Januari</option>
                    <option value="2" <?= set_select('bulan', '2'); ?>>Februari</option>
                    <option value="3" <?= set_select('bulan', '3'); ?>>Maret</option>
                    <option value="4" <?= set_select('bulan', '4'); ?>>April</option>
                    <option value="5" <?= set_select('bulan', '5'); ?>>Mei</option>
                    <option value="6" <?= set_select('bulan', '6'); ?>>Juni</option>
                    <option value="7" <?= set_select('bulan', '7'); ?>>Juli</option>
                    <option value="8" <?= set_select('bulan', '8'); ?>>Agustus</option>
                    <option value="9" <?= set_select('bulan', '9'); ?>>September</option>
                    <option value="10" <?= set_select('bulan', '10'); ?>>Oktober</option>
                    <option value="11" <?= set_select('bulan', '11'); ?>>November</option>
                    <option value="12" <?= set_select('bulan', '12'); ?>>Desember</option>
                </select>
                <?= form_error('bulan', '<div class="text-small text-danger">', '</div>'); ?>
            </div>
            <div class="form-group">
                <label>Tahun</label>
                <input type="text" name="tahun" class="form-control" value="<?= set_value('tahun') ?>" placeholder="Input Tahun">
                <?= form_error('tahun', '<div class="text-small text-danger">', '</div>'); ?>
            </div>
            <div class="form-group">
                <label>Jumlah Pembayaran</label>
                <input type="text" name="jumlah_pembayaran" class="form-control" value="<?= set_value('jumlah_pembayaran') ?>" placeholder="Input Jumlah Pembayaran">
                <?= form_error('jumlah_pembayaran', '<div class="text-small text-danger">', '</div>'); ?>
            </div>
            <div class="form-group">
                <label>Jatuh Tempo</label>
                <input type="text" id="jatuh_tempo" name="jatuh_tempo" class="form-control" value="<?= set_value('jatuh_tempo') ?>" placeholder="Pilih Tanggal Jatuh Tempo">
                <?= form_error('jatuh_tempo', '<div class="text-small text-danger">', '</div>'); ?>
            </div>
            <div class="form-group">
                <label>Keterangan</label>
                <select name="keterangan" class="form-control">
                    <option value="">-- Pilih Keterangan --</option>
                    <option value="Sudah Lunas" <?= set_select('keterangan', 'Sudah Lunas') ?>>Sudah Lunas</option>
                    <option value="Belum Lunas" <?= set_select('keterangan', 'Belum Lunas') ?>>Belum Lunas</option>
                </select>
                <?= form_error('keterangan', '<div class="text-small text-danger">', '</div>'); ?>
            </div>
            <a href="<?= base_url('informasisppsantri') ?>" 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("#jatuh_tempo", {
        dateFormat: "d/m/Y" // yyyy/mm/dd
    });
</script>