<div class="modal fade" id="konten_detail" tabindex="-1" role="dialog" aria-labelledby="konten_detailTitle"
    aria-hidden="true">
    <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="konten_detailTitle">
                    Detail Nota
                </h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body" id="detail_body_nota">
                <?php echo form_open_multipart('owner/database/koperasi/kontrak/crud'); ?>
                <input type="hidden" name="<?= $this->security->get_csrf_token_name(); ?>"
                    value="<?= $this->security->get_csrf_hash(); ?>" style="display: none">
                <div class="form-group">
                    <label>Kontrak ID</label>
                    <input type="number" class="form-control" id="kontrak_id" name="kontrak_id"
                        placeholder="Masukkan Nama Desa" required readonly>
                </div>
                <div class="form-group">
                    <label>Aturan ID</label>
                    <input type="number" class="form-control" id="aturan_id" name="aturan_id"
                        placeholder="Masukkan Qty Pembayaran" required>
                    <small>* 1 = Pinjaman Mingguan; 2 = Pinjaman Dua Mingguan; 3 = Pinjaman Bulanan; 4 = Pinjaman
                        Musiman; 5 = Pinjaman Bulanan Anggota; 6 = Pinjaman Karyawan</small>
                </div>
                <div class="form-group">
                    <label>Pokok Pinjaman</label>
                    <input type="number" class="form-control" id="pokok_pinjaman" name="pokok_pinjaman"
                        placeholder="Masukkan Total Pembayaran" required>
                </div>
                <div class="form-group">
                    <label>Besar Admin</label>
                    <input type="number" class="form-control" id="bsr_admin" name="bsr_admin"
                        placeholder="Masukkan Total Pembayaran" required>
                </div>
                <div class="form-group">
                    <label>Besar Resiko Kredit</label>
                    <input type="number" class="form-control" id="bsr_rk" name="bsr_rk"
                        placeholder="Masukkan Total Pembayaran" required>
                </div>
                <div class="form-group">
                    <label>Besar Pokok Angsuran</label>
                    <input type="number" class="form-control" id="bsr_pokok" name="bsr_pokok"
                        placeholder="Masukkan Total Pembayaran" required>
                </div>
                <div class="form-group">
                    <label>Besar Simpanan Angsuran</label>
                    <input type="number" class="form-control" id="bsr_simpanan" name="bsr_simpanan"
                        placeholder="Masukkan Total Pembayaran" required>
                </div>
                <div class="form-group">
                    <label>Besar Jasa Angsuran</label>
                    <input type="number" class="form-control" id="bsr_jasa" name="bsr_jasa"
                        placeholder="Masukkan Total Pembayaran" required>
                </div>
                <div class="form-group">
                    <label>Besar Harus Dibayar / Angsuran</label>
                    <input type="number" class="form-control" id="bsr_angsuran" name="bsr_angsuran"
                        placeholder="Masukkan Total Pembayaran" required>
                </div>
                <div class="form-group">
                    <label>Tempo Pinjaman / Berapa Kali Angsuran</label>
                    <input type="number" class="form-control" id="tempo_pinjaman" name="tempo_pinjaman"
                        placeholder="Masukkan Total Pembayaran" required>
                </div>
                <div class="form-group">
                    <label>Besar Angsuran * Tempo Pinjaman</label>
                    <input type="number" class="form-control" id="ttl_bayar" name="ttl_bayar"
                        placeholder="Masukkan Total Pembayaran" required>
                </div>
                <div class="form-group">
                    <label>Pakai Jaminan?</label>
                    <select class="form-control" id="jaminan" name="jaminan" required>
                        <option value="Y">Y</option>
                        <option value="N">N</option>
                    </select>
                </div>
                <div class="form-group">
                    <label>Status Kontrak</label>
                    <select class="form-control" id="status_kontrak" name="status_kontrak" required>
                        <option value="KONFIRMASI">KONFIRMASI</option>
                        <option value="TERIMA">TERIMA</option>
                        <option value="TOLAK">TOLAK</option>
                        <option value="REALISASI">REALISASI</option>
                        <option value="AKTIF">AKTIF</option>
                        <option value="LUNAS_LANCAR">LUNAS_LANCAR</option>
                        <option value="MACET">MACET</option>
                        <option value="LUNAS_MACET">LUNAS_MACET</option>
                        <option value="PROSES">PROSES</option>
                        <option value="KASIR">KASIR</option>
                        <option value="SURVEY">SURVEY</option>
                    </select>
                </div>
                <div class="form-group">
                    <label>Petugas Koperasi</label>
                    <select class="form-control" id="login_id" name="login_id" required>
                        <?php foreach ($data_petugas as $Data_petugas) : ?>
                        <option value="<?= $Data_petugas->id ?>"><?= $Data_petugas->nm_panggilan ?></option>
                        <?php endforeach; ?>
                    </select>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-outline-primary" data-dismiss="modal">
                    Close
                </button>
                <button type="submit" id="deleteDatabaseTerbaru" name="deleteDatabaseTerbaru"
                    class="btn btn-danger">Hapus</button>
                <button type="submit" id="updateDatabaseTerbaru" name="updateDatabaseTerbaru"
                    class="btn btn-warning">Update</button>
            </div>
            <?php echo form_close(); ?>
        </div>
    </div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).on("click", "#detail_konten", function() {
    var kontrak_id = $(this).data('kontrak_id');
    var anggota_id = $(this).data('anggota_id');
    var aturan_id = $(this).data('aturan_id');
    var pokok_pinjaman = $(this).data('pokok_pinjaman');
    var bsr_admin = $(this).data('bsr_admin');
    var bsr_rk = $(this).data('bsr_rk');
    var bsr_pokok = $(this).data('bsr_pokok');
    var bsr_simpanan = $(this).data('bsr_simpanan');
    var bsr_jasa = $(this).data('bsr_jasa');
    var bsr_angsuran = $(this).data('bsr_angsuran');
    var tempo_pinjaman = $(this).data('tempo_pinjaman');
    var ttl_bayar = $(this).data('ttl_bayar');
    var jaminan = $(this).data('jaminan');
    var status_kontrak = $(this).data('status_kontrak');
    var login_id = $(this).data('login_id');
    $(".modal-body#detail_body_nota #kontrak_id").val(kontrak_id);
    $(".modal-body#detail_body_nota #anggota_id").val(anggota_id);
    $(".modal-body#detail_body_nota #aturan_id").val(aturan_id);
    $(".modal-body#detail_body_nota #pokok_pinjaman").val(pokok_pinjaman);
    $(".modal-body#detail_body_nota #bsr_admin").val(bsr_admin);
    $(".modal-body#detail_body_nota #bsr_rk").val(bsr_rk);
    $(".modal-body#detail_body_nota #bsr_pokok").val(bsr_pokok);
    $(".modal-body#detail_body_nota #bsr_simpanan").val(bsr_simpanan);
    $(".modal-body#detail_body_nota #bsr_jasa").val(bsr_jasa);
    $(".modal-body#detail_body_nota #bsr_angsuran").val(bsr_angsuran);
    $(".modal-body#detail_body_nota #tempo_pinjaman").val(tempo_pinjaman);
    $(".modal-body#detail_body_nota #ttl_bayar").val(ttl_bayar);
    $(".modal-body#detail_body_nota #jaminan").val(jaminan);
    $(".modal-body#detail_body_nota #status_kontrak").val(status_kontrak);
    $(".modal-body#detail_body_nota #login_id").val(login_id);
})
</script>