@php $pageTitle = match ($section) { 'workspace' => ($patientHeader['patient'] ?? null)?->fullName() ?: 'Workspace', 'history' => 'Visit history', 'billing' => 'Billing', 'visits' => 'Patient queue', default => 'Patient queue', }; @endphp
@if ($section === 'workspace')
@if (! empty($canAccessPatientQueue)) ← Back to queue @else @endif
@if ($moduleKey === 'dentistry') Reports @endif @if ($moduleKey === 'emergency') Reports @endif @if ($moduleKey === 'blood_bank') Reports @php $bbAdminMember = auth()->user() ? app(\App\Services\Care\OrganizationResolver::class)->memberFor(auth()->user(), $organization) : null; @endphp @if (app(\App\Services\Care\CarePermissions::class)->can($bbAdminMember, 'blood_bank.manage')) Admin @endif @endif @if ($moduleKey === 'ophthalmology') Reports @endif @if ($moduleKey === 'physiotherapy') Reports @endif @if ($moduleKey === 'womens_health') Reports @endif @if ($moduleKey === 'radiology') Reports @endif @if ($moduleKey === 'cardiology') Reports @endif @if ($moduleKey === 'psychiatry') Reports @endif @if ($moduleKey === 'pediatrics') Reports @endif @if ($moduleKey === 'orthopedics') Reports @endif @if ($moduleKey === 'ent') Reports @endif @if ($moduleKey === 'oncology') Reports @endif @if ($moduleKey === 'renal') Reports @endif @if ($moduleKey === 'surgery') Reports @endif @if ($moduleKey === 'vaccination') Reports @endif @if ($moduleKey === 'pathology') Reports @endif @if ($moduleKey === 'infusion') Reports @endif @if ($moduleKey === 'dermatology') Reports @endif @if ($moduleKey === 'podiatry') Reports @endif @if ($moduleKey === 'fertility') Reports @endif @if ($moduleKey === 'child_welfare') Reports @endif @if ($moduleKey === 'ambulance') Reports @endif History @if ($canManageClinical ?? $canManageSpecialty ?? true) Billing @endif
@if (($specialtyAccessLevel ?? 'manage') !== 'manage')
@if (($specialtyAccessLevel ?? '') === 'refer') You have view + refer access. You can review results and refer patients into this specialty queue; clinical editing is limited to specialists and supporting staff. @else You have view-only access. Results and history are available; clinical edits require specialty access. @endif
@elseif (($canManageSpecialty ?? false) && ! ($canConsult ?? false))
You can work this specialty floor (queue, vitals, billing support) but starting encounters and clinical chart edits require a clinician with consultation access.
@endif
@include('care.specialty.sections.workspace')
@include('care.partials.clinical-actions-panel', [ 'actionsView' => 'care.specialty.partials.actions-menu', 'title' => 'Actions', ])
@include('care.partials.clinical-actions-mobile', [ 'actionsView' => 'care.specialty.partials.actions-menu', 'title' => 'Actions', ]) @php $completeConsultation = ($canConsult ?? false) ? ($workspaceVisit?->appointment?->consultation ?? $workspaceVisit?->consultations?->firstWhere('status', '!=', \App\Models\Consultation::STATUS_COMPLETED)) : null; $prescribeConsultation = ($canPrescribe ?? false) ? ($workspaceVisit?->appointment?->consultation ?? $workspaceVisit?->consultations?->firstWhere('status', '!=', \App\Models\Consultation::STATUS_COMPLETED)) : null; @endphp @if ($completeConsultation && $completeConsultation->status !== \App\Models\Consultation::STATUS_COMPLETED) @endif @if ($prescribeConsultation && $prescribeConsultation->status !== \App\Models\Consultation::STATUS_COMPLETED)

New prescription

{{ ($workspaceVisit->patient ?? $prescribeConsultation->patient)?->fullName() }} @if (($workspaceVisit->patient ?? $prescribeConsultation->patient)?->patient_number) ({{ ($workspaceVisit->patient ?? $prescribeConsultation->patient)->patient_number }}) @endif

@include('care.prescriptions.partials.form', [ 'consultation' => $prescribeConsultation, 'routes' => config('care.medication_routes'), 'compact' => true, 'returnTo' => 'specialty', 'specialtyModule' => $moduleKey, 'specialtyVisit' => $workspaceVisit, ])
@endif @elseif ($section === 'history')

{{ $definition['nav_label'] ?? $definition['label'] ?? ucfirst($moduleKey) }} · Visit history

Completed encounters for this service line.

← Specialty home
@include('care.specialty.sections.history') @elseif ($section === 'billing')

{{ $definition['nav_label'] ?? $definition['label'] ?? ucfirst($moduleKey) }} · Billing

Service catalog for this module.

← Specialty home
@include('care.specialty.sections.billing') @else {{-- Queue home (overview / visits) — same UI as GP Queue --}}
@php $specialtyLabel = $definition['nav_label'] ?? $definition['label'] ?? ucfirst($moduleKey); @endphp

{{ $specialtyLabel }}

@if ($canManageQueue ?? false) Walk-in @endif
History @if ($canManageClinical ?? $canManageSpecialty ?? true) Billing @endif
@include('care.partials.queue-board', [ 'queue' => $queue, 'inConsultation' => $inConsultation, 'done' => $done ?? collect(), 'queueIntegration' => $queueIntegration ?? null, 'branchId' => $branchId, 'branchLabel' => $branchLabel ?? null, 'canConsult' => $canConsult ?? false, 'lockToPractitioner' => $lockToPractitioner ?? false, 'showFilters' => true, 'queueCallNextRoute' => ($canCallNext ?? $canManageSpecialty ?? false) ? 'care.specialty.call-next' : null, 'queueCallNextParams' => ['module' => $moduleKey], 'startRouteName' => 'care.queue.start', 'inCareLabel' => 'In care', 'openInCareUrl' => function ($appointment) use ($moduleKey) { if ($appointment->visit) { return route('care.specialty.workspace', [ 'module' => $moduleKey, 'visit' => $appointment->visit, ]); } return $appointment->consultation ? route('care.consultations.show', $appointment->consultation) : null; }, ])
@include('care.partials.clinical-actions-panel', [ 'actionsView' => 'care.specialty.partials.actions-menu', 'title' => 'Actions', ])
@include('care.partials.clinical-actions-mobile', [ 'actionsView' => 'care.specialty.partials.actions-menu', 'title' => 'Actions', ]) @endif