Files
2026-10-12 13:25:16 +01:00

32 lines
2.3 KiB
PHP

@extends('layouts.app')
@section('content')
<section class="portal-header">
<div><span class="eyebrow">Admin</span><h1>Users</h1><p class="lead compact">Manage portal accounts, access and customer licences.</p></div>
<a class="btn btn-secondary" href="{{ route('admin.index') }}">Admin dashboard</a>
</section>
<form method="get" class="card" style="display:flex;gap:10px;align-items:end;flex-wrap:wrap;margin-bottom:18px">
<label style="flex:1;min-width:240px">Search<input name="q" value="{{ request('q') }}" placeholder="Name or email"></label>
<label>Status<select name="status"><option value="">All users</option><option value="admin" @selected(request('status')==='admin')>Administrators</option><option value="suspended" @selected(request('status')==='suspended')>Suspended</option><option value="unverified" @selected(request('status')==='unverified')>Unverified</option></select></label>
<button>Search</button>
@if(request()->hasAny(['q','status']))<a class="btn btn-secondary" href="{{ route('admin.users.index') }}">Clear</a>@endif
</form>
<div class="admin-table-card">
<div class="admin-table-title"><div><h2>Portal users</h2><p>{{ $users->total() }} account{{ $users->total() === 1 ? '' : 's' }}</p></div></div>
<div class="table-scroll"><table class="pro-table"><thead><tr><th>User</th><th>Access</th><th>Email</th><th>Licences</th><th>Joined</th><th></th></tr></thead><tbody>
@forelse($users as $user)
<tr>
<td><strong>{{ $user->name }}</strong><small>#{{ $user->id }}</small></td>
<td>@if($user->disabled_at)<span class="status-chip muted">Suspended</span>@elseif($user->is_admin)<span class="status-chip">Admin</span>@else<span class="status-chip success">Active</span>@endif</td>
<td><strong>{{ $user->email }}</strong><small>{{ $user->hasVerifiedEmail() ? 'Verified' : 'Not verified' }}</small></td>
<td>{{ $licenseCounts[strtolower($user->email)] ?? 0 }}</td>
<td>{{ $user->created_at?->format('d M Y') }}</td>
<td><div class="table-actions"><a class="btn btn-secondary" href="{{ route('admin.users.show',$user) }}">Manage</a></div></td>
</tr>
@empty<tr><td colspan="6" class="empty-cell">No users found.</td></tr>@endforelse
</tbody></table></div>
</div>
<div style="margin-top:18px">{{ $users->links() }}</div>
@endsection