{{-- Session Matrix (drill) — one home's care workers × training topics, each cell the worker's attendance (date attended, missed, or booked). From ManagementController@matrix (?service=ID&type=sessions): $service, $rows, $columns, $canArchive, $archivedWorkers --}} @extends('layouts.app') @section('title', $service->name . ' — Session Matrix') @section('content') @include('partials.flash') @if($noRequiredSessions ?? false)
info

No required sessions have been selected for {{ $service->name }} yet, so this matrix shows every session its staff have attended — including ones done for other services. Ask an admin to tick this service's sessions in Admin → Services → Edit → Required Training Sessions; the matrix will then show only those.

@endif @php $role = auth()->user()->primaryRole(); $matrixRoute = $role . '.compliance.matrix'; @endphp
arrow_back All services @include('management._matrix-type-toggle', ['matrixRoute' => $matrixRoute, 'active' => 'sessions', 'params' => ['service' => $service->id]])
co_present

{{ $service->name }}

{{ $rows->count() }} care {{ Str::plural('worker', $rows->count()) }} · {{ $columns->count() }} {{ Str::plural('topic', $columns->count()) }} · {{ $overall['pct'] }}% attended

picture_as_pdf PDF for CQC download Export CSV
{{-- Legend --}}
check_circle Attended (date) cancel Missed (no-show) event_upcoming Booked N/A Not booked medication Medication Competency Pack — required at every service Renewal due within 3 months (sessions & competency)
@if($columns->isEmpty())
event_busy

Nothing to show

No booked training sessions for workers at this service.

@else
@foreach($columns as $col) @endforeach @forelse($rows as $row) @foreach($row['cells'] as $i => $cell) @endforeach @empty @endforelse @foreach($columnStats as $cs) @endforeach
Care Worker
{{ \Illuminate\Support\Str::limit($col->title, 26) }}
%
@php $workerRoute = \Illuminate\Support\Facades\Route::has($role.'.compliance.worker') ? route($role.'.compliance.worker', $row['user']) : null; @endphp @if($workerRoute) {{ $row['user']->name }} @else

{{ $row['user']->name }}

@endif

{{ $row['user']->email }}

@if($canArchive) @endif
@if(isset($cell['competency'])) @php $date = $cell['date'] ? \Illuminate\Support\Carbon::parse($cell['date']) : null; $mcRoute = $role.(isset($cell['observation']) ? '.observations.show' : '.medication-competency.create'); $mcUrl = \Illuminate\Support\Facades\Route::has($mcRoute) ? route($mcRoute, $row['user']) : null; $tone = ! empty($cell['due']) ? 'text-[#C2410C]' : ['attended' => 'text-primary', 'no_show' => 'text-error', 'booked' => 'text-gold', 'required' => 'text-error'][$cell['status']]; @endphp {{ $date?->format('j M y') ?? ($cell['status'] === 'required' ? 'Required' : '—') }} {{ $cell['label'] }} @elseif(! $cell) N/A @else @php $date = $cell['date'] ? \Illuminate\Support\Carbon::parse($cell['date']) : null; @endphp @if($cell['status'] === 'attended' && ! empty($cell['due'])) {{ $cell['until']->format('j M y') }} renew by @elseif($cell['status'] === 'attended') {{ $date?->format('j M y') ?? '✓' }} attended @elseif($cell['status'] === 'no_show') {{ $date?->format('j M y') ?? '—' }} {{ ! empty($cell['not_done']) ? 'not done' : (! empty($cell['expired']) ? 'expired' : 'missed') }} @else {{ $date?->format('j M y') ?? 'booked' }} booked @endif @endif {{ $row['pct'] }}%
No care workers
Attended %{{ $cs['pct'] }}%{{ $overall['pct'] }}%
@endif {{-- Archived staff (RM + CEO/Admin) — same control as the e-learning matrix. --}} @if($canArchive)
inventory_2

Archived staff

{{ $archivedWorkers->count() }}

Temporarily removed from the matrix and compliance rating (long-term leave). Reinstate them on their return.

@if($archivedWorkers->isEmpty())

No archived staff at this service.

@else
@foreach($archivedWorkers as $worker)

{{ $worker->name }}

{{ \App\Models\User::ARCHIVE_REASONS[$worker->archived_reason] ?? 'Archived' }} · since {{ $worker->archived_at?->format('j M Y') }} @if($worker->archived_until) · due back {{ $worker->archived_until->format('j M Y') }} @endif @if($worker->archivedBy) · by {{ $worker->archivedBy->name }} @endif @if($worker->archived_note) — “{{ $worker->archived_note }}” @endif

@csrf
@endforeach
@endif
@include('management._archive-modal') @endif @endsection