<div class="main-nav">
    <!-- Sidebar Logo -->
    <div class="logo-box">
        <a href="{{ config('app.url') }}/admin" class="logo-dark">
            <img src="{{ asset('metor/images/logo-sm.png') }}" class="logo-sm" alt="logo sm">
            <img src="{{ asset('metor/images/logo-dark.png') }}" class="logo-lg" alt="logo dark">
        </a>

        <a href="{{ config('app.url') }}/admin" class="logo-light">
            <img src="{{ asset('metor/images/logo-sm.png') }}" class="logo-sm" alt="logo sm">
            <img src="{{ asset('metor/images/logo-white.png') }}" class="logo-lg" alt="logo light">
        </a>
    </div>

    <div class="h-100" data-simplebar>
        <ul class="navbar-nav" id="navbar-nav">
            <li class="menu-item pt-2">
                <a class="menu-link {{ Request::is('admin') || Request::is('admin/dashboard') ? 'active' : '' }}" href="{{ url('/admin') }}">
                    <span class="nav-icon">
                        <i class="ri-dashboard-2-line"></i>
                    </span>
                    <span class="nav-text"> Dashboard </span>
                </a>
            </li>

            <!-- User Management -->
            @if(Auth::user()->can('users-list') || Auth::user()->can('roles-list') || Auth::user()->can('permissions-list'))
            <li class="menu-item">
                <a class="menu-link menu-arrow {{ Request::is('admin/users*') || Request::is('admin/roles*') || Request::is('admin/permissions*') ? 'active' : '' }}" href="#sidebarUserManagement" data-bs-toggle="collapse" role="button" aria-expanded="{{ Request::is('admin/users*') || Request::is('admin/roles*') || Request::is('admin/permissions*') ? 'true' : 'false' }}" aria-controls="sidebarUserManagement">
                    <span class="nav-icon">
                        <i class="ri-user-settings-line"></i>
                    </span>
                    <span class="nav-text"> User Management </span>
                </a>
                <div class="collapse {{ Request::is('admin/users*') || Request::is('admin/roles*') || Request::is('admin/permissions*') ? 'show' : '' }}" id="sidebarUserManagement">
                    <ul class="sub-menu-nav">
                        @can("users-list")
                        <li class="sub-menu-item">
                            <a class="sub-menu-link {{ Request::is('admin/users*') ? 'active' : '' }}" href="{{ url('/admin/users') }}">Users</a>
                        </li>
                        @endcan
                        @can("roles-list")
                        <li class="sub-menu-item">
                            <a class="sub-menu-link {{ Request::is('admin/roles*') ? 'active' : '' }}" href="{{ url('/admin/roles') }}">Roles</a>
                        </li>
                        @endcan
                    </ul>
                </div>
            </li>
            @endif
            <!-- End User Management -->

            <!-- HR & Organization -->
            @if(Auth::user()->can('employees-list') || Auth::user()->can('departments-list') || Auth::user()->can('designations-list') || Auth::user()->can('skills-list') || Auth::user()->can('shifts-list') || Auth::user()->can('clients-list'))
            <li class="menu-item">
                <a class="menu-link menu-arrow {{ Request::is('admin/employees*') || Request::is('admin/departments*') || Request::is('admin/designations*') || Request::is('admin/skills*') || Request::is('admin/shifts*') || Request::is('admin/clients*') ? 'active' : '' }}" href="#sidebarHrOrganization" data-bs-toggle="collapse" role="button" aria-expanded="{{ Request::is('admin/employees*') || Request::is('admin/departments*') || Request::is('admin/designations*') || Request::is('admin/skills*') || Request::is('admin/shifts*') || Request::is('admin/clients*') ? 'true' : 'false' }}" aria-controls="sidebarHrOrganization">
                    <span class="nav-icon">
                        <i class="ri-team-line"></i>
                    </span>
                    <span class="nav-text"> HR & Organization </span>
                </a>
                <div class="collapse {{ Request::is('admin/employees*') || Request::is('admin/departments*') || Request::is('admin/designations*') || Request::is('admin/skills*') || Request::is('admin/shifts*') || Request::is('admin/clients*') ? 'show' : '' }}" id="sidebarHrOrganization">
                    <ul class="sub-menu-nav">
                        @can("employees-list")
                        <li class="sub-menu-item">
                            <a class="sub-menu-link {{ Request::is('admin/employees*') ? 'active' : '' }}" href="{{ url('/admin/employees') }}">Employees</a>
                        </li>
                        @endcan
                        @can("departments-list")
                        <li class="sub-menu-item">
                            <a class="sub-menu-link {{ Request::is('admin/departments*') ? 'active' : '' }}" href="{{ url('/admin/departments') }}">Departments</a>
                        </li>
                        @endcan
                        @can("designations-list")
                        <li class="sub-menu-item">
                            <a class="sub-menu-link {{ Request::is('admin/designations*') ? 'active' : '' }}" href="{{ url('/admin/designations') }}">Designations</a>
                        </li>
                        @endcan
                        @can("skills-list")
                        <li class="sub-menu-item">
                            <a class="sub-menu-link {{ Request::is('admin/skills*') ? 'active' : '' }}" href="{{ url('/admin/skills') }}">Skills</a>
                        </li>
                        @endcan
                        @can("shifts-list")
                        <li class="sub-menu-item">
                            <a class="sub-menu-link {{ Request::is('admin/shifts*') ? 'active' : '' }}" href="{{ url('/admin/shifts') }}">Shifts</a>
                        </li>
                        @endcan
                        @can("clients-list")
                        <li class="sub-menu-item">
                            <a class="sub-menu-link {{ Request::is('admin/clients*') ? 'active' : '' }}" href="{{ url('/admin/clients') }}">Clients</a>
                        </li>
                        @endcan
                    </ul>
                </div>
            </li>
            @endif
            <!-- End HR & Organization -->

            <!-- Attendance & Leave -->
            @if(Auth::user()->can('attendances-list') || Auth::user()->can('leave-types-list') || Auth::user()->can('leaves-list'))
            <li class="menu-item">
                <a class="menu-link menu-arrow {{ Request::is('admin/attendances*') || Request::is('admin/leave-types*') || Request::is('admin/leaves*') ? 'active' : '' }}" href="#sidebarAttendanceLeave" data-bs-toggle="collapse" role="button" aria-expanded="{{ Request::is('admin/attendances*') || Request::is('admin/leave-types*') || Request::is('admin/leaves*') ? 'true' : 'false' }}" aria-controls="sidebarAttendanceLeave">
                    <span class="nav-icon">
                        <i class="ri-calendar-check-line"></i>
                    </span>
                    <span class="nav-text"> Attendance & Leave </span>
                </a>
                <div class="collapse {{ Request::is('admin/attendances*') || Request::is('admin/leave-types*') || Request::is('admin/leaves*') ? 'show' : '' }}" id="sidebarAttendanceLeave">
                    <ul class="sub-menu-nav">
                        @can("attendances-list")
                        <li class="sub-menu-item">
                            <a class="sub-menu-link {{ Request::is('admin/attendances*') ? 'active' : '' }}" href="{{ url('/admin/attendances') }}">Attendances</a>
                        </li>
                        @endcan
                        @can("leave-types-list")
                        <li class="sub-menu-item">
                            <a class="sub-menu-link {{ Request::is('admin/leave-types*') ? 'active' : '' }}" href="{{ url('/admin/leave-types') }}">Leave Types</a>
                        </li>
                        @endcan
                        @can("leaves-list")
                        <li class="sub-menu-item">
                            <a class="sub-menu-link {{ Request::is('admin/leaves*') ? 'active' : '' }}" href="{{ url('/admin/leaves') }}">Leaves</a>
                        </li>
                        @endcan
                    </ul>
                </div>
            </li>
            @endif
            <!-- End Attendance & Leave -->

            <!-- Payroll -->
            @if(Auth::user()->can('payrolls-list') || Auth::user()->can('payroll-items-list') || Auth::user()->can('salary-structures-list') || Auth::user()->can('loans-list'))
            <li class="menu-item">
                <a class="menu-link menu-arrow {{ Request::is('admin/payrolls*') || Request::is('admin/payroll-items*') || Request::is('admin/salary-structures*') || Request::is('admin/loans*') ? 'active' : '' }}" href="#sidebarPayroll" data-bs-toggle="collapse" role="button" aria-expanded="{{ Request::is('admin/payrolls*') || Request::is('admin/payroll-items*') || Request::is('admin/salary-structures*') || Request::is('admin/loans*') ? 'true' : 'false' }}" aria-controls="sidebarPayroll">
                    <span class="nav-icon">
                        <i class="ri-money-dollar-circle-line"></i>
                    </span>
                    <span class="nav-text"> Payroll </span>
                </a>
                <div class="collapse {{ Request::is('admin/payrolls*') || Request::is('admin/payroll-items*') || Request::is('admin/salary-structures*') || Request::is('admin/loans*') ? 'show' : '' }}" id="sidebarPayroll">
                    <ul class="sub-menu-nav">
                        @can("payrolls-list")
                        <li class="sub-menu-item">
                            <a class="sub-menu-link {{ Request::is('admin/payrolls*') ? 'active' : '' }}" href="{{ url('/admin/payrolls') }}">Payrolls</a>
                        </li>
                        @endcan
                        @can("payroll-items-list")
                        <li class="sub-menu-item">
                            <a class="sub-menu-link {{ Request::is('admin/payroll-items*') ? 'active' : '' }}" href="{{ url('/admin/payroll-items') }}">Payroll Items</a>
                        </li>
                        @endcan
                        @can("salary-structures-list")
                        <li class="sub-menu-item">
                            <a class="sub-menu-link {{ Request::is('admin/salary-structures*') ? 'active' : '' }}" href="{{ url('/admin/salary-structures') }}">Salary Structures</a>
                        </li>
                        @endcan
                        @can("loans-list")
                        <li class="sub-menu-item">
                            <a class="sub-menu-link {{ Request::is('admin/loans*') ? 'active' : '' }}" href="{{ url('/admin/loans') }}">Loans</a>
                        </li>
                        @endcan
                    </ul>
                </div>
            </li>
            @endif
            <!-- End Payroll -->

            <li class="menu-item mt-auto">
                <a class="menu-link" href="{{route('logout')}}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
                    <span class="nav-icon">
                        <i class="ri-logout-box-line"></i>
                    </span>
                    <span class="nav-text"> Logout </span>
                </a>
            </li>

            <form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
                @csrf
            </form>
        </ul>
    </div>
</div>
