<ul class="navbar-nav active">

    @if(auth()->user()?->isPlatformUser())
        @php $activeWorkspace = app(\App\Models\Solicitor\Solicitor::class); @endphp
        <li class="nav-item d-flex align-items-center me-2">
            <span class="badge bg-primary bg-opacity-10 text-primary border border-primary border-opacity-25 px-2 py-1">
                <i class="mdi mdi-office-building-outline me-1"></i>
                {{ $activeWorkspace?->name ?? 'No Workspace' }}
            </span>
            <a href="{{ route('workspace.switch') }}"
               class="btn btn-sm btn-link text-muted ps-1 pe-0"
               title="Switch workspace">
                <i class="mdi mdi-swap-horizontal"></i>
            </a>
        </li>
        <li class="nav-item"><hr class="vr mx-2 opacity-25"></li>
    @endif

    @can('dashboard.view')
        <li class="nav-item">
            <a class="nav-link" href="{{ route('dashboard') }}">
                <i class="uil-home-alt me-2"></i> Dashboard
            </a>
        </li>
    @endcan

    @can('tasks.admin')
        <li class="nav-item">
            <a class="nav-link" href="{{ route('task-hub.index') }}">
                <i class="uil-home-alt me-2"></i> Task Hub
            </a>
        </li>
    @endcan

    @can('solicitors.view')
        <li class="nav-item">
            <a class="nav-link" href="{{ route('solicitors.index') }}">
                <i class="uil-home-alt me-2"></i> Solicitors
            </a>
        </li>
    @endcan

    @can('reports.view')
        <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle arrow-none" role="button">
                <i class="uil-setting me-2"></i> Reports
                <div class="arrow-down"></div>
            </a>

            <div class="dropdown-menu">
                @can('reports.tranches.view')
                    <a href="{{ route('reports.tranche.index') }}" class="dropdown-item">Tranche Report</a>
                @endcan
                @can('reports.status')
                    <a href="{{ route('reports.status') }}" class="dropdown-item">Status Report</a>
                @endcan
                @can('reports.status.days')
                    <a href="{{ route('reports.status.days') }}" class="dropdown-item">Days In Status Report</a>
                @endcan

            </div>
        </li>
    @endcan

    @can('tranches.view')
        <li class="nav-item">
            <a class="nav-link" href="{{ route('tranches.index') }}">
                <i class="uil-user me-2"></i> Tranches
            </a>
        </li>
    @endcan


    @can('clients.view')
        <li class="nav-item">
            <a class="nav-link" href="{{ route('clients.index') }}">
                <i class="uil-user me-2"></i> Clients
            </a>
        </li>
    @endcan

    @can('institutions.view')
        <li class="nav-item">
            <a class="nav-link" href="{{ route('institutions.index') }}">
                <i class="uil-user me-2"></i> Institutions
            </a>
        </li>
    @endcan

    @can('sources.view')
        <li class="nav-item">
            <a class="nav-link" href="{{ route('sources.index') }}">
                <i class="uil-user me-2"></i> Lead Sources
            </a>
        </li>
    @endcan

    <li class="nav-item dropdown">
        <a class="nav-link dropdown-toggle arrow-none" href="" role="button">
            <i class="uil-setting me-2"></i> DSARs
            <div class="arrow-down"></div>
        </a>

        <div class="dropdown-menu">
            @can('dsars.view')
                <a href="{{ route('dsars.outstanding') }}" class="dropdown-item">Outstanding DSARs</a>
            @endcan
            @can('dsars.types.view')
                <a href="{{ route('dsars.types') }}" class="dropdown-item">DSAR Types</a>
            @endcan
        </div>
    </li>

    @can('sources.view')
        <li class="nav-item">
            <a class="nav-link" href="{{ route('print-queue.index') }}">
                Print Queue
            </a>
        </li>
    @endcan

    @can('users.view')
        <li class="nav-item dropdown">
            <a class="nav-link dropdown-toggle arrow-none" href="{{ route('admin.users.index') }}" role="button">
                <i class="uil-setting me-2"></i> Users
                <div class="arrow-down"></div>
            </a>

            <div class="dropdown-menu">
                @can('users.view')
                    <a href="{{ route('admin.users.index') }}" class="dropdown-item">Users</a>
                @endcan
                @can('roles.view')
                    <a href="{{ route('admin.roles.index') }}" class="dropdown-item">Roles</a>
                @endcan
                @can('permissions.view')
                    <a href="{{ route('admin.permissions.index') }}" class="dropdown-item">Permission Centre</a>
                @endcan
            </div>
        </li>
    @endcan


    {{-- Settings --}}
    <li class="nav-item dropdown">
        <a class="nav-link dropdown-toggle arrow-none" href="#" role="button">
            <i class="uil-setting me-2"></i> Settings
            <div class="arrow-down"></div>
        </a>

        <div class="dropdown-menu">
            <a href="{{ route('statuses.index') }}" class="dropdown-item">Claim Statuses</a>
            <a href="{{ route('tags.index') }}" class="dropdown-item">Tags</a>
            <a href="{{ route('doc-types.index') }}" class="dropdown-item">Document Types</a>
            <a href="{{ route('institution-types.index') }}" class="dropdown-item">Institution Types</a>
            <a href="{{ route('key-dates.index') }}" class="dropdown-item">Key Dates</a>
            <a href="{{ route('institution-record-types.index') }}" class="dropdown-item">Institution Record Types</a>
        </div>
    </li>

</ul>
