<div class="modal fade" id="kontrak_detail" tabindex="-1" role="dialog" aria-labelledby="kontrak_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="kontrak_detailTitle">
                    Detail Pinjaman
                </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_kontrak">
                <?php echo form_open_multipart('marketing/kegiatan/pengajuan_pinjaman/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>Nomor Kontrak Pinjaman</label>
                    <input type="number" class="form-control" id="kontrak_id" readonly name="kontrak_id"
                        placeholder="Nomor Induk Kependudukan ( NIK )" required>
                    <input type="text" class="form-control" hidden id="login_id" name="login_id"
                        value="<?= $data_id_login ?>" placeholder="Nomor Induk Kependudukan ( NIK )" required>
                    <input type="text" class="form-control" hidden id="anggota_id" name="anggota_id"
                        placeholder="Anggota ID" required>
                </div>
                <div class="form-group">
                    <select class="form-control" id="produk_id" name="produk_id" required>
                        <?php foreach ($jenis_pinjaman as $Jenis_pinjaman) : ?>
                            <option value="<?= $Jenis_pinjaman->id ?>"><?= $Jenis_pinjaman->nm_produk ?></option>
                        <?php endforeach; ?>
                    </select>
                </div>
                <div class="form-group">
                    <label>Pokok Pinjaman</label>
                    <input type="text" class="form-control" id="pokok_pinjaman" name="pokok_pinjaman"
                        placeholder="Masukkan Jumlah Pinjaman" required>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-outline-primary" data-dismiss="modal">
                    Close
                </button>
                <button type="submit" id="ubahDetailPinjaman" name="ubahDetailPinjaman"
                    class="btn btn-primary">Simpan</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_kontrak", function() {
        var anggota_id = $(this).data('anggota_id');
        var kontrak_id = $(this).data('kontrak_id');
        var pokok_pinjaman = $(this).data('pokok_pinjaman');
        var produk_id = $(this).data('produk_id');
        $(".modal-body#detail_body_kontrak #anggota_id").val(anggota_id);
        $(".modal-body#detail_body_kontrak #kontrak_id").val(kontrak_id);
        $(".modal-body#detail_body_kontrak #pokok_pinjaman").val(pokok_pinjaman);
        $(".modal-body#detail_body_kontrak #produk_id").val(produk_id);
    })
</script>