@php
  $isAdminRoute = fn (...$patterns) => request()->routeIs(...$patterns);
  $dashboardActive = $isAdminRoute('admin.dashboard');
  $profileActive = $isAdminRoute('admin.instituteprofile');
  $studentsOpen = $isAdminRoute('admin.loginstatus', 'admin.unloginstatus', 'admin.schoolstudents', 'admin.studentpaymentdetails', 'admin.studentcompetition', 'admin.studentscontest', 'admin.userprofile', 'admin.userpayments', 'admin.competitionstudentsdetails', 'admin.examreaultdetaiils');
  $passwordOpen = $isAdminRoute('admin.changepassword');
@endphp
<aside id="sidebar-wrapper">
  <div class="sidebar-brand">
    <a href="{{ route('admin.dashboard') }}">
      <img alt="image" src="{{ ASSETURL }}public/frontend/images/logo.png" class="header-logo" style="width: 50px;" />
      <span class="logo-name">Just Exam League</span>
    </a>
  </div>
  <ul class="sidebar-menu">
    <li class="menu-header">Main</li>
    <li class="dropdown {{ $dashboardActive ? 'active' : '' }}">
      <a href="{{ route('admin.dashboard') }}" class="nav-link"><i data-feather="grid"></i><span>Dashboard</span></a>
    </li>
    <li class="dropdown {{ $profileActive ? 'active' : '' }}">
      <a href="{{ route('admin.instituteprofile') }}" class="nav-link"><i data-feather="briefcase"></i><span>Institute Profile</span></a>
    </li>

    <li class="menu-header">Student Activity</li>
    <li class="dropdown {{ $studentsOpen ? 'active submenu-open' : '' }}">
      <a href="#" class="menu-toggle nav-link has-dropdown {{ $studentsOpen ? 'toggled' : '' }}" aria-expanded="{{ $studentsOpen ? 'true' : 'false' }}"><i data-feather="users"></i><span>Students</span></a>
      <ul class="dropdown-menu">
        <li class="{{ $isAdminRoute('admin.loginstatus') ? 'active' : '' }}"><a class="nav-link" href="{{ route('admin.loginstatus') }}">Active Students</a></li>
        <li class="{{ $isAdminRoute('admin.unloginstatus') ? 'active' : '' }}"><a class="nav-link" href="{{ route('admin.unloginstatus') }}">No Activity Yet</a></li>
        <li class="{{ $isAdminRoute('admin.schoolstudents', 'admin.userprofile') ? 'active' : '' }}"><a class="nav-link" href="{{ route('admin.schoolstudents') }}">School Students</a></li>
        <li class="{{ $isAdminRoute('admin.studentpaymentdetails', 'admin.userpayments') ? 'active' : '' }}"><a class="nav-link" href="{{ route('admin.studentpaymentdetails') }}">Payment Details</a></li>
        <li class="{{ $isAdminRoute('admin.studentcompetition', 'admin.studentscontest', 'admin.competitionstudentsdetails', 'admin.examreaultdetaiils') ? 'active' : '' }}"><a class="nav-link" href="{{ route('admin.studentcompetition') }}">Competition Details</a></li>
      </ul>
    </li>

    <li class="menu-header">Password</li>
    <li class="dropdown {{ $passwordOpen ? 'active submenu-open' : '' }}">
      <a href="#" class="menu-toggle nav-link has-dropdown {{ $passwordOpen ? 'toggled' : '' }}" aria-expanded="{{ $passwordOpen ? 'true' : 'false' }}"><i data-feather="lock"></i><span>Security</span></a>
      <ul class="dropdown-menu">
        <li class="{{ $passwordOpen ? 'active' : '' }}"><a class="nav-link" href="{{ route('admin.changepassword', ['userid' => Auth::user()->id]) }}">Change Password</a></li>
      </ul>
    </li>
  </ul>
</aside>
