<?php
$current_page = basename($_SERVER['PHP_SELF']); // Get the current page filename
?>

<aside id="sidebar" class="sidebar">
    <ul class="sidebar-nav" id="sidebar-nav">

        <li class="nav-item">
            <a class="nav-link <?= ($current_page == 'branch_dashboard.php') ? 'active' : 'collapsed'; ?>" href="branch_dashboard.php">
                <i class="bi bi-grid"></i>
                <span>Dashboard</span>
            </a>
        </li>

        <!-- Order Processing Master -->
        <li class="nav-item">
            <a class="nav-link <?= ($current_page == 'customer_master.php') ? 'active' : 'collapsed'; ?>" href="customer_master.php">
                <i class="bi bi-truck"></i>
                <span>Customer</span>
            </a>
        </li>

        <!-- Batch Report -->
        <li class="nav-item">
            <a class="nav-link <?= ($current_page == 'Orders_master.php') ? 'active' : 'collapsed'; ?>" href="orders_master.php">
                <i class="bi bi-file-earmark-text"></i>
                <span>Order</span>
            </a>
        </li>
        
        <!-- Batch Report -->
        <li class="nav-item">
            <a class="nav-link <?= ($current_page == 'order_processing_master.php') ? 'active' : 'collapsed'; ?>" href="order_processing_master.php">
                <i class="bi bi-file-earmark-text"></i>
                <span>Order processing</span>
            </a>
        </li>

        <!-- Tables Section -->
        <li class="nav-item">
            <a class="nav-link <?= ($current_page == 'driver_master.php' || $current_page == 'vehicle_master.php' || $current_page == 'recipe_master.php') ? 'active' : 'collapsed'; ?>" data-bs-target="#tables-nav" data-bs-toggle="collapse" href="#">
                <i class="bi bi-layout-text-window-reverse"></i><span>Settings</span><i class="bi bi-chevron-down ms-auto"></i>
            </a>
            <ul id="tables-nav" class="nav-content collapse <?= ($current_page == 'tables-general.php' || $current_page == 'tables-data.php') ? 'show' : ''; ?>" data-bs-parent="#sidebar-nav">
                <li>
                    <a href="driver_master.php" class="<?= ($current_page == 'driver_master.php') ? 'active' : ''; ?>">
                        <i class="bi bi-circle"></i><span>Driver</span>
                    </a>
                </li>
                <li>
                    <a href="vehicle_master.php" class="<?= ($current_page == 'vehicle_master.php') ? 'active' : ''; ?>">
                        <i class="bi bi-circle"></i><span>vehicle</span>
                    </a>
                </li>
                <li>
                    <a href="recipe_master.php" class="<?= ($current_page == 'recipe_master.php') ? 'active' : ''; ?>">
                        <i class="bi bi-circle"></i><span>Recipe</span>
                    </a>
                </li>
                <li>
                    <a href="mperson_master.php" class="<?= ($current_page == 'mperson_master.php') ? 'active' : ''; ?>">
                        <i class="bi bi-circle"></i><span>Marketing Person</span>
                    </a>
                </li>
            </ul>
        </li>
        
        <li class="nav-item">
            <a class="nav-link <?= ($current_page == 'marketing_report.php' || $current_page == 'cron_job_email.php' || $current_page == 'cron_job_whatapp.php') ? 'active' : 'collapsed'; ?>" data-bs-target="#tables-nav" data-bs-toggle="collapse" href="#">
                <i class="bi bi-layout-text-window-reverse"></i><span>Report</span><i class="bi bi-chevron-down ms-auto"></i>
            </a>
            <ul id="tables-nav" class="nav-content collapse <?= ($current_page == 'tables-general.php' || $current_page == 'tables-data.php') ? 'show' : ''; ?>" data-bs-parent="#sidebar-nav">
                <li>
                    <a href="marketing_report.php" class="<?= ($current_page == 'marketing_report.php') ? 'active' : ''; ?>">
                        <i class="bi bi-circle"></i><span>Order </span>
                    </a>
                </li>
                <li>
                    <a href="cron_job_email.php" class="<?= ($current_page == 'cron_job_email.php') ? 'active' : ''; ?>">
                        <i class="bi bi-circle"></i><span>Cron Email</span>
                    </a>
                </li>
                <li>
                    <a href="cron_job_whatapp.php" class="<?= ($current_page == 'cron_job_whatapp.php') ? 'active' : ''; ?>">
                        <i class="bi bi-circle"></i><span>Cron Whats App</span>
                    </a>
                </li>
                
            </ul>
        </li>

    </ul>
</aside>
