<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">Nomor</th>
                            <th class="text-center">Identitas</th>
                            <th class="text-center">Alamat</th>
                            <th class="text-center">Pinjaman</th>
                            <th class="text-center">Kontrak</th>
                            <th class="text-center">Jaminan</th>
                            <th class="text-center">Aksi</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($pinjaman_macet as $Data_macet) : ?>
                        <tr>
                            <td class="text-left">
                                <?= $Data_macet->kontrak_id ?><br>
                                <center>
                                    <?php if ($Data_macet->status_kontrak == 'AKTIF') : ?>
                                    <span class="shadow-none badge badge-primary">AKTIF</span>
                                    <?php elseif ($Data_macet->status_kontrak == 'MACET') : ?>
                                    <span class="shadow-none badge badge-danger">MACET</span>
                                    <?php elseif ($Data_macet->status_kontrak == 'LUNAS_LANCAR') : ?>
                                    <span class="shadow-none badge badge-success">LUNAS</span>
                                    <?php elseif ($Data_macet->status_kontrak == 'LUNAS_MACET') : ?>
                                    <span class="shadow-none badge badge-warning">LUNAS</span>
                                    <?php endif; ?>
                                </center>
                            </td>
                            <td class="text-left">
                                NIK : <?= $Data_macet->nik ?><br>
                                Nama : <?= $Data_macet->nm_anggota ?><br>
                                TTL : <?= $Data_macet->tempat_lahir ?>,
                                <?= date('d', strtotime($Data_macet->tgl_lahir)) . ' ' . $this->mycustom->bulanIndo(date('m', strtotime($Data_macet->tgl_lahir))) . ' ' .  date('Y', strtotime($Data_macet->tgl_lahir))  ?><br>
                                No HP : <?= $Data_macet->no_hp ?>
                            </td>
                            <td class="text-left">
                                <?= $Data_macet->alamat_lengkap ?><br>
                                RT. <?= $Data_macet->nm_rt ?> / RW. <?= $Data_macet->nm_rw ?>, Ds.
                                <?= $Data_macet->nm_desa ?><br>
                                Kec. <?= $Data_macet->nm_kecamatan ?>, <?= $Data_macet->kot_kab ?>,<br>
                                <?= $Data_macet->prov ?><br>
                            </td>
                            <td class="text-left">
                                Pinjaman : Rp <?= number_format($Data_macet->pokok_pinjaman, 0, ',', '.') ?>,- <br>
                                Tempo :
                                <?php if ($Data_macet->aturan_id == 2) :
                                        echo '8X - Dua Mingguan';
                                    else :
                                        echo '12X - Mingguan';
                                    endif ?>
                                <br>
                                Angsuran : Rp <?= number_format($Data_macet->bsr_angsuran, 0, ',', '.') ?>,- <br>
                                Pengajuan :
                                <?= date('d', strtotime($Data_macet->tgl_pengajuan)) . ' ' . $this->mycustom->bulanIndo(date('m', strtotime($Data_macet->tgl_pengajuan))) . ' ' .  date('Y', strtotime($Data_macet->tgl_pengajuan))  ?>
                            </td>
                            <td class="text-left">
                                Pot. Admin : Rp <?= number_format($Data_macet->bsr_admin, 0, ',', '.') ?>,- <br>
                                Pot. RK : Rp <?= number_format($Data_macet->bsr_rk, 0, ',', '.') ?>,- <br>
                                Simp/Angsuran : Rp <?= number_format($Data_macet->bsr_simpanan, 0, ',', '.') ?>,-
                                <br>
                                Jasa/Angsuran : Rp <?= number_format($Data_macet->bsr_jasa, 0, ',', '.') ?>,- <br>
                            </td>
                            <?php if ($Data_macet->jaminan == 'Y') : ?>
                            <td class="text-left">
                                <?php foreach ($data_jaminan as $Data_jaminan) :
                                            if ($Data_macet->nomor_kontrak == $Data_jaminan->kontrak_id) :
                                                $bulan = date('m', strtotime($Data_macet->tgl_pengajuan));
                                                $tahun = date('Y', strtotime($Data_macet->tgl_pengajuan));
                                        ?>
                                <?= $Data_jaminan->nm_agungan ?><br>
                                <a href="<?= base_url('assets/foto_jaminan/' . $tahun . '/' . $bulan . '/' . $Data_jaminan->foto_1) ?>"
                                    target="_blank">Gambar 01</a><br>
                                <a href="<?= base_url('assets/foto_jaminan/' . $tahun . '/' . $bulan . '/' . $Data_jaminan->foto_2) ?>"
                                    target="_blank">Gambar 02</a><br>
                                <a href="<?= base_url('assets/foto_jaminan/' . $tahun . '/' . $bulan . '/' . $Data_jaminan->foto_3) ?>"
                                    target="_blank">Gambar 03</a><br>
                                <a href="<?= base_url('assets/foto_jaminan/' . $tahun . '/' . $bulan . '/' . $Data_jaminan->foto_4) ?>"
                                    target="_blank">Gambar 04</a>
                                <?php
                                            endif;
                                        endforeach; ?>
                            </td>
                            <?php else : ?>
                            <td class="text-center">
                                Tidak Ada Jaminan
                            </td>
                            <?php endif; ?>
                            <td class="text-center">
                                <a class="btn btn-primary btn-sm"
                                    href="<?= base_url('marketing/kegiatan/kontrak_pinjaman/' . $this->encrypt->encode($Data_macet->kontrak_id)) ?>"
                                    style="color: white;">Detail</a>
                            </td>
                        </tr>
                        <?php endforeach; ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>