@extends('layouts.app') @section('title', $appointment->reference) @php use App\Modules\Appointments\Enums\AppointmentStatus; /* | The status enum names a Bootstrap contextual colour, because that is what | it was written against and the calendar still reads it. Mapped here rather | than renamed underneath everything that already uses it. */ $pill = static fn (string $bootstrapTone): string => match ($bootstrapTone) { 'success' => 'px-pill--green', 'warning' => 'px-pill--amber', 'danger' => 'px-pill--red', 'info' => 'px-pill--blue', 'primary' => 'px-pill--violet', default => 'px-pill--grey', }; /* | A status change is either the ordinary next step or the one that ends the | appointment badly. Cancelling and marking a no-show carry a reason and are | not undone, so they get the danger treatment; everything else is the | quiet default. */ $ending = [AppointmentStatus::Cancelled, AppointmentStatus::NoShow]; @endphp @section('content') {{-- ============================ IDENTITY ============================ --}}

{{ $patient?->name ?? __('appointments::messages.appointments.unknown_patient') }}

{{ $appointment->reference }} @if ($patient) {{ $patient->mrn }} @endif {{ $appointment->localStart()->isoFormat('dddd, D MMMM YYYY') }} {{ $appointment->source->label() }}
{{ $appointment->status->label() }} @if ($appointment->queue_number) {{ __('appointments::messages.appointments.queue_number') }} #{{ $appointment->queue_number }} @endif {{-- An allergy count belongs beside the patient's name, not three rows down a definition list. --}} @if ($patient !== null && $patient->activeAllergyCount > 0) {{ trans_choice('appointments::messages.appointments.allergy_count', $patient->activeAllergyCount, ['count' => $patient->activeAllergyCount]) }} @endif
{{-- This screen's own way back. Breadcrumbs are deliberately absent across the product, so a detail page reached from a listing carries a single explicit return instead. --}}
{{ __('appointments::messages.appointments.title') }}
{{ $appointment->localStart()->format('H:i') }} {{ __('appointments::messages.appointments.time') }} {{ $appointment->duration_minutes }} {{ __('appointments::messages.appointments.minutes') }}
{{ __('appointments::messages.appointments.patient') }}
@if ($patient !== null) {{ $patient->name }} {{ $patient->mrn }} @else — @endif
{{ __('appointments::messages.appointments.doctor') }}
{{ $doctor?->label() ?? '—' }}
{{ __('appointments::messages.appointments.time') }}
{{ $appointment->localStart()->format('H:i') }}–{{ $appointment->localEnd()->format('H:i') }} ({{ $appointment->timezone }})
{{ __('appointments::messages.appointments.reason') }}
{{ $appointment->reason ?: '—' }}
{{ __('appointments::messages.appointments.booked_by') }}
{{ $appointment->bookedBy?->name ?? '—' }}
@if ($appointment->cancelled_at)
{{ __('appointments::messages.appointments.cancellation_reason') }}
{{ $appointment->cancellation_reason ?: '—' }}
@endif
@if ($appointment->notes)

{{ $appointment->notes }}

@endif
{{-- Only the transitions the status machine actually permits are offered. An in-progress consultation shows Complete and nothing else — it cannot become a no-show, because the patient is demonstrably present. --}} @forelse ($transitions as $target)
@csrf @method('PATCH') @if (in_array($target, $ending, true))
@else @endif
@empty {{-- A finished appointment has nowhere left to go. Saying so is more useful than an empty panel. --}}

{{ $appointment->status->label() }}

{{ __('appointments::messages.appointments.no_transitions') }}

@endforelse
@endsection