@php
  $configData = Helper::appClasses();
  $adminHomeRoute = \Illuminate\Support\Facades\Auth::check()
    ? \App\Support\Authorization\PermissionCatalog::firstAccessibleRouteFor(\Illuminate\Support\Facades\Auth::user())
    : route('admin.dashboard');
@endphp

<aside id="layout-menu" class="layout-menu menu-vertical menu" @foreach ($configData['menuAttributes'] as $attribute => $value) {{ $attribute }}="{{ $value }}" @endforeach>
  <div class="app-brand demo">
    <a href="{{ $adminHomeRoute }}" class="app-brand-link">
      <span class="app-brand-logo demo">@include('_partials.macros')</span>
      <span class="app-brand-text demo menu-text fw-bold ms-3">Admin Mariachi</span>
    </a>

    <a href="javascript:void(0);" class="layout-menu-toggle menu-link text-large ms-auto">
      <i class="icon-base ti menu-toggle-icon d-none d-xl-block"></i>
      <i class="icon-base ti tabler-x d-block d-xl-none"></i>
    </a>
  </div>

  <div class="menu-inner-shadow"></div>

  <ul class="menu-inner py-1">
    @can('admin.dashboard.view')
    <li class="menu-item {{ request()->routeIs('admin.dashboard') ? 'active' : '' }}">
      <a href="{{ route('admin.dashboard') }}" class="menu-link">
        <i class="menu-icon icon-base ti tabler-smart-home"></i>
        <div>Dashboard</div>
      </a>
    </li>
    @endcan

    @can('admin.users.view')
    <li class="menu-item {{ request()->routeIs('admin.users.*') ? 'active' : '' }}">
      <a href="{{ route('admin.users.index') }}" class="menu-link">
        <i class="menu-icon icon-base ti tabler-user-star"></i>
        <div>Usuarios</div>
      </a>
    </li>
    @endcan

    @can('admin.organizations.view')
    <li class="menu-item {{ request()->routeIs('admin.organizations.*') || request()->routeIs('admin.mariachi-groups.*') ? 'active' : '' }}">
      <a href="{{ route('admin.mariachi-groups.index') }}" class="menu-link">
        <i class="menu-icon icon-base ti tabler-building"></i>
        <div>Grupos Mariachi</div>
      </a>
    </li>
    @endcan

    @can('admin.team.view')
    <li class="menu-item {{ request()->routeIs('admin.team.*') ? 'active' : '' }}">
      <a href="{{ route('admin.team.index') }}" class="menu-link">
        <i class="menu-icon icon-base ti tabler-users"></i>
        <div>Equipo</div>
      </a>
    </li>
    @endcan

    @can('admin.roles.view')
    <li class="menu-item {{ request()->routeIs('admin.roles.*') ? 'active' : '' }}">
      <a href="{{ route('admin.roles.index') }}" class="menu-link">
        <i class="menu-icon icon-base ti tabler-shield"></i>
        <div>Roles</div>
      </a>
    </li>
    @endcan

  </ul>
</aside>
