<?php
// _sidebar.php - Admin Sidebar Navigation

// This file is included in admin-specific pages that require a sidebar.
// It assumes that session_start() has already been called in _header.php or the main page.
?>
<!-- Sidebar -->
<nav class="app-sidebar" id="appSidebar">
    <div class="list-group list-group-flush">
        <!-- Dynamic active class for navigation links -->
        <a href="admin_dashboard.php" class="nav-link <?php echo (strpos($pageTitle, 'Admin Dashboard') !== false) ? 'active' : ''; ?>">
            <i class="fas fa-tachometer-alt"></i> Dashboard
        </a>
        <a href="hostels.php" class="nav-link <?php echo (strpos($pageTitle, 'Hostels') !== false) ? 'active' : ''; ?>">
            <i class="fas fa-building"></i> Hostels
        </a>
        <a href="floors.php" class="nav-link <?php echo (strpos($pageTitle, 'Floors') !== false) ? 'active' : ''; ?>">
            <i class="fas fa-layer-group"></i> Floors
        </a>
        <a href="rooms_beds.php" class="nav-link <?php echo (strpos($pageTitle, 'Rooms & Beds') !== false) ? 'active' : ''; ?>">
            <i class="fas fa-bed"></i> Rooms & Beds
        </a>
        <a href="student_registration_step1.php" class="nav-link <?php echo (strpos($pageTitle, 'Students') !== false) ? 'active' : ''; ?>">
            <i class="fas fa-user-graduate"></i> Students
        </a>
        <a href="view_students.php" class="nav-link <?php echo (strpos($pageTitle, 'View') !== false) ? 'active' : ''; ?>">
            <i class="fas fa-user-graduate"></i> View Students
        </a>
        <a href="assignments.php" class="nav-link <?php echo (strpos($pageTitle, 'Assignments') !== false) ? 'active' : ''; ?>">
            <i class="fas fa-user-check"></i> Assignments
        </a>
        <a href="floor_plan.php" class="nav-link <?php echo (strpos($pageTitle, 'Reports') !== false) ? 'active' : ''; ?>">
            <i class="fas fa-chart-bar"></i> Live Status
        </a>
        
        <a href="gate_enquiry.php" class="nav-link <?php echo (strpos($pageTitle, 'MakeGatePass') !== false) ? 'active' : ''; ?>">
            <i class="fas fa-chart-bar"></i>Gate Enquiry
        </a>
         <a href="view_gate_enquiries.php" class="nav-link <?php echo (strpos($pageTitle, 'GatePass') !== false) ? 'active' : ''; ?>">
            <i class="fas fa-chart-bar"></i> View Gate Enquiry
        </a>

        <!-- Check if the admin is a super admin -->
        <?php if ($_SESSION['is_super_admin'] == 1): ?>
            <a href="student_outpass.php" class="nav-link <?php echo (strpos($pageTitle, 'Outpass') !== false) ? 'active' : ''; ?>">
                <i class="fas fa-chart-bar"></i> Outpass
            </a>
            <a href="https://lbsgroup.in/mess/" target="_blank" class="nav-link">
                <i class="fas fa-hamburger"></i>Mess Management
            </a>
        <?php endif; ?>
            <a href="outpass_list.php" class="nav-link <?php echo (strpos($pageTitle, 'Generated') !== false) ? 'active' : ''; ?>">
                <i class="fas fa-chart-bar"></i> Generated Outpass
            </a>
          <?php if ($_SESSION['is_super_admin'] == 1): ?>
            <a href="https://lbsgroup.in/mess/" target="_blank" class="nav-link">
                <i class="fas fa-hamburger"></i>Mess Management
            </a>
        <?php endif; ?>    

        <a href="logout.php" class="nav-link <?php echo (strpos($pageTitle, 'Logout') !== false) ? 'active' : ''; ?>">
            <i class="fas fa-power-off"></i> Logout
        </a>
    </div>
</nav>
