@props(['note', 'encounter', 'notePool']) @php $statuses = \App\Modules\Consultations\Enums\NoteStatus::class; // Resolved from the versions already loaded for this encounter — walking // the relation would cost a query per version, per note. $history = \App\Modules\Consultations\Models\EncounterNote::chainFrom($note, $notePool); /* | The status enum reports a Bootstrap contextual name, because that is what | it was written against. Mapped here rather than changed there: the same | enum labels this note in the API and in the printed record. */ $pill = match ($note->status->tone()) { 'success' => 'px-pill--green', 'warning' => 'px-pill--amber', 'danger' => 'px-pill--red', 'primary', 'info' => 'px-pill--blue', default => 'px-pill--grey', }; @endphp
{{ $note->section->label() }} {{ $note->status->label() }} @if ($note->version > 1) {{ __('consultations::messages.notes.version', ['number' => $note->version]) }} @endif
@if ($note->isSigned()) {{ __('consultations::messages.notes.signed_by', [ 'name' => $note->author?->name ?? '—', 'date' => $note->signed_at->format('Y-m-d H:i'), ]) }} @else {{ $note->author?->name }} @endif
@if ($note->status === $statuses::Draft)
{{ __('consultations::messages.notes.draft_notice') }}
@endif @if ($note->amendment_reason && $note->status !== $statuses::Draft)
{{ $note->amendment_reason }}
@endif {{-- Whitespace preserved: clinicians format notes with line breaks. --}}
{{ $note->body }}
{{-- Earlier versions are shown, not hidden behind an audit screen nobody opens. "What did the record say before it was amended?" is a question a clinician asks in the room, and burying the answer defeats the purpose of keeping it. --}} @if ($history !== [])
{{ __('consultations::messages.notes.show_history') }} ({{ count($history) }}) @foreach ($history as $previous)
{{ __('consultations::messages.notes.version', ['number' => $previous->version]) }} · {{ $previous->author?->name }} · {{ $previous->signed_at?->format('Y-m-d H:i') }}
{{ $previous->body }}
@endforeach
@endif {{-- Three acts, three weights. Signing is the one this screen is for and takes the filled button; amending is ordinary and takes the quiet one; marking a note as entered in error is the destructive one and is the only thing here in red. --}}
@can('sign', $note)
@csrf
@endcan @can('amend', $note) @endcan @can('retract', $note) @endcan
@can('amend', $note)
@csrf
@endcan @can('retract', $note) {{-- The reason is the confirmation: a note leaves the record with a stated why, never on a single click. --}}
@csrf
@endcan