{{-- One staff member's Insulin / PEG / Dysphagia observations: upload a dated PDF, see the history. From ObservationRecordController@show / @mine: $worker, $types, $history, $missing (type => session not attended); $self = a care worker on their own page (no list to go back to, no removing). --}} @extends('layouts.app') @section('title', $worker->name.' — Observations') @section('content') @include('partials.flash') @php $role = auth()->user()->primaryRole(); $self = $self ?? false; $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 @unless($self) arrow_back All staff @endunless

{{ $self ? 'My Observations' : $worker->name }}

@if($errors->any())

{{ $errors->first() }}

@endif
@foreach($types as $type)

clinical_notes {{ \App\Models\ObservationRecord::TYPES[$type] }}

Add a previous observation or a new one — the latest date shows on the matrix. Renewed {{ \App\Models\ObservationRecord::renewalLabel($type) }}{{ $type === 'dysphagia' ? ', and again whenever the person’s dysphagia / eating & drinking plan changes' : '' }}.

@if($pre = \App\Models\ObservationRecord::PREREQUISITES[$type] ?? null) @if(isset($missing[$type]))

warning The {{ $pre }} face-to-face session is compulsory for this observation and {{ $self ? 'you haven’t' : $worker->name.' hasn’t' }} attended it yet{{ $self ? ' — ask your manager to book you on.' : ' — book them onto it from their compliance page.' }}

@else

check_circle {{ $pre }} session attended

@endif @endif
@if(! $self && in_array($type, \App\Models\ObservationRecord::DIGITAL, true)) @endif
@csrf
@forelse($history->get($type, collect()) as $rec)
{{ $rec->isDigital() ? 'fact_check' : 'picture_as_pdf' }}
{{ $rec->observed_at->format('j M Y') }} @if($rec->isNotCompetent()) Not yet competent · doesn’t count @elseif($rec->is($latestOk = $history->get($type, collect())->first(fn ($x) => ! $x->isNotCompetent()))) @php $state = $rec->state(); @endphp {{ $state === 'expired' ? 'Expired' : 'Latest' }} · {{ $state === 'expired' ? '' : 'renew by' }} {{ $rec->expiresOn()->format('j M Y') }} @endif @if($rec->isDigital()) Digital form · supporting {{ $rec->details['person_supported'] ?? '—' }} · assessed by {{ $rec->details['assessor'] ?? $rec->uploader?->name ?? 'unknown' }} @else {{ $rec->original_name }} · uploaded by {{ $rec->uploader?->name ?? 'unknown' }} @endif
@unless($self)
@csrf @method('DELETE')
@endunless
@empty

Nothing uploaded yet.

@endforelse
@endforeach
@endsection