@extends('layouts.app') @section('title', 'Staff Management') @section('content') @include('partials.flash') @php $role = auth()->user()->primaryRole(); $selInput = 'py-2.5 pl-3 pr-8 bg-surface-container rounded-lg border-none focus:ring-2 focus:ring-primary/20 text-body-md outline-none'; $base = array_filter([ 'service' => $filters['serviceId'], 'sm' => $filters['smId'], 'login' => $filters['login'], 'q' => $filters['q'] !== '' ? $filters['q'] : null, 'unassigned' => $unassigned ? 1 : null, 'management' => $management ? 1 : null, ]); $hasFilters = ! empty(array_diff_key($base, ['unassigned' => 1, 'management' => 1])); @endphp
@if($management)

Your management team — the Service Managers and Team Leads of the homes you oversee, plus any Office Managers tied to you — with their login status. Send an onboarding email to anyone who hasn’t signed in yet.

@else

See who has — and hasn’t — signed in across your care homes. Click a name to view their compliance, or set a worker’s care home from the Care Home column.

@endif
{{-- Care workers / Unassigned / Management team toggle --}} @php $careMode = ! $unassigned && ! $management; @endphp
@php $chip = 'inline-flex items-center gap-1.5 px-3.5 py-2 rounded-lg text-label-md font-label-md'; @endphp groups All staff person_off Unassigned {{ $unassignedCount }} supervisor_account Management team {{ $managementCount }}
{{-- Summary tiles --}}
@php $tiles = [ [$unassigned ? 'Unassigned workers' : ($management ? 'Management team' : 'All staff'), $summary['total'], $management ? 'supervisor_account' : 'groups', 'text-on-surface'], ['Not logged in', $summary['never'], 'no_accounts', $summary['never'] > 0 ? 'text-error' : 'text-primary'], ['Logged in', $summary['active'], 'how_to_reg', 'text-primary'], ]; @endphp @foreach($tiles as [$label, $value, $icon, $color])
{{ $icon }}

{{ $value }}

{{ $label }}

@endforeach
{{-- Filters + export --}}
@if($unassigned)@endif @if($management)@endif @unless($unassigned || $management) @if($services->count() > 1)
@php $selName = $filters['serviceId'] ? optional($services->firstWhere('id', $filters['serviceId']))->name : null; @endphp
@endif @if($serviceManagers->isNotEmpty())
@endif @endunless @unless($unassigned)
@endunless @if($unassigned)
info Choose a care home in the table to place a worker. They’ll then move to Assigned staff.
@endif
@if($hasFilters) Clear @endif download Export CSV
{{-- Table (DataTables: client-side sort / search / paginate) --}}
@foreach($workers as $w) @php $isMgr = $w->is_manager ?? false; @endphp @if($isMgr) @else @endif @endforeach
Staff member Care home / role Service Manager / covers Last login Status Actions
@php $workerRoute = \Illuminate\Support\Facades\Route::has($role.'.compliance.worker') ? route($role.'.compliance.worker', ['worker' => $w, 'from' => 'staff']) : null; @endphp @if($workerRoute) {{ $w->name }} @else {{ $w->name }} @endif {{ $w->email }} {{ $w->role_label }} {{ $w->covers }} @php $canAssign = \Illuminate\Support\Facades\Route::has($role.'.worker.assign-location'); @endphp @if($canAssign)
@csrf
@else {{ $w->location?->name ?? '—' }} @endif
{{ $w->location?->serviceManager?->name ?? '—' }}{{ $w->last_login_at ? $w->last_login_at->format('j M Y, H:i') : '—' }} @if($w->last_login_at) how_to_reg Logged in @else no_accounts Not logged in @endif
edit Edit @unless($unassigned)
@csrf
@endunless
@endsection