<!-- Laporan Arisan Heboh -->
<div class="modal fade" id="laporan_detail" tabindex="-1" role="dialog" aria-labelledby="laporan_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="laporan_detailTitle">
                    Buat Laporan Arisan!
                </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/undian/crud'); ?>
                <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 Nomor Urut Anggota Arisan Heboh</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" value="<?= (($jml_aktif - $blm_bayar) * $data_arisan['tagihan_iuran']) ?>" id="saldo_masuk_sekarang" name="saldo_masuk_sekarang">
                    <input type="number" hidden class="form-control" value="<?= $data_arisan['hg_target'] ?>" id="uang_pemenang" name="uang_pemenang" placeholder="Nama Kelompok Arisan" required>
                    <input type="number" hidden class="form-control" value="<?= $data_arisan['hg_standar'] ?>" id="potongan_admin_awal" name="potongan_admin_awal" placeholder="Nama Kelompok Arisan" required>
                    <input type="number" hidden class="form-control" value="<?= $data_arisan['admin_arisan'] ?>" id="potongan_admin_selanjutnya" name="potongan_admin_selanjutnya" placeholder="Nama Kelompok Arisan" required>
                    <input type="number" class="form-control" onkeyup="nourut()" id="nomor_urut" name="nomor_urut" placeholder="Masukkan Nomor Urut Arisan Heboh" required>
                    <br><input type="text" class="form-control" id="status_anggota" readonly name="status_anggota" placeholder="Status Anggota Arisan">
                </center>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-outline-primary" data-dismiss="modal">
                    Close
                </button>
                <button type="submit" id="simpanLaporanUndian" name="simpanLaporanUndian" 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 nourut() {
        var nomor_urut = $("#nomor_urut").val();
        var jadwal_id = $("#jadwal_id").val();
        var arisan_id = $("#regist_arisan").val();
        $.ajax({
            type: "POST",
            url: '<?= base_url('arisan/data/cek_pemenang') ?>',
            data: {
                'nomor_urut': nomor_urut,
                'jadwal_id': jadwal_id,
                'arisan_id': arisan_id
            },
            success: function(data) {
                var json = data,
                    obj = JSON.parse(json);
                if (obj > 1) {
                    $('#status_anggota').val(obj.stts_anggota);
                } else {
                    $('#status_anggota').val(obj.stts_anggota);
                }
            }
        })
    }
</script>