{{-- Start a Medication Competency assessment for one care worker: full pack, annual refresher, or upload a previous paper record. Also lists their history. From MedicationCompetencyController@create: $worker, $state, $course (linked e-learning or null), $elearningDate, $canRefresh, $history --}} @extends('layouts.app') @section('title', 'Medication Competency Pack') @section('content') @include('partials.flash') @php use App\Support\MedicationCompetencyPack as Pack; $role = auth()->user()->primaryRole(); $r = fn ($n, $p = []) => route($role.'.medication-competency.'.$n, $p); [$cls, $icon, $label] = \App\Models\MedicationCompetency::stateBadge($state['state']); $cur = $state['current']; $choice = old('type', request('type', $errors->hasAny(['kind', 'assessed_at', 'file']) ? 'upload' : null)); $inputCls = 'w-full px-4 py-2.5 bg-surface-container rounded-lg border-none focus:ring-2 focus:ring-primary/20 text-body-md outline-none'; @endphp arrow_back All staff {{-- Who --}}
{{ $worker->name }}
{{ $worker->location?->name ?? '—' }} · {{ $worker->email }}
{{ $cur->status === 'competent' ? 'Valid until' : '' }} {{ $cur->expires_at->format('j M Y') }}
@endifWhat would you like to do?
@php $opts = [ 'full' => ['assignment', 'Full assessment', 'New staff, or anyone who has had a medication error. Three visits: visit 1 – assessment, knowledge and chosen competencies; visits 2 and 3 – an assessment each.', true], 'refresher' => ['autorenew', 'Annual refresher', $canRefresh ? 'Yearly spot check for staff already assessed as competent, with no medication error since.' : 'Available once they have a competent full assessment (or an uploaded record).', $canRefresh], 'upload' => ['upload_file', 'Upload a previous record', 'A paper competency assessment already completed — saved straight away.', true], ]; @endphp{{ $errors->editRecord->first() }}
@endif @forelse($history as $h) @php $hs = match ($h->status) { 'competent' => ['bg-primary/10 text-primary', 'Competent'], 'not_competent' => ['bg-error-container text-error', 'Not yet competent'], default => ['bg-gold/20 text-[#8a6d3b]', 'In progress'] }; @endphp{{ $h->typeLabel() }} {{ $hs[1] }}
{{ $h->assessed_at ? 'Assessed '.$h->assessed_at->format('j M Y') : 'Started '.$h->created_at->format('j M Y') }} @if($h->expires_at) · valid until {{ $h->expires_at->format('j M Y') }} @endif @if($h->signer) · signed off by {{ $h->signer->name }} @endif
No competency assessments recorded yet.
@endforelse