<div id="content" class="main-content">
    <div class="layout-px-spacing">
        <div class="row layout-top-spacing">
            <!-- Rincian Kas Arisan -->
            <div class="col-xl-4 col-lg-6 col-md-12 col-sm-12 col-12 layout-spacing">
                <div class="widget widget-account-invoice-three">
                    <div class="widget-heading">
                        <div class="wallet-usr-info">
                            <div class="usr-name">
                                <span> Arisan Heboh <?= $data_arisan['nm_kelompok'] ?><br>
                                    <center><?= $data_arisan['id'] ?></center>
                                </span>
                            </div>
                            <?php
                            if ($data_arisan['status_arisan'] == 'PROSES') : ?>
                                <div class="add">
                                    <button type="button" class="btn btn-primary mb-1 mr-1 btn-rounded" data-toggle="modal" data-target="#tambahAnggota">
                                        <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-plus">
                                            <line x1="12" y1="5" x2="12" y2="19"></line>
                                            <line x1="5" y1="12" x2="19" y2="12"></line>
                                        </svg>
                                    </button>
                                </div>
                            <?php endif;
                            ?>
                        </div>
                        <div class="wallet-balance">
                            <p>Saldo Akhir :
                                <br><small><?= $this->mycustom->hariIndo(date('l', strtotime(date('Y-m-d')))) . ', ' . date('d') . ' ' . $this->mycustom->bulanIndo(date('m', strtotime(date('Y-m-d')))) . ' ' . date('Y') ?></small>
                            </p>
                            <h5 class=""><?= $this->mycustom->nice_number($saldo_kelompok) ?></h5>
                        </div>
                    </div>
                    <div class="widget-amount">
                        <div class="w-a-info funds-received">
                            <span>Target <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-up">
                                    <polyline points="18 15 12 9 6 15"></polyline>
                                </svg></span>
                            <p><?= $this->mycustom->nice_number(($data_arisan['tagihan_iuran'] * $anggota_aktif)) ?></p>
                        </div>

                        <div class="w-a-info funds-spent">
                            <span>Realisasi <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-up">
                                    <polyline points="18 15 12 9 6 15"></polyline>
                                </svg></span>
                            <p><?php
                                if ($realisasi['realisasi_bulan_ini'] == null) :
                                    echo 0;
                                else :
                                    echo $this->mycustom->nice_number($realisasi['realisasi_bulan_ini']);
                                endif;
                                ?>
                            </p>
                        </div>
                    </div>

                    <div class="widget-content">
                        <div class="bills-stats">
                            <?php
                            if ($data_arisan['status_arisan'] == 'PROSES') : ?>
                                <span>PROSES</span>
                            <?php elseif ($data_arisan['status_arisan'] == 'AKTIF') : ?>
                                <span style="background-color: green;">AKTIF</span>
                            <?php elseif ($data_arisan['status_arisan'] == 'VERIFIKASI') : ?>
                                <span>VERIFIKASI</span>
                            <?php else : ?>
                                <span style="background-color: red;"> SELESAI</span>
                            <?php endif;
                            ?>
                        </div>
                        <div class="invoice-list">
                            <div class="inv-detail">
                                <div class="info-detail-1">
                                    <p>Target : </p>
                                    <p><span class="w-currency"></span> <span class="bill-amount"><?= $data_arisan['target_anggota'] ?>
                                            Anggota</span>
                                    </p>
                                </div>
                                <div class="info-detail-1">
                                    <p>Aktif : </p>
                                    <p><span class="w-currency"></span> <span class="bill-amount"><?= $anggota_aktif ?>
                                            Anggota</span>
                                    </p>
                                </div>
                                <div class="info-detail-2">
                                    <p>Menang : </p>
                                    <p><span class="w-currency"></span> <span class="bill-amount"><?= $anggota_menang ?>
                                            Anggota</span>
                                    </p>
                                </div>
                                <div class="info-detail-2">
                                    <p>Mundur : </p>
                                    <p><span class="w-currency"></span> <span class="bill-amount">
                                            <?= $anggota_mundur ?> Anggota</span>
                                    </p>
                                </div>
                                <div class="info-detail-2">
                                    <p>Iuran /Bulan : </p>
                                    <p><span class="w-currency"></span> <span class="bill-amount"><?= $this->mycustom->nice_number($data_arisan['tagihan_iuran']) ?>
                                            X
                                            <?= $data_arisan['tempo'] ?> Bulan</span>
                                    </p>
                                </div>
                            </div>
                            <div class="inv-action">
                                <a href="<?= base_url('arisan/laporan/laporan_heboh/kelompok/' . $this->encrypt->encode($data_arisan['id'])) ?>" class="btn btn-outline-primary view-details">Laporan</a>
                                <a href="<?= base_url('arisan/aktifitas/tagihan/kelompok/' . $this->encrypt->encode($data_arisan['id'])) ?>" class="btn btn-outline-primary pay-now">Tagihan</a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- List Anggota Arisan Heboh -->
            <div class="col-xl-8 col-lg-12 col-md-12 col-sm-12 col-12 layout-spacing">
                <div class="widget widget-table-two">
                    <div class="widget-heading">
                        <h5 class="">Jadwal Undian Arisan</h5>
                    </div>
                    <div class="widget-content widget-content-area">
                        <?= $this->session->flashdata('pesan_berhasil'); ?>
                        <?= $this->session->flashdata('pesan_gagal'); ?>
                        <table id="style-3" class="table style-3  table-hover">
                            <thead>
                                <tr>
                                    <th class="text-center">Undian</th>
                                    <th class="text-center">Tanggal</th>
                                    <th class="text-center">Status</th>
                                    <th class="text-center">Aksi</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php foreach ($jadwal_undian as $Jadwal_undian) : ?>
                                    <tr>
                                        <td>
                                            <center>
                                                <?= $Jadwal_undian->undian_ke ?>
                                            </center>
                                        </td>
                                        <td>
                                            <?= date('d', strtotime($Jadwal_undian->tgl_undian)) ?>
                                            <?= $this->mycustom->bulanIndo(date('m', strtotime($Jadwal_undian->tgl_undian))) ?>
                                            <?= date('Y', strtotime($Jadwal_undian->tgl_undian)) ?>
                                        </td>
                                        <td>
                                            <center>
                                                <?php
                                                if ($Jadwal_undian->status_undian == 'BELUM') : ?>
                                                    <span class="shadow-none badge badge-warning"><?= $Jadwal_undian->status_undian ?></span>
                                                <?php else : ?>
                                                    <span class="shadow-none badge badge-success"><?= $Jadwal_undian->status_undian ?></span>
                                                <?php endif; ?>
                                            </center>
                                        </td>
                                        <td class="text-center">
                                            <?php
                                            if ($Jadwal_undian->status_undian != 'SELESAI') : ?>
                                                <div class="btn-group mr-2">
                                                    <button class="btn btn-primary btn-sm dropdown-toggle" 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">
                                                        <?php if ($Jadwal_undian->status_undian == 'BELUM') : ?>
                                                            <a href="javascript:void(0);" class="dropdown-item" id="detail_jadwal" data-target="#jadwal_detail" class="bs-tooltip" data-toggle="modal" data-kode_regist="<?= $data_arisan['id'] ?>" data-tgl_undian="<?= $Jadwal_undian->tgl_undian ?>" data-undian_ke="<?= $Jadwal_undian->undian_ke ?>" data-status_undian="<?= $Jadwal_undian->status_undian ?>">Jadwal</a>
                                                        <?php endif; ?>
                                                        <a class="dropdown-item" href="<?= base_url('arisan/aktifitas/tagihan/kelompok/' . $this->encrypt->encode($data_arisan['id'] . $Jadwal_undian->id)) ?>">Tagihan</a>
                                                    </div>
                                                </div>
                                            <?php else : ?>
                                                <?php if ($data_arisan['produk_id'] == '21') : ?>
                                                    <a class="btn btn-primary btn-sm" href="<?= base_url('arisan/laporan/laporan_heboh/lap_detail/' . $this->encrypt->encode($Jadwal_undian->regist_arisan . $Jadwal_undian->id)) ?>" style="color: white;">Laporan</a>
                                                <?php else : ?>
                                                    <a class="btn btn-primary btn-sm" href="<?= base_url('arisan/aktifitas/laporan/arisan_motor/detail_laporan/' . $this->encrypt->encode($Jadwal_undian->regist_arisan . $Jadwal_undian->id)) ?>" style="color: white;">Laporan</a>
                                                <?php endif; ?>
                                            <?php endif; ?>
                                        </td>
                                    </tr>
                                <?php endforeach; ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $this->load->view('arisan/aktifitas/jadwal/detail'); ?>