<?php
$transaksimodel = new \App\Models\Transaksimodel();
$jumlah_transaksi_pending = $transaksimodel->where("flag_validasi","1")->selectCount("id_transaksi","jumlah_pending")->countAllResults();
?>

<li class="nav-item">
    <a href="#" class="nav-link">
        <i class="nav-icon bi bi-wrench"></i>
        <p>Setup <i class="nav-arrow bi bi-chevron-right"></i></p>
    </a>
    <ul class="nav nav-treeview">
        <li class="nav-item">
            <a href="<?=base_url()?>jenis_kk" class="nav-link">
                <i class="nav-icon bi bi-file-ruled"></i>
                <p>Jenis KK</p>
            </a>
        </li>
        <li class="nav-item">
            <a href="<?=base_url()?>jalan" class="nav-link">
                <i class="nav-icon bi bi-file-ruled"></i>
                <p>Jalan dan Blok</p>
            </a>
        </li>
        <li class="nav-item">
            <a href="<?=base_url()?>grup_transaksi" class="nav-link">
                <i class="nav-icon bi bi-file-ruled"></i>
                <p>Grup Transaksi</p>
            </a>
        </li>
        <li class="nav-item">
            <a href="<?=base_url()?>jenis_pembayaran" class="nav-link">
                <i class="nav-icon bi bi-file-ruled"></i>
                <p>Jenis Pembayaran</p>
            </a>
        </li>
        <li class="nav-item">
            <a href="<?=base_url()?>iuran" class="nav-link">
                <i class="nav-icon bi bi-file-ruled"></i>
                <p>Iuran</p>
            </a>
        </li>
        <li class="nav-item">
            <a href="<?=base_url()?>kk" class="nav-link">
                <i class="nav-icon bi bi-houses"></i>
                <p>Data KK</p>
            </a>
        </li>
        <li class="nav-item">
            <a href="<?=base_url()?>tarif" class="nav-link">
                <i class="nav-icon bi bi-houses"></i>
                <p>Tarif Iuran</p>
            </a>
        </li>
        <li class="nav-item">
            <a href="<?=base_url()?>diskon" class="nav-link">
                <i class="nav-icon bi bi-houses"></i>
                <p>Diskon</p>
            </a>
        </li>
    </ul>
</li>
<li class="nav-item">
    <a href="#" class="nav-link">
        <i class="nav-icon bi bi-ticket-detailed"></i>
        <p>Transaksi <i class="nav-arrow bi bi-chevron-right"></i></p>
    </a>
    <ul class="nav nav-treeview">
        <li class="nav-item">
            <a href="<?=base_url()?>transaksi" class="nav-link">
                <i class="nav-icon bi bi-file-ruled"></i>
                <p>All</p>
            </a>
        </li>
        <li class="nav-item">
            <a href="<?=base_url()?>transaksi/pending" class="nav-link">
                <i class="nav-icon bi bi-file-ruled"></i>
                <p>Pending <span class="badge text-bg-primary"><?php
                $transaksimodel = new \App\Models\Transaksimodel();
                $transaksibuilder = $transaksimodel->builder();
                $transaksibuilder->where("flag_validasi","1");
                $transaksi = $transaksibuilder->selectCount("id_transaksi","jumlah_pending")->get()->getRow();
                if($transaksi){
                    echo $transaksi->jumlah_pending;
                }
                ?></span></p>
            </a>
        </li>
        <!-- <li class="nav-item">
            <a href="<?=base_url()?>transaksi/pembatalan" class="nav-link">
                <i class="nav-icon bi bi-bag-x"></i>
                <p>Dibatalkan</p>
            </a>
        </li> -->
        <li class="nav-item">
            <a href="<?=base_url()?>transaksi/warga" class="nav-link">
                <i class="nav-icon bi bi-file-person"></i>
                <p>Rekap Warga</p>
            </a>
        </li>
        <li class="nav-item">
            <a href="<?=base_url()?>historytrans" class="nav-link">
                <i class="nav-icon bi bi-calendar-minus"></i>
                <p>Trans. Track</p>
            </a>
        </li>
    </ul>
</li>
<li class="nav-item">
    <a href="#" class="nav-link">
        <i class="nav-icon bi bi-ticket-detailed"></i>
        <p>Invoice <i class="nav-arrow bi bi-chevron-right"></i></p>
    </a>
    <ul class="nav nav-treeview">
        <li class="nav-item">
            <a href="<?=base_url()?>invoice/open" class="nav-link">
                <i class="nav-icon bi bi-file-ruled"></i>
                <p>Open Invoice</p>
            </a>
        </li>
        <li class="nav-item">
            <a href="<?=base_url()?>invoice/closed" class="nav-link">
                <i class="nav-icon bi bi-cash-coin"></i>
                <p>Closed Invoice</p>
            </a>
        </li>
        <li class="nav-item">
            <a href="<?=base_url()?>transaksi/pelunasan_invoice" class="nav-link">
                <i class="nav-icon bi bi-cash-coin"></i>
                <p>Pelunasan Invoice</p>
            </a>
        </li>
    </ul>
</li>
<li class="nav-item">
    <a href="#" class="nav-link">
        <i class="nav-icon bi bi-file-bar-graph"></i>
        <p>Laporan <i class="nav-arrow bi bi-chevron-right"></i></p>
    </a>
    <ul class="nav nav-treeview">
        <li class="nav-item">
            <a href="<?=base_url()?>laporan/harian" class="nav-link">
                <i class="nav-icon bi bi-file-earmark-post"></i>
                <p>Harian</p>
            </a>
        </li>
        <li class="nav-item">
            <a href="<?=base_url()?>exportlaporan" class="nav-link">
                <i class="nav-icon bi bi-file-earmark-post"></i>
                <p>Export</p>
            </a>
        </li>
    </ul>
</li>

<li class="nav-item">
    <a href="#" class="nav-link">
        <i class="nav-icon bi bi-people"></i>
        <p>Users <i class="nav-arrow bi bi-chevron-right"></i></p>
    </a>
    <ul class="nav nav-treeview">
        <li class="nav-item">
            <a href="<?=base_url()?>admin" class="nav-link">
                <i class="nav-icon bi bi-file-earmark-post"></i>
                <p>Admin</p>
            </a>
        </li>
        <li class="nav-item">
            <a href="<?=base_url()?>operator" class="nav-link">
                <i class="nav-icon bi bi-file-earmark-post"></i>
                <p>Operator</p>
            </a>
        </li>
        <li class="nav-item">
            <a href="<?=base_url()?>kolektor" class="nav-link">
                <i class="nav-icon bi bi-file-earmark-post"></i>
                <p>Kolektor</p>
            </a>
        </li>
    </ul>
</li>