<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-xl-3 col-lg-12 col-md-12 col-sm-12 col-12 layout-spacing">
                <div class="card component-card_7" style="width: auto;">
                    <div class="card-body">
                        <h4 class="card-text">Tunggakan Iuran</h4>
                        <h2 class="card-text"><?= $jml_tunggakan ?> Anggota</h2>
                    </div>
                </div>
            </div>
            <div class="col-xl-3 col-lg-12 col-md-12 col-sm-12 col-12 layout-spacing">
                <div class="card component-card_7" style="width: auto;">
                    <div class="card-body">
                        <h4 class="card-text">Total Tunggakan</h4>
                        <h2 class="card-text">
                            <?= number_format($jml_tunggakan * $data_arisan['tagihan_iuran'], 0, ',', '.') ?>,-</h2>
                    </div>
                </div>
            </div>
            <div class="col-xl-3 col-lg-12 col-md-12 col-sm-12 col-12 layout-spacing">
                <div class="card component-card_7" style="width: auto;">
                    <div class="card-body">
                        <h4 class="card-text">Total Kas</h4>
                        <h2 class="card-text"><?= number_format($laporan['saldo_akhir'], 0, ',', '.') ?>,-</h2>
                    </div>
                </div>
            </div>
            <div class="col-xl-3 col-lg-12 col-md-12 col-sm-12 col-12 layout-spacing">
                <div class="card component-card_7" style="width: auto;">
                    <div class="card-body">
                        <h4 class="card-text">Pendapatan</h4>
                        <h2 class="card-text">
                            <?= number_format($laporan['administrasi'], 0, ',', '.') ?>,-
                        </h2>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-12">
                <blockquote class="blockquote media-object">
                    <div class="media">
                        <div class="media-body align-self-center">
                            <a class="btn btn-primary btn-sm" style="float: right;"
                                href="<?= base_url('assets/laporan/arisan/heboh/' . $laporan['document']) ?>">Cetak
                                Laporan</a>
                            <!-- Jikas Status Undian TIdak Sama Dengan Proses -->
                            <p class="d-inline">
                                <!-- Jika Kategori menunjukkan 21 -->
                                Kelompok Arisan Heboh Ke-<?= $data_arisan['nm_kelompok'] ?><br>
                                Undian Ke <?= $jadwal_arisan['undian_ke'] ?> -
                                <span class="badge badge-success"> Selesai </span><br>
                                Pemenang : <?= $laporan['regist_undian'] ?> - <?= $laporan['nm_anggota'] ?><br>
                            </p>
                        </div>
                    </div>
                    <center>
                        <?php if ($laporan['status_laporan'] == 'VERIFIED') : ?>
                        <span class="badge badge-success">Verifikasi Laporan Selesai</span>
                        <?php else : ?>
                        <span class="badge badge-primary">Laporan Sedang Verifikasi</span>
                        <?php endif; ?>
                    </center>
                    <small class="text-right">Undian : <cite
                            title="Source Title"><?= $this->mycustom->hariIndo(date('l', strtotime($jadwal_arisan['tgl_undian']))) ?>,
                            <?= date('d', strtotime($jadwal_arisan['tgl_undian']))  ?>
                            <?= $this->mycustom->bulanIndo(date('m', strtotime($jadwal_arisan['tgl_undian'])))  ?>
                            <?= date('Y', strtotime($jadwal_arisan['tgl_undian']))  ?></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">
                        <h4 class="">( <?= $jml_tunggakan ?> ) Tunggakan Anggota</h4>
                        <table id="style-3" class="table style-3  table-hover">
                            <thead>
                                <tr>
                                    <th class="text-center">Undian</th>
                                    <th class="text-center">Identitas</th>
                                    <th class="text-center">No HP</th>
                                    <th class="text-center">Alamat</th>
                                    <th class="text-center">Aksi</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php foreach ($anggota_tunggakan as $Belum_bayar) : ?>
                                <tr>
                                    <td class="text-center">
                                        <?= $Belum_bayar->no_urut ?>
                                    </td>
                                    <td class="text-left">
                                        No Regist : <?= $Belum_bayar->regist_undian ?><br>
                                        NIK : <?= $Belum_bayar->nik ?><br>
                                        Nama : <?= $Belum_bayar->nm_anggota ?>
                                    </td>
                                    <td class="text-center">
                                        <?= $Belum_bayar->no_hp ?>
                                    </td>
                                    <td class="text-left">
                                        <?= $Belum_bayar->alamat_lengkap ?><br>
                                        RT. <?= $Belum_bayar->nm_rt ?> RW. <?= $Belum_bayar->nm_rw ?><br>
                                        Dk. <?= $Belum_bayar->nm_desa ?>, Kec.
                                        <?= $Belum_bayar->nm_kecamatan ?><br>
                                        Kab. Kudus, Kode Pos : <?= $Belum_bayar->kd_pos ?>
                                    </td>
                                    <td class="text-center">
                                        <a class="btn btn-primary btn-sm"
                                            href="<?= base_url('arisan/aktifitas/tagihan_nuggak/bayar/' . $this->encrypt->encode($Belum_bayar->regist_undian . $jadwal_arisan['id'])) ?>"
                                            style="color: white;">Bayar</a>
                                    </td>
                                </tr>
                                <?php endforeach; ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </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">
                        <h4 class="">( <?= $jml_tunggakanbayar ?> ) Anggota Tunggakan Sudah Bayar</h4>
                        <table id="style-4" class="table style-4  table-hover">
                            <thead>
                                <tr>
                                    <th class="text-center">Undian</th>
                                    <th class="text-center">Identitas</th>
                                    <th class="text-center">No HP</th>
                                    <th class="text-center">Alamat</th>
                                    <th class="text-center">Status Bayar</th>
                                    <th class="text-center">Invoice</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php foreach ($tunggakan_bayar as $Sudah_bayar) : ?>
                                <tr>
                                    <td class="text-center">
                                        <?= $Sudah_bayar->no_urut ?>
                                    </td>
                                    <td class="text-left">
                                        No Regist : <?= $Sudah_bayar->regist_undian ?><br>
                                        NIK : <?= $Sudah_bayar->nik ?><br>
                                        Nama : <?= $Sudah_bayar->nm_anggota ?>
                                    </td>
                                    <td class="text-center">
                                        <?= $Sudah_bayar->no_hp ?>
                                    </td>
                                    <td class="text-left">
                                        <?= $Sudah_bayar->alamat_lengkap ?><br>
                                        RT. <?= $Sudah_bayar->nm_rt ?> RW. <?= $Sudah_bayar->nm_rw ?><br>
                                        Dk. <?= $Sudah_bayar->nm_desa ?>, Kec.
                                        <?= $Sudah_bayar->nm_kecamatan ?><br>
                                        Kab. Kudus, Kode Pos : <?= $Sudah_bayar->kd_pos ?>
                                    </td>
                                    <td class="text-center">
                                        <?php
                                            if ($Sudah_bayar->status_nota == 'PROSES_TUNGGAKAN') : ?>
                                        <span class="shadow-none badge badge-primary">VERIFIKASI</span>
                                        <?php else : ?>
                                        <span class="shadow-none badge badge-success">LUNAS</span>
                                        <?php endif;
                                            ?>
                                    </td>
                                    <td class="text-center">
                                        <div class="btn-group mr-2 sm" style="float: right;">
                                            <button class="btn btn-primary btn-sm dropdown-toggle" type="button"
                                                data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                                Invoice <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 ($data_arisan['produk_id'] == 21) : ?>
                                                <a href="<?= base_url('assets/invoice/arisan_heboh/' . date('Y', strtotime($Sudah_bayar->tgl_pembayaran)) . '/' . date('m', strtotime($Sudah_bayar->tgl_pembayaran)) . '/' . $Sudah_bayar->invoice_pdf) ?>"
                                                    class="dropdown-item">Cetak</a>
                                                <?php else : ?>
                                                <a href="<?= base_url('assets/invoice/arisan_motor/' . date('Y', strtotime($Sudah_bayar->tgl_pembayaran)) . '/' . date('m', strtotime($Sudah_bayar->tgl_pembayaran)) . '/' . $Sudah_bayar->invoice_pdf) ?>"
                                                    class="dropdown-item">Cetak</a>
                                                <?php endif; ?>
                                                <a href="<?= base_url('arisan/aktifitas/tagihan/invoice_kirim/' . $this->encrypt->encode($Sudah_bayar->kd_tagihan)) ?>"
                                                    class="dropdown-item">Kirim</a>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                                <?php endforeach; ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>