<div class="modal fade" id="modalDaftarUlang">
    <div class="modal-dialog modal-dialog-centered">
        <div class="modal-content">
            <div class="modal-header bg-success text-white">
                <h5>Form Daftar Ulang</h5>
            </div>

            <div class="modal-body">
                <input type="hidden" id="ppdb_id">

                <label>Keterangan</label>
                <textarea id="keterangan" class="form-control"></textarea>
            </div>

            <div class="modal-footer">
                <button class="btn btn-secondary" data-bs-dismiss="modal">Batal</button>
                <button class="btn btn-success" onclick="saveDaftarUlang()">Simpan</button>
            </div>
        </div>
    </div>
</div>

<script>
function saveDaftarUlang() {
    fetch("<?= site_url('ppdb/daftarulang/save') ?>", {
        method: 'POST',
        headers: {'Content-Type': 'application/x-www-form-urlencoded'},
        body: new URLSearchParams({
            ppdb_id: $('#ppdb_id').val(),
            keterangan: $('#keterangan').val()
        })
    })
    .then(r => r.json())
    .then(r => {
        alert(r.message);
        location.reload();
    });
}
</script>
