<?php
if (strtoupper($_SESSION['strJobPosition']) == "ACCOUNTING") {
?>
    <li class="nav-item">
        <a class="nav-link collapsed" data-bs-target="#masterdata" data-bs-toggle="collapse" href="#">
            <i class="bi bi-bounding-box"></i><span>Master Data</span><i class="bi bi-chevron-down ms-auto"></i>
        </a>
        <ul id="masterdata" class="nav-content collapse " data-bs-parent="#sidebar-nav">

            <li>
                <a href="?menu=master-barang">
                    <i class="bi bi-circle"></i><span>Master Barang</span>
                </a>
            </li>

        </ul>
    </li>
<?php
}
?>


<li class="nav-item">
    <a class="nav-link collapsed" data-bs-target="#components-nav" data-bs-toggle="collapse" href="#">
        <i class="bi bi-cart3"></i><span>Pembelian</span><i class="bi bi-chevron-down ms-auto"></i>
    </a>
    <ul id="components-nav" class="nav-content collapse " data-bs-parent="#sidebar-nav">

        <li>
            <a href="?menu=tambah-lpbj" onclick="tambahlpbj1(2)">
                <i class="bi bi-circle"></i><span>Tambah LPBJ</span>
            </a>
        </li>
        <li>
            <a href="?menu=laporan-lpbj" onclick="laporanlpbj1(3)">
                <i class="bi bi-circle"></i><span>Laporan LPBJ</span>
            </a>
        </li>
    </ul>
</li>

<script src="assets/libs/js/jquery-3.6.0.min.js"></script>
<script>
    function tambahlpbj(idmenu) {
        $.ajax({
            url: "cek_menu.php",
            type: 'POST',
            cache: false,
            data: {
                idmenu: idmenu
            },
            success: function(data) {
                if (data == 1) {
                    window.open("?menu=tambah-lpbj", "_self");
                } else {
                    Swal.fire({
                        title: "Access denied",
                        text: "Please contact IT Division",
                        icon: "warning"
                    });
                }
            }
        });
    }

    function laporanlpbj(idmenu) {
        $.ajax({
            url: "cek_menu.php",
            type: 'POST',
            cache: false,
            data: {
                idmenu: idmenu
            },
            success: function(data) {
                if (data == 1) {
                    window.open("?menu=laporan-lpbj", "_self");
                } else {
                    Swal.fire({
                        title: "Access denied",
                        text: "Please contact IT Division",
                        icon: "warning"
                    });
                }
            }
        });
    }
</script>