<!-- Sidebar -->
<ul class="navbar-nav bg-gradient-dark sidebar sidebar-dark accordion" id="accordionSidebar">

    <!-- Sidebar - Brand -->
    <a class="sidebar-brand d-flex align-items-center justify-content-center" href="dashboard.php">
        <div class="sidebar-brand-icon">
            <i class="fas fa-industry"></i>
        </div>
        <div class="sidebar-brand-text mx-2">
            Mariyappa Nadar Ricemill
           
        </div>
    </a>

    <!-- Divider -->
    <hr class="sidebar-divider my-0">

    <?php if(isset($_SESSION['uid'])): ?>
    
    <!-- Dashboard -->
    <li class="nav-item">
        <a class="nav-link" href="dashboard.php">
            <i class="fas fa-fw fa-tachometer-alt"></i>
            <span>Dashboard</span>
        </a>
    </li>

    <!-- POS System -->
    <li class="nav-item">
        <a class="nav-link" href="pos.php">
            <i class="fas fa-fw fa-cash-register"></i>
            <span>POS System</span>
        </a>
    </li>

    <!-- POS Reports -->
    <li class="nav-item">
        <a class="nav-link" href="pos-reports.php">
            <i class="fas fa-fw fa-chart-line"></i>
            <span>POS Reports</span>
        </a>
    </li>

    <!-- POS Mobile Quick -->
    <li class="nav-item">
        <a class="nav-link" href="pos-reports-mobile.php">
            <i class="fas fa-fw fa-mobile-alt"></i>
            <span>POS Quick (Mobile)</span>
        </a>
    </li>

    <!-- Customer Management -->
    <li class="nav-item">
        <a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapseCustomers" aria-expanded="true" aria-controls="collapseCustomers">
            <i class="fas fa-fw fa-users"></i>
            <span>Customer Management</span>
        </a>
        <div id="collapseCustomers" class="collapse" aria-labelledby="headingCustomers" data-parent="#accordionSidebar">
            <div class="bg-white py-2 collapse-inner rounded">
                <h6 class="collapse-header">Customer Operations:</h6>
                <a class="collapse-item" href="customer-management.php">
                    <i class="fas fa-users text-primary"></i> Manage Customers
                </a>
                <a class="collapse-item" href="area-management.php">
                    <i class="fas fa-map-marker-alt text-success"></i> Manage Areas
                </a>
                <a class="collapse-item" href="customer-outstanding.php">
                    <i class="fas fa-chart-line text-warning"></i> Outstanding Report
                </a>
                <a class="collapse-item" href="customer-payments.php">
                    <i class="fas fa-money-bill-wave text-success"></i> Payment Records
                </a>
                <a class="collapse-item" href="customer-inactive-report.php">
                    <i class="fas fa-user-clock text-danger"></i> Inactive Customers
                </a>
                <a class="collapse-item" href="import-customers.php">
                    <i class="fas fa-file-import text-info"></i> Import Customers
                </a>
            </div>
        </div>
    </li>

    <!-- Product Management -->
    <li class="nav-item">
        <a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapseProducts" aria-expanded="true" aria-controls="collapseProducts">
            <i class="fas fa-fw fa-box"></i>
            <span>Product Management</span>
        </a>
        <div id="collapseProducts" class="collapse" aria-labelledby="headingProducts" data-parent="#accordionSidebar">
            <div class="bg-white py-2 collapse-inner rounded">
                <h6 class="collapse-header">Product Operations:</h6>
                <a class="collapse-item" href="rice-bag-management.php">
                    <i class="fas fa-seedling text-success"></i> Rice Bag Products
                </a>
                <a class="collapse-item" href="inventory-management.php">
                    <i class="fas fa-boxes text-primary"></i> Inventory Management
                </a>
                <a class="collapse-item" href="inventory-items.php">
                    <i class="fas fa-warehouse text-info"></i> Inventory Items
                </a>
                <a class="collapse-item" href="stock-adjustment.php">
                    <i class="fas fa-exchange-alt text-warning"></i> Stock Adjustment
                </a>
            </div>
        </div>
    </li>

    <!-- User Management (Admin Only) -->
    <?php if($_SESSION['usertype'] == 'admin'): ?>
    <li class="nav-item">
        <a class="nav-link" href="create-user.php">
            <i class="fas fa-fw fa-user-plus"></i>
            <span>User Management</span>
        </a>
    </li>
    <?php endif; ?>


    <!-- Divider -->
    <hr class="sidebar-divider">

    <!-- System Section -->
    <div class="sidebar-heading" style="font-size: 0.75rem; font-weight: 800; color: #858796;">
        <i class="fas fa-cog mr-1"></i> SYSTEM
    </div>

    <li class="nav-item">
        <a class="nav-link" href="logout.php">
            <i class="fas fa-fw fa-sign-out-alt text-danger"></i>
            <span>Logout</span>
        </a>
    </li>

    <?php else: ?>
    
    <!-- Authentication Section -->
    <div class="sidebar-heading" style="font-size: 0.75rem; font-weight: 800; color: #858796;">
        <i class="fas fa-lock mr-1"></i> AUTHENTICATION
    </div>

    <!-- Login Access -->
    <li class="nav-item">
        <a class="nav-link" href="login.php">
            <i class="fas fa-fw fa-sign-in-alt"></i>
            <span>User Login</span>
        </a>
    </li>

    <?php endif; ?>

    <!-- Sidebar Toggler (Sidebar) -->
    <div class="text-center d-none d-md-inline">
        <button class="rounded-circle border-0" id="sidebarToggle"></button>
    </div>

</ul>
<!-- End of Sidebar -->