<div id="content" class="main-content">
    <div class="layout-px-spacing">
        <?= $this->session->flashdata('pesan_berhasil'); ?>
        <?= $this->session->flashdata('pesan_gagal'); ?>
        <div class="row layout-top-spacing">
            <div class="col-lg-12">
                <blockquote class="blockquote media-object">
                    <div class="media">
                        <div class="media-body align-self-center">
                            <p class="d-inline">
                                Daftar Pengajuan Anggota Arisan
                            </p>
                        </div>
                    </div>
                    <small class="text-left"><cite
                            title="Source Title"><?= $this->mycustom->hariIndo(date('l', strtotime(date('Y-m-d')))) ?>,
                            <?= date('d', strtotime(date('Y-m-d')))  ?>
                            <?= $this->mycustom->bulanIndo(date('m', strtotime(date('Y-m-d'))))  ?>
                            <?= date('Y', strtotime(date('Y-m-d')))  ?></cite></small>
                </blockquote>
            </div>
        </div>
        <div class="row layout-spacing">
            <div class="col-lg-12">
                <div class="statbox widget box box-shadow">
                    <div class="widget-content widget-content-area">
                        <table id="style-3" class="table style-3  table-hover">
                            <thead>
                                <tr>
                                    <th class="text-center">No</th>
                                    <th class="text-center">Tanggal Pengajuan</th>
                                    <th class="text-center">Kelompok</th>
                                    <th class="text-center">Identitas</th>
                                    <th class="text-center">Alamat</th>
                                    <th class="text-center">Referral</th>
                                    <th class="text-center">Aksi</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $no = 1; ?>
                                <?php foreach ($pengajuan_anggota as $Pengajuan_anggota) : ?>
                                <tr>
                                    <td>
                                        <center><?= $no ?></center>
                                    </td>
                                    <td class="text-left">
                                        <?= date('d F Y', strtotime($Pengajuan_anggota->tgl_pengajuan)); ?> <br>
                                        <?= date('H:i:s', strtotime($Pengajuan_anggota->tgl_pengajuan)); ?> WIB
                                    </td>
                                    <td class="text-left">
                                        <?php if ($Pengajuan_anggota->produk_id == 21) : ?>
                                        Arisan Heboh Kelompok <?= $Pengajuan_anggota->nm_kelompok ?><br>
                                        <?php else : ?>
                                        Arisan Motor Ke-<?= $Pengajuan_anggota->nm_kelompok ?><br>
                                        <?= $Pengajuan_anggota->ket_arisan ?><br>
                                        <?php endif; ?>
                                        No Registrasi : <?= $Pengajuan_anggota->regist_arisan ?>
                                    </td>
                                    <td class="text-left">
                                        <?= $Pengajuan_anggota->nm_anggota ?><br>
                                        NIK : <?= $Pengajuan_anggota->nik ?><br>
                                        HP : <?= $Pengajuan_anggota->no_hp ?>
                                    </td>
                                    <td class="text-left">
                                        <?= $Pengajuan_anggota->alamat_lengkap ?>, RT. <?= $Pengajuan_anggota->nm_rt ?>
                                        RW. <?= $Pengajuan_anggota->nm_rw ?><br>
                                        Dk. <?= $Pengajuan_anggota->nm_desa ?>, Kec.
                                        <?= $Pengajuan_anggota->nm_kecamatan ?>,<br>
                                        <?= $Pengajuan_anggota->kot_kab ?>, <?= $Pengajuan_anggota->prov ?>
                                    </td>
                                    <td class="text-left">
                                        <?= $Pengajuan_anggota->karyawan ?>
                                    </td>
                                    <td class="text-center">
                                        <div class="btn-group mr-2">
                                            <button class="btn btn-primary btn-sm dropdown-toggle" style="width: 100px;"
                                                type="button" data-toggle="dropdown" aria-haspopup="true"
                                                aria-expanded="false">
                                                Pilih Aksi <svg xmlns="http://www.w3.org/2000/svg" width="24"
                                                    height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor"
                                                    stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
                                                    class="feather feather-chevron-down">
                                                    <polyline points="6 9 12 15 18 9"></polyline>
                                                </svg>
                                            </button>
                                            <div class="dropdown-menu">
                                                <a class="dropdown-item" href="javascript:void(0);"
                                                    id="detail_pengajuan" data-target="#pengajuan_detail"
                                                    class="bs-tooltip" data-toggle="modal" data-placement="top" title=""
                                                    data-original-title="Verifikasi"
                                                    data-kode_regist="<?= $Pengajuan_anggota->pengajuan_id ?>">
                                                    Verifikasi
                                                </a>
                                                <a class="dropdown-item"
                                                    href="<?= base_url('arisan/identitas/anggota/' . $this->encrypt->encode($Pengajuan_anggota->anggota_id)) ?>"
                                                    class="bs-tooltip" data-toggle="tooltip" data-placement="top"
                                                    title="" data-original-title="Profil Anggota">
                                                    Detail
                                                </a>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <?php $no++; ?>
                                <?php endforeach; ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="pengajuan_detail" tabindex="-1" role="dialog" aria-labelledby="pengajuan_detailTitle"
    aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="pengajuan_detailTitle">Verifikasi Anggota</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24"
                        viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
                        stroke-linejoin="round" class="feather feather-x">
                        <line x1="18" y1="6" x2="6" y2="18"></line>
                        <line x1="6" y1="6" x2="18" y2="18"></line>
                    </svg>
                </button>
            </div>
            <div class="modal-body" id="detail_body">
                <?php echo form_open_multipart('arisan/data/pengajuan/verifikasi'); ?>
                <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 pilih tombol terima / tolak untuk memverifikasi data anggota arisan!
                    </p>
                </center>
                <input type="text" hidden class="form-control" id="kode_pengajuan" name="kode_pengajuan" required>
            </div>
            <div class="modal-footer">
                <button class="btn" data-dismiss="modal"><i class="flaticon-cancel-12"></i> Batal</button>
                <button type="submit" id="tolakAnggota" name="tolakAnggota" class="btn btn-danger">Tolak</button>
                <button type="submit" id="terimaAnggota" name="terimaAnggota" class="btn btn-primary">Terima</button>
            </div>
            <?php echo form_close(); ?>
        </div>
    </div>
</div>

<script type="text/javascript">
$(document).on("click", "#detail_pengajuan", function() {
    var kode_pengajuan = $(this).data('kode_regist');
    $(".modal-body#detail_body #kode_pengajuan").val(kode_pengajuan);
})
</script>