Files
ladill-care/resources/views/care/service-queues/_panel.blade.php
T
isaaccladandCursor dec282d25d
Deploy Ladill Care / deploy (push) Successful in 53s
Embed Ladill Queue on role pages and add specialty modules under Settings.
Remove the standalone Service Queues nav so call-next/now-serving lives on clinical queue, appointments, pharmacy, lab, and specialty surfaces; Pro orgs can activate dentistry and related modules with branch departments and queue stubs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 15:55:47 +00:00

146 lines
6.8 KiB
PHP

{{-- Compact Ladill Queue panel for role-native pages (not a standalone Service Queues nav). --}}
@php
$panel = $serviceQueuePanel ?? null;
@endphp
@if (! empty($panel['enabled']))
@php
$counterUuid = $panel['counter_uuid'] ?? null;
$state = $panel['state'] ?? null;
$counters = $panel['counters'] ?? [];
$current = $state['current_ticket'] ?? null;
$queues = $state['queues'] ?? [];
$waiting = $state['waiting_by_queue'] ?? [];
$counter = $state['counter'] ?? [];
$stubs = $panel['stubs'] ?? [];
$statusLabel = match ($current['status'] ?? null) {
'called' => 'Called',
'serving' => 'Serving',
'on_hold' => 'On hold',
default => $current['status'] ?? null,
};
@endphp
<section class="rounded-2xl border border-indigo-100 bg-gradient-to-br from-indigo-50/80 via-white to-white shadow-sm">
<div class="flex flex-wrap items-start justify-between gap-3 border-b border-indigo-100 px-5 py-4">
<div>
<p class="text-xs font-semibold uppercase tracking-wider text-indigo-600">Service counter</p>
<h2 class="mt-0.5 text-sm font-semibold text-slate-900">
{{ $counter['name'] ?? 'Ladill Queue' }}
@if (! empty($counter['branch']))
<span class="font-normal text-slate-500">· {{ $counter['branch'] }}</span>
@endif
</h2>
</div>
<div class="flex flex-wrap items-center gap-2">
@if (count($counters) > 1 && $counterUuid)
<form method="GET" class="flex items-center gap-2">
@foreach (request()->except('counter_uuid') as $key => $value)
@if (is_scalar($value))
<input type="hidden" name="{{ $key }}" value="{{ $value }}">
@endif
@endforeach
<select name="counter_uuid" class="rounded-lg border-slate-300 text-xs" onchange="this.form.submit()">
@foreach ($counters as $option)
<option value="{{ $option['uuid'] }}" @selected(($option['uuid'] ?? '') === $counterUuid)>{{ $option['name'] ?? 'Counter' }}</option>
@endforeach
</select>
</form>
@endif
@if ($counterUuid)
<a href="{{ route('care.service-queues.console', $counterUuid) }}" class="text-xs font-medium text-indigo-600 hover:text-indigo-800">Full console</a>
@endif
</div>
</div>
<div class="space-y-4 px-5 py-4">
@if (! empty($panel['error']))
<p class="rounded-lg bg-amber-50 px-3 py-2 text-sm text-amber-900">{{ $panel['error'] }}</p>
@endif
@if ($current && $counterUuid)
<div class="flex flex-wrap items-start justify-between gap-3">
<div>
<p class="text-xs font-medium uppercase tracking-wide text-slate-500">Now serving</p>
<p class="mt-1 text-3xl font-bold tracking-tight text-slate-900">{{ $current['ticket_number'] }}</p>
<p class="mt-1 text-sm text-slate-600">{{ $current['customer_name'] ?? 'Walk-in' }} · {{ $current['queue']['name'] ?? '' }}</p>
</div>
@if ($statusLabel)
<span class="rounded-full bg-indigo-100 px-2.5 py-1 text-xs font-semibold text-indigo-700">{{ $statusLabel }}</span>
@endif
</div>
<div class="flex flex-wrap gap-2">
@foreach ([
'start' => 'Start',
'complete' => 'Complete',
'recall' => 'Recall',
'skip' => 'Skip',
] as $action => $label)
<form method="POST" action="{{ route('care.service-queues.action', $counterUuid) }}">
@csrf
<input type="hidden" name="action" value="{{ $action }}">
<input type="hidden" name="ticket_uuid" value="{{ $current['uuid'] }}">
<button type="submit" class="{{ $action === 'complete' || $action === 'start' ? 'btn-primary' : 'btn-secondary' }} text-xs">{{ $label }}</button>
</form>
@endforeach
</div>
@elseif ($counterUuid)
<p class="text-sm text-slate-600">No active ticket. Call the next patient from a queue below.</p>
@elseif (count($stubs))
<div class="rounded-xl border border-dashed border-slate-200 bg-slate-50 px-4 py-3 text-sm text-slate-600">
<p class="font-medium text-slate-800">Specialty queues ready</p>
<ul class="mt-2 space-y-1 text-xs">
@foreach ($stubs as $stub)
<li>
{{ $stub['name'] ?? 'Queue' }}
@if (! empty($stub['branch_name'])) · {{ $stub['branch_name'] }} @endif
@if (! empty($stub['prefix']))
<span class="font-mono text-slate-500">({{ $stub['prefix'] }})</span>
@endif
@if (! empty($stub['synced']))
<span class="text-emerald-600">· linked</span>
@else
<span class="text-slate-400">· create in Queue admin if missing</span>
@endif
</li>
@endforeach
</ul>
</div>
@elseif (! $panel['error'])
<p class="text-sm text-slate-500">No counters found for this branch. Create counters in Queue admin, then refresh.</p>
@endif
@if ($counterUuid && count($queues))
<div class="grid gap-3 sm:grid-cols-2">
@foreach ($queues as $queue)
@php $waitingTickets = $waiting[$queue['uuid']] ?? []; @endphp
<div class="rounded-xl border border-slate-200 bg-white px-4 py-3">
<div class="flex items-center justify-between gap-2">
<div>
<p class="text-sm font-semibold text-slate-900">{{ $queue['name'] }}</p>
<p class="text-xs text-slate-500">{{ count($waitingTickets) }} waiting</p>
</div>
<form method="POST" action="{{ route('care.service-queues.action', $counterUuid) }}">
@csrf
<input type="hidden" name="action" value="call_next">
<input type="hidden" name="queue_uuid" value="{{ $queue['uuid'] }}">
<button type="submit" class="btn-primary text-xs">Call next</button>
</form>
</div>
@if (count($waitingTickets))
<ul class="mt-2 space-y-1 border-t border-slate-50 pt-2">
@foreach (array_slice($waitingTickets, 0, 3) as $ticket)
<li class="flex justify-between text-xs text-slate-600">
<span class="font-mono font-semibold text-slate-800">{{ $ticket['ticket_number'] }}</span>
<span class="truncate pl-2">{{ $ticket['customer_name'] ?? 'Walk-in' }}</span>
</li>
@endforeach
</ul>
@endif
</div>
@endforeach
</div>
@endif
</div>
</section>
@endif