@extends('layouts.app') @section('title', $encounter->reference) @php $statuses = \App\Modules\Consultations\Enums\NoteStatus::class; /* | 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 a badge on the day list and in the encounter listing, and | this screen's design language is not a reason to move it. */ $pill = fn (?string $tone): string => match ($tone) { 'success' => 'px-pill--green', 'warning' => 'px-pill--amber', 'danger' => 'px-pill--red', 'primary', 'info' => 'px-pill--blue', default => 'px-pill--grey', }; @endphp @section('content') {{-- ── Page head ──────────────────────────────────────────────────────── --}}

{{ $patient?->name ?? '—' }}

{{ $encounter->type->label() }} · {{ $encounter->started_at->format('d M Y, H:i') }}

{{-- Everything that identifies this consultation, on one line. --}}
{{ $encounter->status->label() }} {{ $encounter->reference }} @if ($patient) {{ $patient->mrn }} {{ $patient->ageLabel }} @endif @if ($doctor?->label()) {{ $doctor->label() }} @endif {{ $encounter->durationMinutes() }} min
{{-- The allergy warning, again, here. It is on the patient record and on the appointment list, and it belongs on the screen where somebody is about to decide on a treatment. Repetition is the correct behaviour for this one piece of information. --}} @if (($patient?->activeAllergyCount ?? 0) > 0)
{{ __('patients::messages.clinical.allergies') }} — {{ trans_choice(':count recorded|:count recorded', $patient->activeAllergyCount, ['count' => $patient->activeAllergyCount]) }}
@endif @if ($encounter->isOpen())
{{ __('consultations::messages.encounters.in_progress_notice') }}
@else
{{ __('consultations::messages.encounters.closed_notice') }}
@endif
{{-- ── What was said and written ──────────────────────────────────── --}}
@if ($encounter->chief_complaint) {{-- The reason the patient came, set apart from the notes: it is the one line every reader wants first. --}}
{{ __('consultations::messages.encounters.chief_complaint') }}
{{ $encounter->chief_complaint }}
@endif @php($notePool = $notes->keyBy('id')) @forelse ($notes->filter(fn ($n) => $n->status->isCurrent() || $n->status === $statuses::EnteredInError) as $note) @include('consultations::partials.note', [ 'note' => $note, 'encounter' => $encounter, 'notePool' => $notePool, ]) @empty {{-- The three empty states on this page were the last Bootstrap components in the module; the panels around them were already px. --}}

{{ __('consultations::messages.notes.empty') }}

{{ __('consultations::messages.notes.empty_text') }}

@endforelse
{{-- Writing a note is its own card: the one above is the record, this is the desk. --}} @can('writeNotes', $encounter)
@csrf
@error('body')
{{ $message }}
@enderror
{{-- Two ways to leave a note, and the difference matters: a draft can still be edited, a signed one can only be amended and keeps its history. --}}
@endcan
{{-- ── What was measured, found and done ──────────────────────────── --}}
{{-- Observations ------------------------------------------------ --}} @can('recordVitals', $encounter) @endcan @can('recordVitals', $encounter)
@csrf
@endcan @forelse ($encounter->vitals as $vital)
{{-- Each reading in a box of its own. A run of numbers in one line is read as a sentence; a clinician scanning for the blood pressure wants to find it by position. --}}
@foreach ([ ['BP', $vital->bloodPressure(), 'mmHg'], ['HR', $vital->pulse_bpm, 'bpm'], ['RR', $vital->respiratory_rate, 'rpm'], ['Temp', $vital->temperature_c ? $vital->temperature_c.'°' : null, 'C'], ['SpO₂', $vital->spo2, '%'], ['BMI', $vital->bmi, ''], ] as [$label, $value, $unit]) @if ($value)
{{ $label }} {{ $value }} @if ($unit){{ $unit }}@endif
@endif @endforeach
{{ $vital->recordedBy?->name }} · {{ $vital->measured_at->format('H:i') }} @if ($vital->hasReadingOutsideUsualRange()) {{-- Marked, not alarmed. A real early warning score is age-banded and context-dependent; this only draws the eye, and the clinician decides. --}} {{ __('consultations::messages.vitals.outside_range') }} @endif
@empty

{{ __('consultations::messages.vitals.empty') }}

{{ __('consultations::messages.vitals.empty_text') }}

@endforelse
{{-- Diagnoses --------------------------------------------------- --}} @can('diagnose', $encounter)
@csrf {{-- No ICD-10 field (removed 2026-08-10, after the same field went from the problem list). The column, the DTO, the validation rule and the API resource all remain: nothing already coded was lost, an integration still reads the field, and restoring the input is a one-line change. --}}
@endcan @forelse ($encounter->diagnoses as $diagnosis)
{{ $diagnosis->name }} @if ($diagnosis->is_primary) {{ __('consultations::messages.diagnoses.primary') }} @endif {{ $diagnosis->certainty->label() }} @if ($diagnosis->status_reason)
{{ $diagnosis->status_reason }}
@endif
@can('diagnose', $encounter) @if ($diagnosis->status !== 'entered_in_error') @endif @endcan
@can('diagnose', $encounter) {{-- The reason is the confirmation: a diagnosis is retracted with a note of why, never silently. --}}
@csrf
@endcan
@empty

{{ __('consultations::messages.diagnoses.empty') }}

{{ __('consultations::messages.diagnoses.empty_text') }}

@endforelse
{{-- Panels contributed by other modules — prescribing today, orders and billing later. This screen deliberately does not know which, so a clinic without the prescribing module sees nothing here and nothing on this page has to change when one is installed. --}} {{-- Close ------------------------------------------------------- --}} @can('close', $encounter)
@csrf
{{-- The one date on this screen, and the only official picker in the product. --}}
@endcan
@endsection