<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">No</th>
                            <th class="text-center">Identitas</th>
                            <th class="text-center">Realisasi</th>
                            <th class="text-center">Pinjaman</th>
                            <th class="text-center">Skor Nilai</th>
                            <th class="text-center">Aksi</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $no = 1; ?>
                        <?php foreach ($marketing as $Marketing) : ?>
                            <tr>
                                <td class="text-left">
                                    <?= $no ?>
                                </td>
                                <td class="text-left">
                                    Nama : <?= $Marketing->nm_panggilan ?><br>
                                    Email : <?= $Marketing->email ?><br>
                                    No HP : <?= $Marketing->no_hp ?>
                                </td>
                                <td class="text-left">
                                    <!-- Realisasi Sesuai Tanggal Hari Ini -->
                                    <?= date('d', strtotime(date('Y-m-d')))  ?>
                                    <?= $this->mycustom->bulanIndo(date('m', strtotime(date('Y-m-d'))))  ?>
                                    <?= date('Y', strtotime(date('Y-m-d')))  ?> :
                                    <?php foreach ($rtgl as $Rtgl) :
                                        if ($Marketing->kode_login == $Rtgl->marketing) :
                                            echo $Rtgl->jml_realisasi;
                                        endif;
                                    endforeach; ?>
                                    Kontrak<br>
                                    <!-- Realisasi Sesuai Bulan Ini -->
                                    <?= $this->mycustom->bulanIndo(date('m', strtotime(date('Y-m-d'))))  ?>
                                    <!-- Realisasi Sesuai Bulan Ini -->
                                    <?= date('Y', strtotime(date('Y-m-d')))  ?> :
                                    <?php foreach ($rbln as $Rbln) :
                                        if ($Marketing->kode_login == $Rbln->marketing) :
                                            echo $Rbln->jml_realisasi;
                                        endif;
                                    endforeach; ?>
                                    Kontrak<br>
                                    <!-- Realisasi Sesuai Tahun Ini -->
                                    <?= date('Y', strtotime(date('Y-m-d')))  ?> :
                                    <?php foreach ($rthn as $Rthn) :
                                        if ($Marketing->kode_login == $Rthn->marketing) :
                                            echo $Rthn->jml_realisasi;
                                        endif;
                                    endforeach; ?>
                                    Kontrak<br>
                                    <!-- Realisasi Keseluruhan -->
                                    Keseluruhan :
                                    <?php foreach ($rall as $Rall) :
                                        if ($Marketing->kode_login == $Rall->marketing) :
                                            echo $Rall->jml_realisasi;
                                        endif;
                                    endforeach; ?>
                                    Kontrak<br>
                                </td>
                                <td class="text-left">
                                    <!-- Pinjaman Aktif -->
                                    Aktif : <?php foreach ($aktif as $Aktif) :
                                                if ($Marketing->kode_login == $Aktif->marketing) :
                                                    echo $Aktif->jml_aktif;
                                                endif;
                                            endforeach; ?> Kontrak <br>
                                    <!-- Pinjaman Macet -->
                                    Macet : <?php foreach ($macet as $Macet) :
                                                if ($Marketing->kode_login == $Macet->marketing) :
                                                    echo $Macet->jml_macet;
                                                endif;
                                            endforeach; ?> Kontrak <br>
                                    <!-- Pinjaman Lunas -->
                                    Lunas : <?php foreach ($lunas as $Lunas) :
                                                if ($Marketing->kode_login == $Lunas->marketing) :
                                                    echo $Lunas->jml_lunas;
                                                endif;
                                            endforeach; ?> Kontrak
                                </td>
                                <td class="text-center">
                                    <?php
                                    foreach ($nilai_kpi as $Kpi) :
                                        if ($Kpi->login_id == $Marketing->kode_login) :
                                            echo $Kpi->nilai_angka . ' <br> ( ' . $Kpi->nilai_huruf . ' )';
                                        endif;
                                    endforeach;
                                    ?>
                                </td>
                                <td class="text-center">
                                    <a class="btn btn-primary btn-sm"
                                        href="<?= base_url('owner/pinjaman_koperasi/marketing/' . $this->encrypt->encode($Marketing->kode_login)) ?>"
                                        style="color: white;">Detail</a>
                                </td>
                            </tr>
                            <?php $no++; ?>
                        <?php endforeach; ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>