<div class="modal fade" id="tambahAnggotaMotor" tabindex="-1" role="dialog" aria-labelledby="tambahAnggotaMotorTitle" 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="tambahAnggotaMotorTitle">
                    Tambah Pinjaman Karyawan
                </h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                <?php echo form_open_multipart('keuangan/sistem/pinjaman_karyawan/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 for="login_id">Silahkan Pilih Kelompok Arisan</label>
                    <select class="form-control" id="login_id" name="login_id" required>
                        <?php foreach ($data_karyawan as $Data_karyawan) : ?>
                            <option value="<?= $Data_karyawan->id ?>"><?= $Data_karyawan->nm_panggilan ?>
                            </option>
                        <?php endforeach; ?>
                    </select>
                </div>
                <div class="form-group">
                    <label>Pokok Pinjaman</label>
                    <input type="number" class="form-control" id="pokok_pinjaman" name="pokok_pinjaman"
                        placeholder="Masukkan Jumlah Pinjaman" required>
                </div>
                <div class="form-group" id="select_lama_pinjaman">
                    <label>Lama Pinjaman</label>
                    <input type="number" class="form-control" id="lama_pinjaman" name="lama_pinjaman"
                        placeholder="Masukkan Total Lama Pinjaman">
                    <small>* Dalam hitungan bulan</small>
                </div>
                <div class="form-group">
                    <label>Tanggal Pencairan</label>
                    <input type="date" value="<?= date('Y-m-d') ?>" class="form-control" id="tgl_realisasi" name="tgl_realisasi"
                        placeholder="Masukkan Tanggal Pencairan Dana" required>
                </div>
                <div class="form-group">
                    <label for="">Pakai Jaminan</label>
                    <select class="form-control" id="pakai_jaminan" onchange="showDiv2(this)" name="pakai_jaminan"
                        required>
                        <option value="Y">Ya</option>
                        <option value="N">Tidak</option>
                    </select>
                </div>
                <div class="form-group" id="select_pakai_jaminan">
                    <label>Masukkan Nama Jaminan</label>
                    <input type="text" class="form-control" id="tambah_pakai_jaminan" name="tambah_pakai_jaminan"
                        placeholder="Masukkan Nama Jaminan">
                </div>
                <div class="form-group" id="select_gambar_1">
                    <label>Gambar 1</label>
                    <input type="file" class="form-control" id="gambar_1" name="gambar_1" placeholder="Gambar 1">
                </div>
                <div class="form-group" id="select_gambar_2">
                    <label>Gambar 2</label>
                    <input type="file" class="form-control" id="gambar_2" name="gambar_2" placeholder="Gambar 2">
                </div>
                <div class="form-group" id="select_gambar_3">
                    <label>Gambar 3</label>
                    <input type="file" class="form-control" id="gambar_3" name="gambar_3" placeholder="Gambar 3">
                </div>
                <div class="form-group" id="select_gambar_4">
                    <label>Gambar 4</label>
                    <input type="file" class="form-control" id="gambar_4" name="gambar_4" placeholder="Gambar 4">
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-outline-primary" data-dismiss="modal">
                    Close
                </button>
                <button type="submit" id="simpanPinjamanAktif" name="simpanPinjamanAktif" class="btn btn-primary">Tambah</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>
    function showDiv2(select) {
        if (select.value == 'Y') {
            $("#select_pakai_jaminan").show();
            $("#select_gambar_1").show();
            $("#select_gambar_2").show();
            $("#select_gambar_3").show();
            $("#select_gambar_4").show();
        }
        if (select.value == 'N') {
            $("#select_pakai_jaminan").hide();
            $("#select_gambar_1").hide();
            $("#select_gambar_2").hide();
            $("#select_gambar_3").hide();
            $("#select_gambar_4").hide();
        }
    }
</script>