<!-- Bayar Tagihan Individu -->
<div class="modal fade" id="bayarTagihanKeluarga" tabindex="-1" role="dialog"
    aria-labelledby="bayarTagihanKeluargaTitle" 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="bayarTagihanKeluargaTitle">
                    Bayar Tagihan Keluarga!
                </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('arisan/aktifitas/tagihan/bayar'); ?>
                <input type="hidden" name="<?= $this->security->get_csrf_token_name(); ?>"
                    value="<?= $this->security->get_csrf_hash(); ?>" style="display: none">
                <center>
                    <p class="modal-text">Silahkan Masukkan NIK / Nomor HP / No Regist Anggota dan Anggota keluarga</p>
                    <input type="number" hidden class="form-control" value="<?= $jadwal_arisan['id'] ?>" id="jadwal_id"
                        name="jadwal_id" placeholder="Nama Kelompok Arisan" required>
                    <input type="number" hidden class="form-control" value="<?= $jadwal_arisan['regist_arisan'] ?>"
                        id="regist_arisan" name="regist_arisan" placeholder="Nama Kelompok Arisan" required>
                    <input type="number" hidden class="form-control" id="id_anggota2" name="id_anggota2"
                        placeholder="Masukkan NIK / Nomor HP / No Regist Anggota">
                    <input type="number" class="form-control" onkeyup="cek_nikkeluarga()" id="nik2" name="nik2"
                        placeholder="Masukkan NIK / Nomor HP / No Regist Anggota" required>
                </center>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-outline-primary" data-dismiss="modal">
                    Close
                </button>
                <button type="submit" id="simpanBayarKeluarga" name="simpanBayarKeluarga"
                    class="btn btn-primary">Konfirmasi</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">
    function cek_nikkeluarga() {
        var nik = $("#nik2").val();
        var jadwal_id = $("#jadwal_id").val();
        var regist_arisan = $("#regist_arisan").val();
        $.ajax({
            type: "POST",
            url: '<?= base_url('arisan/data/cek_arisan') ?>',
            data: {
                nik: nik,
                data_jadwal: jadwal_id,
                regist_arisan: regist_arisan
            },
            success: function(data) {
                var json = data,
                    obj = JSON.parse(json);
                if (obj > 1) {
                    $('#id_anggota2').val();
                } else {
                    $('#id_anggota2').val(obj.id_anggota);
                }
            }
        })
    }
</script>