Deploy Ladill Care / deploy (push) Successful in 36s
Specialty homes now use the shared Waiting/In care board with Call next, Start routes specialty tickets into specialty workspaces, and redundant Dentistry/Specialty module chrome is removed. Co-authored-by: Cursor <cursoragent@cursor.com>
177 lines
11 KiB
PHP
177 lines
11 KiB
PHP
{{--
|
|
Shared Waiting | In care board (GP Queue + specialty Queue homes).
|
|
|
|
Expected vars:
|
|
- $queue, $inConsultation (collections of Appointment)
|
|
- $queueIntegration, $branchId
|
|
- $canConsult (bool)
|
|
- $queueCallNextRoute, $queueCallNextParams (optional — if set, Call next renders above board)
|
|
- $startRouteName (default care.queue.start) — route(name, $appointment)
|
|
- $openInCareUrl (callable Appointment $a): ?string — link for in-care Open
|
|
- $inCareLabel (default "In consultation")
|
|
- $lockToPractitioner, $canSwitchBranch, $branches, $practitioners, $practitionerId (filter bar)
|
|
- $showFilters (default true)
|
|
--}}
|
|
@php
|
|
$canConsult = $canConsult ?? false;
|
|
$showFilters = $showFilters ?? true;
|
|
$inCareLabel = $inCareLabel ?? 'In consultation';
|
|
$startRouteName = $startRouteName ?? 'care.queue.start';
|
|
$openInCareUrl = $openInCareUrl ?? function ($appointment) {
|
|
return $appointment->consultation
|
|
? route('care.consultations.show', $appointment->consultation)
|
|
: null;
|
|
};
|
|
$queueCallNextRoute = $queueCallNextRoute ?? null;
|
|
$queueCallNextParams = $queueCallNextParams ?? [];
|
|
@endphp
|
|
|
|
@if ($showFilters)
|
|
<form method="GET" class="flex flex-wrap gap-3 rounded-2xl border border-slate-200 bg-white p-4">
|
|
@if ($lockToPractitioner ?? false)
|
|
@if (($canSwitchBranch ?? false) && isset($branches) && $branches->count() > 1)
|
|
<select name="branch_id" class="rounded-lg border-slate-300 text-sm" onchange="this.form.submit()">
|
|
@foreach ($branches as $branch)
|
|
<option value="{{ $branch->id }}" @selected($branchId == $branch->id)>{{ $branch->name }}</option>
|
|
@endforeach
|
|
</select>
|
|
@elseif (isset($branches) && $branches->isNotEmpty())
|
|
<span class="flex items-center text-sm font-medium text-slate-700">{{ $branches->first()->name }}</span>
|
|
@elseif (! empty($branchLabel))
|
|
<span class="flex items-center text-sm font-medium text-slate-700">{{ $branchLabel }}</span>
|
|
@endif
|
|
<span class="flex items-center text-sm text-slate-500">Showing patients assigned to you</span>
|
|
@elseif ($canSwitchBranch ?? false)
|
|
<select name="branch_id" class="rounded-lg border-slate-300 text-sm" onchange="this.form.submit()">
|
|
@foreach ($branches as $branch)
|
|
<option value="{{ $branch->id }}" @selected($branchId == $branch->id)>{{ $branch->name }}</option>
|
|
@endforeach
|
|
</select>
|
|
<select name="practitioner_id" class="rounded-lg border-slate-300 text-sm">
|
|
<option value="">All practitioners</option>
|
|
@foreach ($practitioners as $practitioner)
|
|
<option value="{{ $practitioner->id }}" @selected($practitionerId == $practitioner->id)>{{ $practitioner->name }}</option>
|
|
@endforeach
|
|
</select>
|
|
<button type="submit" class="btn-primary">Filter</button>
|
|
@else
|
|
@if (isset($branches) && $branches->isNotEmpty())
|
|
<input type="hidden" name="branch_id" value="{{ $branchId }}">
|
|
<span class="flex items-center text-sm font-medium text-slate-700">{{ $branches->first()->name }}</span>
|
|
@elseif (! empty($branchLabel))
|
|
<span class="flex items-center text-sm font-medium text-slate-700">{{ $branchLabel }}</span>
|
|
@endif
|
|
@if (isset($practitioners))
|
|
<select name="practitioner_id" class="rounded-lg border-slate-300 text-sm">
|
|
<option value="">All practitioners</option>
|
|
@foreach ($practitioners as $practitioner)
|
|
<option value="{{ $practitioner->id }}" @selected($practitionerId == $practitioner->id)>{{ $practitioner->name }}</option>
|
|
@endforeach
|
|
</select>
|
|
<button type="submit" class="btn-primary">Filter</button>
|
|
@endif
|
|
@endif
|
|
</form>
|
|
@endif
|
|
|
|
@if ($queueCallNextRoute)
|
|
@include('care.partials.queue-ops', [
|
|
'queueIntegration' => $queueIntegration ?? null,
|
|
'queueCallNextRoute' => $queueCallNextRoute,
|
|
'queueCallNextParams' => $queueCallNextParams,
|
|
'branchId' => $branchId ?? null,
|
|
])
|
|
@endif
|
|
|
|
<div class="grid gap-6 lg:grid-cols-2">
|
|
<section class="rounded-2xl border border-slate-200 bg-white p-6">
|
|
<h2 class="text-sm font-semibold uppercase tracking-wide text-slate-500">Waiting ({{ $queue->count() }})</h2>
|
|
<div class="mt-4 space-y-3">
|
|
@forelse ($queue as $appointment)
|
|
<div @class([
|
|
'flex items-start justify-between gap-4 rounded-xl border p-4',
|
|
'border-indigo-200 bg-indigo-50/60' => ($appointment->queue_ticket_status ?? null) === 'called',
|
|
'border-emerald-200 bg-emerald-50' => ($appointment->queue_ticket_status ?? null) === 'serving',
|
|
'border-slate-100 bg-slate-50' => ! in_array($appointment->queue_ticket_status ?? null, ['called', 'serving'], true),
|
|
])>
|
|
<div class="min-w-0 flex-1 space-y-2">
|
|
@if (! empty($queueIntegration['enabled']) && $appointment->queue_ticket_number)
|
|
@include('care.partials.queue-ticket', [
|
|
'ticketNumber' => $appointment->queue_ticket_number,
|
|
'ticketStatus' => $appointment->queue_ticket_status,
|
|
'destination' => $appointment->queue_destination,
|
|
'staffDisplayName' => $appointment->queue_staff_display_name,
|
|
])
|
|
@elseif (! empty($queueIntegration['enabled']) && ($appointment->queue_routing_status ?? '') === 'unresolved')
|
|
<span class="inline-flex rounded-full bg-amber-100 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-amber-800">Unassigned</span>
|
|
@elseif ($appointment->queue_position)
|
|
<span class="inline-flex h-7 w-7 items-center justify-center rounded-full bg-sky-100 text-xs font-bold text-sky-700">{{ $appointment->queue_position }}</span>
|
|
@endif
|
|
|
|
<div class="min-w-0">
|
|
<p class="truncate text-base font-semibold text-slate-900">{{ $appointment->patient?->fullName() ?? 'Patient' }}</p>
|
|
<p class="mt-0.5 truncate text-xs text-slate-500">{{ $appointment->patient?->patient_number ?? '—' }} · {{ $appointment->reason ?? '—' }}</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex shrink-0 flex-wrap items-center justify-end gap-2">
|
|
@if (! empty($queueIntegration['enabled']) && $appointment->queue_ticket_uuid && in_array($appointment->queue_ticket_status ?? '', ['called', 'serving'], true) && $canConsult)
|
|
<form method="POST" action="{{ route('care.queue.recall', $appointment) }}">
|
|
@csrf
|
|
<button type="submit" class="rounded-lg border border-indigo-200 bg-indigo-50 px-3 py-1.5 text-xs font-medium text-indigo-700 hover:bg-indigo-100">Call again</button>
|
|
</form>
|
|
@endif
|
|
@if ($canConsult)
|
|
<form method="POST" action="{{ route($startRouteName, $appointment) }}">
|
|
@csrf
|
|
<button type="submit" class="rounded-lg bg-sky-600 px-3 py-1.5 text-xs font-medium text-white hover:bg-sky-700">
|
|
{{ ! empty($queueIntegration['enabled']) && ($appointment->queue_ticket_status ?? '') === 'called' ? 'Serve & start' : 'Start' }}
|
|
</button>
|
|
</form>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
@empty
|
|
<p class="text-sm text-slate-500">No patients waiting.</p>
|
|
@endforelse
|
|
</div>
|
|
</section>
|
|
|
|
<section class="rounded-2xl border border-slate-200 bg-white p-6">
|
|
<h2 class="text-sm font-semibold uppercase tracking-wide text-slate-500">{{ $inCareLabel }} ({{ $inConsultation->count() }})</h2>
|
|
<div class="mt-4 space-y-3">
|
|
@forelse ($inConsultation as $appointment)
|
|
<div class="flex items-start justify-between gap-4 rounded-xl border border-emerald-100 bg-emerald-50 p-4">
|
|
<div class="min-w-0 flex-1 space-y-2">
|
|
@if (! empty($queueIntegration['enabled']) && $appointment->queue_ticket_number)
|
|
@include('care.partials.queue-ticket', [
|
|
'ticketNumber' => $appointment->queue_ticket_number,
|
|
'ticketStatus' => $appointment->queue_ticket_status,
|
|
'showAssignment' => false,
|
|
])
|
|
@endif
|
|
<div class="min-w-0">
|
|
<p class="truncate text-base font-semibold text-slate-900">{{ $appointment->patient?->fullName() ?? 'Patient' }}</p>
|
|
<p class="mt-0.5 truncate text-xs text-slate-500">{{ $appointment->practitioner?->name ?? 'Unassigned' }}</p>
|
|
</div>
|
|
</div>
|
|
<div class="flex shrink-0 flex-wrap items-center justify-end gap-2">
|
|
@if (! empty($queueIntegration['enabled']) && $appointment->queue_ticket_uuid && in_array($appointment->queue_ticket_status ?? '', ['called', 'serving'], true) && $canConsult)
|
|
<form method="POST" action="{{ route('care.queue.recall', $appointment) }}">
|
|
@csrf
|
|
<button type="submit" class="rounded-lg border border-indigo-200 bg-indigo-50 px-3 py-1.5 text-xs font-medium text-indigo-700 hover:bg-indigo-100">Call again</button>
|
|
</form>
|
|
@endif
|
|
@php $openUrl = $openInCareUrl($appointment); @endphp
|
|
@if ($openUrl)
|
|
<a href="{{ $openUrl }}" class="text-sm font-medium text-sky-600 hover:text-sky-700">Open</a>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
@empty
|
|
<p class="text-sm text-slate-500">No active encounters.</p>
|
|
@endforelse
|
|
</div>
|
|
</section>
|
|
</div>
|