<div class="sidebar" id="sidebar">
    <?php
    if (isset($_SESSION['role']) && $_SESSION['role'] === "admin") {
        ?>
         <ul class="nav flex-column">
            <li class="nav-item">
                <a class="nav-link active click_page" data-page="dashboard.php">
                    <i class="fas fa-tachometer-alt"></i> Dashboard
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link click_page" data-page="residents.php">
                    <i class="fas fa-users"></i> Residents
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link click_page" data-page="emergency.php">
                    <i class="fas fa-bell text-warning bell-alert"></i> Emergency <span id="emergency_count" class="badge badge-danger"> 0</span>
                </a>
            </li>

            <li class="nav-item">
                <a class="nav-link click_page" data-page="users.php">
                    <i class="fas fa-users"></i> Users
                </a>
            </li>
             <li class="nav-item">
                <a class="nav-link click_page" data-page="organizational_structure.php">
                    <i class="fas fa-users"></i> Org Structure
                </a>
            </li>

            <li class="nav-item">
                <a class="nav-link click_page" data-page="transactions.php">
                    <i class="fas fa-file-alt"></i> Transactions <span id="transactions_counter" class="badge badge-info">0</span>
                </a>
            </li>
              <li class="nav-item">
                <a class="nav-link click_page" data-page="departments.php">
                    <i class="fas fa-file-alt"></i> Departments
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link click_page" data-page="assignment.php">
                    <i class="fas fa-calendar-alt"></i> Assignments
                </a>
            </li>
            

            <li class="nav-item">
                <a class="nav-link click_page" data-page="settings.php">
                    <i class="fas fa-cog"></i> Settings
                </a>
            </li>
        </ul>

        <?php
    }
     ?>


         <?php
    if (isset($_SESSION['role']) && $_SESSION['role'] === "official") {
        ?>
 <ul class="nav flex-column">
            <li class="nav-item">
                <a class="nav-link active click_page" data-page="dashboard.php">
                    <i class="fas fa-tachometer-alt"></i> Dashboard
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link click_page" data-page="emergency.php">
                    <i class="fas fa-bell text-warning"></i> Emergency <span id="emergency_count" class="badge badge-danger"> 0</span>
                </a>
            </li>
          <li class="nav-item">
                <a class="nav-link active click_page" data-page="schedule.php">
                    <i class="fas fa-clock"></i> Hearing Schedule
                </a>
            </li>
           <?php 
           $id = $_SESSION['user_id'];
           $query = "SELECT * FROM tbl_organizational_structure WHERE position = 'SECRETARY' AND user_id = '$id'";
           $query_result = $conn->query($query);

           if ($query_result->num_rows > 0) {
            echo 
            '
             <li class="nav-item">
                <a class="nav-link click_page" data-page="submitted_reports.php">
                    <i class="fas fa-folder"></i>Submitted Reports
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link click_page" data-page="transactions.php">
                    <i class="fas fa-file-alt"></i> Transactions <span id="transactions_counter" class="badge badge-info">0</span>
                </a>
            </li>
            ';
           }else{
            echo 
            '
             <li class="nav-item">
                <a class="nav-link click_page" data-page="assigned_complaint_kagawad.php">
                    <i class="fas fa-calendar-alt"></i>My Assignments
                </a>
            </li>
            ';
           }
           ?>
           

            <li class="nav-item">
                <a class="nav-link click_page" data-page="settings.php">
                    <i class="fas fa-cog"></i> Settings
                </a>
            </li>
        </ul>
        <?php
    }
     ?>
       
    </div>