{{ trans('admin.employer_management') }}

{{ trans('admin.total_employers', ['department' => (auth()->user()->hasDepartment() && auth()->user()->isDepartmentAdmin() ? auth()->user()->getDepartment() . '\'s ' : ''), 'count' => $users->total()]) }}
@if (session('success')) @endif @if (session('error')) @endif @if (session('info')) @endif
@if (auth()->user()->isSuperAdmin())
@endif
{{ trans('admin.clear_filters') }}

@if (auth()->user()->hasDepartment() && auth()->user()->isDepartmentAdmin()) {{ auth()->user()->getDepartment() }}'s {{ trans('admin.employers') }} ({{ $users->total() }}) @endif

{{ $users->firstItem() ?? 0 }}-{{ $users->lastItem() ?? 0 }} of {{ $users->total() }}
@php $currentSort = request('sort'); $currentDir = strtolower(request('direction', 'asc')) === 'desc' ? 'desc' : 'asc'; function sortLink($col, $label) { $params = request()->all(); $dir = request('sort') === $col && strtolower(request('direction', 'asc')) === 'asc' ? 'desc' : 'asc'; $params['sort'] = $col; $params['direction'] = $dir; $url = request()->url() . '?' . http_build_query($params); $indicator = ''; if (request('sort') === $col) { $indicator = strtolower(request('direction', 'asc')) === 'desc' ? ' ▼' : ' ▲'; } return "{$label}{$indicator}"; } @endphp @foreach ($users as $user) @endforeach
{!! sortLink('name', trans('admin.employer')) !!} {!! sortLink('email', trans('main.email')) !!} {!! sortLink('department', trans('main.department')) !!} {!! sortLink('role', trans('admin.role')) !!} {!! sortLink('created_at', trans('admin.registered')) !!} {!! sortLink('is_active', trans('main.status')) !!} {{ trans('admin.actions') }}
{{ substr($user->name, 0, 2) }}
{{ $user->email }} {{ $user->getDepartment() }} @if ($user->isSuperAdmin()) {{ ucfirst($user->role) }} @elseif ($user->isDepartmentAdmin()) {{ trans('admin.admin') }} @else {{ trans('admin.employer') }} @endif
{{ $user->created_at->format('M d, Y') }}
{{ $user->created_at->diffForHumans() }}
@php $currentEmployerRow = auth()->user(); $canToggleRow = false; if ($currentEmployerRow) { if ($currentEmployerRow->isSuperAdmin()) { $canToggleRow = $currentEmployerRow->id !== $user->id && !$user->isSuperAdmin(); } elseif ($currentEmployerRow->isDepartmentAdmin()) { $canToggleRow = $currentEmployerRow->id !== $user->id && !$user->isSuperAdmin() && $user->isEmployer() && $user->department_id === $currentEmployerRow->department_id; } } $baseStatusClass = 'inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium'; $clickableClass = $canToggleRow ? ' cursor-pointer' : ' opacity-60 cursor-default'; $stateClass = isset($user->is_active) && $user->is_active ? ' bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200' : ' bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200'; @endphp @if ($user->isSuperAdmin()) {{ trans('admin.superadmin') }} @else @if (isset($user->is_active)) @if ($user->is_active) @else @endif {{ $user->is_active ? trans('admin.active') : trans('admin.suspended') }} @else {{ trans('admin.active') }} @endif @endif
{{ trans('admin.view') }} {{-- DEMOTE (only superadmin can demote department admins) --}} @if (auth()->user()->isSuperAdmin() && $user->isDepartmentAdmin()) @endif {{-- PROMOTE (only superadmin can promote non-admins) --}} @if (auth()->user()->isSuperAdmin() && !$user->isDepartmentAdmin() && auth()->id() !== $user->id && !$user->isSuperAdmin()) @endif {{-- TOGGLE STATUS: superadmin can toggle any user; department_admins can toggle employers in their department --}} @php $currentEmployer = auth()->user(); $canToggle = false; if ($currentEmployer) { if ($currentEmployer->isSuperAdmin()) { $canToggle = $currentEmployer->id !== $user->id && !$user->isSuperAdmin(); } elseif ($currentEmployer->isDepartmentAdmin()) { $canToggle = $currentEmployer->id !== $user->id && !$user->isSuperAdmin() && $user->isEmployer() && $user->department_id === $currentEmployer->department_id; } } @endphp @if ($canToggle)
@if ($users->count() === 0)

{{ trans('admin.no_users_found') }}

{{ trans('admin.no_users_match') }}

@endif
{{ $users->links() }}