@extends('layouts.app') @section('title', 'Users') @section('page-title', 'Users') @section('content') Manage system users, account status, and role assignments. {{-- Page Actions --}}
@can('users.create') Add User @endcan
{{-- Filters --}}
{{-- Search --}}
{{--
--}}
{{-- Role --}}
{{-- Status --}}
{{-- Filter Actions --}}
@if ( request()->filled('search') || request()->filled('role') || request()->filled('status') ) Reset @endif
{{-- Users --}}
{{-- Header --}}

System Users

Manage user accounts and their assigned system roles.

Total {{ $users->total() }}
@if ($users->count()) {{-- Desktop Table --}} {{-- Mobile / Tablet --}}
@foreach ($users as $user) @php $role = $user->roles->first(); $roleClasses = match ($role?->name) { 'Super Admin' => 'bg-purple-50 text-purple-700', 'Admin' => 'bg-sky-50 text-sky-700', 'Teacher' => 'bg-emerald-50 text-emerald-700', 'Parent' => 'bg-amber-50 text-amber-700', 'Student' => 'bg-indigo-50 text-indigo-700', default => 'bg-background text-muted', }; @endphp
{{-- Avatar --}}
{{ mb_substr($user->name, 0, 1) }}

{{ $user->name }}

@if (auth()->id() === $user->id) You @endif

{{ $user->email }}

@if ($role) {{ $role->name }} @else No Role @endif @if ($user->is_active) Active @else Inactive @endif

Created {{ $user->created_at?->format('d M Y') ?? '—' }}

@can('users.view') @endcan @can('users.edit') @endcan @can('users.delete') @if (auth()->id() !== $user->id)
@csrf @method('DELETE')
@endif @endcan
@endforeach
{{-- Pagination --}} @if ($users->hasPages())
{{ $users->links() }}
@endif @else {{-- Empty State --}}

@if ( request()->filled('search') || request()->filled('role') || request()->filled('status') ) No Users Found @else No Users Yet @endif

@if ( request()->filled('search') || request()->filled('role') || request()->filled('status') ) No users match the selected filters. Try changing or resetting your search criteria. @else Create your first system user and assign an appropriate role to control their access. @endif

@if ( request()->filled('search') || request()->filled('role') || request()->filled('status') ) Reset Filters @else @can('users.create') Add User @endcan @endif
@endif
{{-- Delete Confirmation --}} @endsection