Files
ladill-care/resources/views/care/specialty/partials/actions-menu.blade.php
T
isaaccladandCursor 2cff8fdd6c
Deploy Ladill Care / deploy (push) Successful in 37s
Gate specialty modules by staff role with view and refer levels.
Give nurses, lab techs, pharmacists, and GPs broad access to day-to-day modules, keep restricted specialties for specialists (with support nurses), and let GPs view results or refer without full clinical edit.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-18 18:03:47 +00:00

138 lines
7.1 KiB
PHP

{{-- Specialty action buttons (desktop sticky + mobile sheet). --}}
@php
$btn = 'flex w-full items-center justify-center rounded-xl px-3 py-2.5 text-sm font-semibold transition';
$btnPrimary = $btn.' bg-indigo-600 text-white hover:bg-indigo-700';
$btnSecondary = $btn.' border border-slate-200 bg-white text-slate-800 hover:bg-slate-50';
$btnAccent = $btn.' border border-indigo-200 bg-indigo-50 text-indigo-900 hover:bg-indigo-100';
$onWorkspace = ($section ?? '') === 'workspace';
$appointment = $workspaceVisit?->appointment;
$openConsultation = $appointment?->consultation;
$ticketCalled = $appointment && $appointment->queue_ticket_status === 'called';
$canStartConsultation = $appointment && in_array($appointment->status, [
\App\Models\Appointment::STATUS_WAITING,
\App\Models\Appointment::STATUS_CHECKED_IN,
], true);
$consultationInProgress = $appointment
&& (
$appointment->status === \App\Models\Appointment::STATUS_IN_CONSULTATION
|| ($openConsultation && $openConsultation->status !== \App\Models\Consultation::STATUS_COMPLETED)
);
$canCompleteConsultation = $consultationInProgress
&& $openConsultation
&& $openConsultation->status !== \App\Models\Consultation::STATUS_COMPLETED;
$chartTab = collect($workspaceTabs ?? [])
->keys()
->first(fn ($key) => ! in_array($key, ['overview', 'timeline', 'plan', 'treat', 'notes', 'imaging', 'orders', 'billing', 'documents', 'perio', 'lab', 'recalls', 'vitals', 'disposition', 'observation'], true))
?: ($moduleKey === 'emergency' ? 'triage' : 'odontogram');
$stageFlow = $moduleKey === 'emergency'
? ($emergencyStageFlow ?? [
'arrival' => ['next' => 'treatment', 'label' => 'Move to treatment'],
'resus' => ['next' => 'treatment', 'label' => 'Move to treatment bay'],
'treatment' => ['next' => 'observation', 'label' => 'Move to observation'],
'observation' => ['next' => 'disposition', 'label' => 'Ready for disposition'],
])
: [
'waiting' => ['next' => 'chair', 'label' => 'Seat at chair'],
'chair' => ['next' => 'procedure', 'label' => 'Start procedure'],
'procedure' => ['next' => 'recovery', 'label' => 'Move to recovery'],
'recovery' => ['next' => 'completed', 'label' => 'Complete visit'],
];
$currentStage = $workspaceVisit?->specialty_stage;
@endphp
@if ($onWorkspace)
@include('care.partials.queue-ops', [
'queueIntegration' => $queueIntegration ?? null,
'queueCallNextRoute' => 'care.specialty.call-next',
'queueCallNextParams' => ['module' => $moduleKey],
'branchId' => $branchId ?? null,
'currentAppointmentId' => $appointment?->id,
])
@endif
@if ($ticketCalled && $appointment)
<form method="POST" action="{{ route('care.queue.recall', $appointment) }}" class="w-full" @click.stop>
@csrf
<button type="submit" class="{{ $btnAccent }}">Call again</button>
</form>
@endif
@if ($workspaceVisit)
@if (($canManageSpecialty ?? true) && $moduleKey === 'dentistry' && $currentStage && isset($stageFlow[$currentStage]))
<form method="POST" action="{{ route('care.specialty.dentistry.stage', $workspaceVisit) }}" class="w-full" @click.stop>
@csrf
<input type="hidden" name="stage" value="{{ $stageFlow[$currentStage]['next'] }}">
<button type="submit" class="{{ $btnAccent }}">{{ $stageFlow[$currentStage]['label'] }}</button>
</form>
@elseif (($canManageSpecialty ?? true) && $moduleKey === 'dentistry' && ! $currentStage)
<form method="POST" action="{{ route('care.specialty.dentistry.stage', $workspaceVisit) }}" class="w-full" @click.stop>
@csrf
<input type="hidden" name="stage" value="chair">
<button type="submit" class="{{ $btnAccent }}">Seat at chair</button>
</form>
@elseif (($canManageSpecialty ?? true) && $moduleKey === 'emergency' && $currentStage && isset($stageFlow[$currentStage]) && ($stageFlow[$currentStage]['next'] ?? null) !== $currentStage)
<form method="POST" action="{{ route('care.specialty.emergency.stage', $workspaceVisit) }}" class="w-full" @click.stop>
@csrf
<input type="hidden" name="stage" value="{{ $stageFlow[$currentStage]['next'] }}">
<button type="submit" class="{{ $btnAccent }}">{{ $stageFlow[$currentStage]['label'] }}</button>
</form>
@elseif (($canManageSpecialty ?? true) && $moduleKey === 'emergency' && ! $currentStage)
<form method="POST" action="{{ route('care.specialty.emergency.stage', $workspaceVisit) }}" class="w-full" @click.stop>
@csrf
<input type="hidden" name="stage" value="arrival">
<button type="submit" class="{{ $btnAccent }}">Start triage</button>
</form>
@endif
@if (($canManageSpecialty ?? true) && $canCompleteConsultation)
<button
type="button"
class="{{ $btnPrimary }}"
@click.stop="$dispatch('open-modal', {{ \Illuminate\Support\Js::from('complete-consultation-'.$openConsultation->id) }})"
>
Complete consultation
</button>
@endif
@if ($consultationInProgress)
<a href="{{ route('care.specialty.workspace', ['module' => $moduleKey, 'visit' => $workspaceVisit, 'tab' => $chartTab]) }}"
class="{{ $btnSecondary }}">
Open chart
</a>
@elseif (($canManageSpecialty ?? true) && $canStartConsultation)
<form method="POST" action="{{ route('care.specialty.consultation.start', ['module' => $moduleKey, 'visit' => $workspaceVisit]) }}" class="w-full" @click.stop>
@csrf
<button type="submit" class="{{ $btnPrimary }}">
{{ $actions['start'] ?? 'Start' }}
</button>
</form>
@endif
@if (($canReferSpecialty ?? false) && ! ($canManageSpecialty ?? true) && $workspaceVisit->patient)
<form method="POST" action="{{ route('care.specialty.refer', $moduleKey) }}" class="w-full space-y-2" @click.stop>
@csrf
<input type="hidden" name="patient_id" value="{{ $workspaceVisit->patient->id }}">
<input type="hidden" name="branch_id" value="{{ $workspaceVisit->branch_id }}">
<input type="text" name="reason" placeholder="Referral reason" class="w-full rounded-lg border border-slate-200 px-2 py-1.5 text-xs">
<button type="submit" class="{{ $btnAccent }}">Refer to specialty queue</button>
</form>
@endif
@if ($workspaceVisit->patient)
<a href="{{ route('care.patients.show', $workspaceVisit->patient) }}" class="{{ $btnSecondary }}">
Patient chart
</a>
@endif
@if ($workspaceVisit->appointment)
<a href="{{ route('care.appointments.show', $workspaceVisit->appointment) }}" class="{{ $btnSecondary }}">
Appointment
</a>
@endif
@endif
<a href="{{ route('care.queue.index') }}" class="{{ $btnSecondary }}">
Back to queue
</a>
<a href="{{ route('care.appointments.create') }}" class="{{ $btnAccent }}">
Register / book
</a>