<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-4" class="table style-4  table-hover">
                    <thead>
                        <tr>
                            <th class="text-center">No</th>
                            <th class="text-center">Identitas</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 $a = 1; ?>
                        <?php foreach ($data_pinjaman_lunas as $Data_aktif) : ?>
                            <tr>
                                <td class="text-center">
                                    <?= $a; ?>
                                </td>
                                <td class="text-left">
                                    <?= $Data_aktif->nm_panggilan ?><br>
                                    <?= $Data_aktif->email ?><br>
                                    <?= $Data_aktif->no_hp ?>
                                </td>
                                <td class="text-left">
                                    Pinjaman : Rp <?= number_format($Data_aktif->pokok_pinjaman, 0, ',', '.') ?>,- <br>
                                    Tempo : <?= $Data_aktif->tempo_pinjaman ?> Bulan
                                    <br>
                                    Angsuran : Rp <?= number_format($Data_aktif->bsr_angsuran, 0, ',', '.') ?>,- <br>
                                </td>
                                <td class="text-left">
                                    Pot. Admin : Rp <?= number_format($Data_aktif->bsr_admin, 0, ',', '.') ?>,- <br>
                                    Pot. RK : Rp <?= number_format($Data_aktif->bsr_rk, 0, ',', '.') ?>,- <br>
                                    Jasa/Angsuran : Rp <?= number_format($Data_aktif->bsr_jasa, 0, ',', '.') ?>,- <br>
                                </td>
                                <?php if ($Data_aktif->jaminan == 'Y') : ?>
                                    <td class="text-left">
                                        <?php foreach ($data_jaminan as $Data_jaminan) :
                                            if ($Data_aktif->nomor_kontrak == $Data_jaminan->kontrak_id) :
                                                $bulan = date('m', strtotime($Data_aktif->tgl_pengajuan));
                                                $tahun = date('Y', strtotime($Data_aktif->tgl_pengajuan)); ?>
                                                <?= $Data_jaminan->nm_agungan ?><br>
                                                <?php if ($Data_jaminan->foto_1 != null) : ?>
                                                    <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>
                                                    </center>
                                                <?php else : ?>
                                                    <center>Belum Upload Gambar</center>
                                                <?php endif; ?>
                                        <?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('keuangan/sistem/kontrak_pinjaman/' . $this->encrypt->encode($Data_aktif->kontrak_id)) ?>"
                                        style="color: white;">Detail</a>
                                </td>
                            </tr>
                            <?php $a++; ?>
                        <?php endforeach; ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>