<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">Pengajuan</th>
                            <th class="text-center">Realisasi</th>
                            <th class="text-center">Pinjaman</th>
                            <th class="text-center">Kontrak</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach ($pinjaman as $Data_pinjaman) : ?>
                        <tr>
                            <td class="text-center">
                                <?= $Data_pinjaman->kontrak_id ?> <br>
                                <?php if ($Data_pinjaman->jaminan == 'Y') : ?>
                                <?php foreach ($data_jaminan as $Data_jaminan) :
                                            if ($Data_pinjaman->nomor_kontrak == $Data_jaminan->kontrak_id) :
                                                $bulan = date('m', strtotime($Data_pinjaman->tgl_pengajuan));
                                                $tahun = date('Y', strtotime($Data_pinjaman->tgl_pengajuan));
                                        ?>
                                <?= $Data_jaminan->nm_agungan ?><br>
                                <center>
                                    <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>
                                </center>
                                <?php
                                            endif;
                                        endforeach; ?>
                                <?php else : ?>
                                Tidak Ada Jaminan
                                <?php endif; ?> <br>
                                <a class="btn btn-primary btn-sm"
                                    href="<?= base_url('kabag_marketing/kegiatan/kontrak_pinjaman/' . $this->encrypt->encode($Data_pinjaman->kontrak_id)) ?>"
                                    style="color: white;">Detail</a>
                            </td>
                            <td class="text-left">
                                NIK : <?= $Data_pinjaman->nik ?><br>
                                Nama : <?= $Data_pinjaman->nm_anggota ?><br>
                                TTL : <?= $Data_pinjaman->tempat_lahir ?>,
                                <?= date('d', strtotime($Data_pinjaman->tgl_lahir)) . ' ' . $this->mycustom->bulanIndo(date('m', strtotime($Data_pinjaman->tgl_lahir))) . ' ' .  date('Y', strtotime($Data_pinjaman->tgl_lahir))  ?><br>
                                No HP : <?= $Data_pinjaman->nomor_nasabah ?>
                            </td>
                            <td class="text-left">
                                <?= $Data_pinjaman->alamat_lengkap ?><br>
                                RT. <?= $Data_pinjaman->nm_rt ?> / RW. <?= $Data_pinjaman->nm_rw ?>, Ds.
                                <?= $Data_pinjaman->nm_desa ?><br>
                                Kec. <?= $Data_pinjaman->nm_kecamatan ?>, <?= $Data_pinjaman->kot_kab ?>,<br>
                                <?= $Data_pinjaman->prov ?><br>
                            </td>
                            <td class="text-left">
                                <?= $Data_pinjaman->tgl_pengajuan ?>
                            </td>
                            <td class="text-left">
                                <?= $Data_pinjaman->tgl_realisasi ?>
                            </td>
                            <td class="text-left">
                                Pinjaman : Rp <?= number_format($Data_pinjaman->pokok_pinjaman, 0, ',', '.') ?>,- <br>
                                Tempo :
                                <?php if ($Data_pinjaman->aturan_id == 2) :
                                        echo '8X - Dua Mingguan';
                                    else :
                                        echo '12X - Mingguan';
                                    endif ?>
                                <br>
                                Angsuran : Rp <?= number_format($Data_pinjaman->bsr_angsuran, 0, ',', '.') ?>,- <br>
                                Pengajuan :
                                <?= date('d', strtotime($Data_pinjaman->tgl_pengajuan)) . ' ' . $this->mycustom->bulanIndo(date('m', strtotime($Data_pinjaman->tgl_pengajuan))) . ' ' .  date('Y', strtotime($Data_pinjaman->tgl_pengajuan))  ?>
                            </td>
                            <td class="text-left">
                                Pot. Admin : Rp <?= number_format($Data_pinjaman->bsr_admin, 0, ',', '.') ?>,- <br>
                                Pot. RK : Rp <?= number_format($Data_pinjaman->bsr_rk, 0, ',', '.') ?>,- <br>
                                Simp/Angsuran : Rp <?= number_format($Data_pinjaman->bsr_simpanan, 0, ',', '.') ?>,-
                                <br>
                                Jasa/Angsuran : Rp <?= number_format($Data_pinjaman->bsr_jasa, 0, ',', '.') ?>,- <br>
                            </td>
                        </tr>
                        <?php endforeach; ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>