<aside class="sidebar">
    <button type="button" class="sidebar-close-btn">
        <iconify-icon icon="radix-icons:cross-2"></iconify-icon>
    </button>
    <div class="">
        <div class="sidebar-logo d-flex align-items-center justify-content-between">
            <a href="../dashboard/index.php" class="">
                <img src="../assets/images/thumbs/nysc-logo.webp" alt="site logo" class="light-logo">
                <img src="../assets/images/thumbs/nysc-logo.webp" alt="site logo" class="dark-logo">
                <img src="../assets/images/thumbs/nysc-logo.webp" alt="site logo" class="logo-icon">
            </a>
            <h6 style="valign:bottom;"><?= APP_SHORT_NAME ?></h6>
            <button type="button" class="text-xxl d-xl-flex d-none line-height-1 sidebar-toggle text-neutral-500"
                aria-label="Collapse Sidebar">
                <i class="ri-contract-left-line"></i>
            </button>
        </div>
    </div>
    <!-- User Info start -->
    <div class="mx-16 py-12">
        <div class="dropdown profile-dropdown">
            <button type="button"
                class="profile-dropdown__button d-flex align-items-center justify-content-between p-10 w-100 overflow-hidden bg-neutral-50 radius-12 "
                data-bs-toggle="dropdown" data-bs-display="static" aria-expanded="false">
                <span class="d-flex align-items-start gap-10">
                    <img src="<?= !empty($user['avatar']) 
                        ? '../uploads/avatars/' . $user['avatar']
                        : '../assets/images/thumbs/leave-request-img2.png' ?>" alt="User"
                        class="w-40-px h-40-px rounded-circle object-fit-cover flex-shrink-0">
                    <span class="profile-dropdown__contents">
                        <span class="h6 mb-0 text-md d-block text-primary-light">
                            <?= htmlspecialchars($user['firstname'] . ' ' . $user['lastname']) ?>
                        </span>
                        <span
                            class="text-secondary-light text-sm mb-0 d-block"><?= htmlspecialchars($user['role']) ?></span>
                    </span>
                </span>
                <span class="profile-dropdown__icon pe-8 text-xl d-flex line-height-1">
                    <i class="ri-arrow-right-s-line"></i>
                </span>
            </button>
            <ul class="dropdown-menu dropdown-menu-lg-end border p-12">
                <li>
                    <a href="student-details.html"
                        class="dropdown-item rounded text-secondary-light bg-hover-neutral-200 text-hover-neutral-900 d-flex align-items-center gap-2 py-6">
                        <i class="ri-user-3-line"></i>
                        My Profile
                    </a>
                </li>
                <li>
                    <a href="general.html"
                        class="dropdown-item rounded text-secondary-light bg-hover-neutral-200 text-hover-neutral-900 d-flex align-items-center gap-2 py-6">
                        <i class="ri-settings-3-line"></i>
                        Setting
                    </a>
                </li>
                <li>
                    <a href="login.html"
                        class="dropdown-item rounded text-secondary-light bg-hover-neutral-200 text-hover-neutral-900 d-flex align-items-center gap-2 py-6">
                        <i class="ri-shut-down-line"></i>
                        Log Out
                    </a>
                </li>
            </ul>
        </div>
    </div>
    <!-- User Info end -->
    <div class="sidebar-menu-area">
        <ul class="sidebar-menu" id="sidebar-menu">
            <li>
                <a href="../dashboard/index.php">
                    <i class="ri-home-4-line"></i>
                    <span>Dashboard </span>
                </a>
            </li>
            <?php if(in_array($user['role'], ['Administrator', 'Camp Officer'])) { ?>
            <li class="dropdown">
                <a href="javascript:void(0)">
                    <i class="ri-graduation-cap-line"></i>
                    <span>Corps Members</span>
                </a>
                <ul class="sidebar-submenu">
                    <li>
                        <a href="../dashboard/register_corps_member.php">
                            <i class="ri-circle-fill circle-icon w-auto"></i>
                            Register Corps Member
                        </a>
                    </li>
                    <li>
                        <a href="../dashboard/corps_members.php">
                            <i class="ri-circle-fill circle-icon w-auto"></i>
                            All Corps Members
                        </a>
                    </li>
                </ul>
            </li>
            <?php } ?>
            <?php if(in_array($user['role'], ['Administrator', 'Camp Officer'])) { ?>
            <li class="dropdown">
                <a href="javascript:void(0)">
                    <i class="ri-building-line"></i>
                    <span>Camp Management</span>
                </a>
                <ul class="sidebar-submenu">
                    <li>
                        <a href="../dashboard/platoons.php">
                            <i class="ri-circle-fill circle-icon w-auto"></i>
                            Platoons
                        </a>
                    </li>
                    <li>
                        <a href="../dashboard/hostels.php">
                            <i class="ri-circle-fill circle-icon w-auto"></i>
                            Hostels
                        </a>
                    </li>
                    <li>
                        <a href="../dashboard/camp-activities.php">
                            <i class="ri-circle-fill circle-icon w-auto"></i>
                            Camp Activities
                        </a>
                    </li>
                </ul>
            </li>
            <?php } ?>
            <?php if(in_array($user['role'], ['Administrator', 'LGI', 'Corps Member'])) { ?>
            <li class="dropdown">
                <a href="javascript:void(0)">
                    <i class="ri-calendar-check-line"></i>
                    <span>CDS</span>
                </a>
                <ul class="sidebar-submenu">
                    <?php if(in_array($user['role'], ['Corps Member'])) { ?>
                    <li>
                        <a href="../dashboard/cds_attendance.php">
                            <i class="ri-circle-fill circle-icon w-auto"></i>
                            Attendance
                        </a>
                    </li>
                    <?php } ?>
                    <?php if(in_array($user['role'], ['Administrator', 'LGI'])) { ?>
                    <li>
                        <a href="../dashboard/cds_groups.php">
                            <i class="ri-circle-fill circle-icon w-auto"></i>
                            CDS Groups
                        </a>
                    </li>
                    <li>
                        <a href="../dashboard/manage_cds_attendance.php">
                            <i class="ri-circle-fill circle-icon w-auto"></i>
                            Attendance Session
                        </a>
                    </li>
                    <?php } ?>
                </ul>
            </li>
            <?php } ?>
            <?php if(in_array($user['role'], ['Administrator', 'LGI', 'Corps Member'])) { ?>
            <li class="dropdown">
                <a href="javascript:void(0)">
                    <i class="ri-file-list-3-line"></i>
                    <span>Monthly Clearance</span>
                </a>
                <ul class="sidebar-submenu">
                    <?php if (strcasecmp(trim($user['role']), 'Corps Member') == 0) { ?>
                    <li>
                        <a href="../dashboard/monthly-clearance.php">
                            <i class="ri-file-list-3-line"></i>
                            <span>Submit Clearance</span>
                        </a>
                    </li>
                    <?php } ?>

                    <?php if(in_array($user['role'], ['Administrator', 'LGI'])) { ?>
                    <li>
                        <a href="../dashboard/pending-clearance.php">
                            <i class="ri-circle-fill circle-icon w-auto"></i>
                            Pending Clearance
                        </a>
                    </li>
                    <li>
                        <a href="../dashboard/clearance-history.php">
                            <i class="ri-circle-fill circle-icon w-auto"></i>
                            Clearance History
                        </a>
                    </li>
                    <?php } ?>
                </ul>
            </li>
            <?php } ?>
            <?php if(in_array($user['role'], ['Administrator', 'LGI'])) { ?>
            <li>
                <a href="../dashboard/reports.php">
                    <i class="ri-bar-chart-box-line"></i>
                    <span>Reports</span>
                </a>
            </li>
            <?php } ?>
            <?php if($user['role'] == 'Administrator') { ?>
            <li class="dropdown">
                <a href="javascript:void(0)">
                    <i class="ri-settings-3-line"></i>
                    <span>Settings</span>
                </a>
                <ul class="sidebar-submenu">
                    <li>
                        <a href="../dashboard/general-settings.php">
                            <i class="ri-circle-fill circle-icon w-auto"></i>
                            General Settings
                        </a>
                    </li>
                    <li>
                        <a href="../dashboard/user-management.php">
                            <i class="ri-circle-fill circle-icon w-auto"></i>
                            User Management
                        </a>
                    </li>
                </ul>
            </li>
            <?php } ?>
            <li>
                <a href="../dashboard/my-profile.php">
                    <i class="ri-user-3-line"></i>
                    <span>My Profile</span>
                </a>
            </li>
            <li>
                <a href="../auth/logout.php">
                    <i class="ri-logout-circle-r-line"></i>
                    <span>Logout</span>
                </a>
            </li>
        </ul>
    </div>
</aside>