Wire Care lists into Ladill Queue workflows instead of reception panels.
Deploy Ladill Care / deploy (push) Successful in 1m45s

When Queue integration is on, role pages issue tickets into their own
department queues and drive Call next → Serve → Complete on the native
lists. Integration off leaves existing UI unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-17 16:27:48 +00:00
co-authored by Cursor
parent 15638d1672
commit 015a4cc7fe
38 changed files with 1857 additions and 196 deletions
+41 -9
View File
@@ -8,9 +8,10 @@ use App\Models\Appointment;
use App\Models\Branch;
use App\Models\Practitioner;
use App\Services\Care\AppointmentService;
use App\Services\Care\CareQueueBridge;
use App\Services\Care\CareQueueContexts;
use App\Services\Care\ConsultationService;
use App\Services\Care\OrganizationResolver;
use App\Services\Care\ServiceQueuePresenter;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
@@ -22,7 +23,7 @@ class QueueController extends Controller
public function __construct(
protected AppointmentService $appointments,
protected ConsultationService $consultations,
protected ServiceQueuePresenter $serviceQueues,
protected CareQueueBridge $queueBridge,
) {}
public function index(Request $request): View
@@ -85,16 +86,47 @@ class QueueController extends Controller
'canManageQueue' => $canManageQueue,
'canConsult' => $canConsult,
'heroStats' => $heroStats,
'serviceQueuePanel' => $this->serviceQueues->panel(
$request,
$organization,
$member,
'clinical',
$request->input('counter_uuid'),
),
'queueIntegration' => $branchId
? $this->queueBridge->listMeta($organization, CareQueueContexts::CONSULTATION, $branchId)
: ['enabled' => false],
]);
}
public function callNext(Request $request): RedirectResponse
{
$this->authorizeAbility($request, 'appointments.view');
$organization = $this->organization($request);
abort_unless($this->queueBridge->isEnabled($organization), 404);
$member = $this->member($request);
$branchScope = app(OrganizationResolver::class)->branchScope($member);
$branchId = (int) ($request->input('branch_id') ?: $branchScope);
abort_unless($branchId > 0, 422);
$result = $this->queueBridge->callNext($organization, CareQueueContexts::CONSULTATION, $branchId);
$ticket = $result['ticket'] ?? null;
if (! $ticket) {
return back()->with('error', 'No patients waiting in the consultation queue.');
}
return back()->with('success', 'Called '.$ticket['ticket_number'].' — '.($ticket['customer_name'] ?? 'patient').'.');
}
public function completeTicket(Request $request, Appointment $appointment): RedirectResponse
{
$this->authorizeAbility($request, 'consultations.manage');
$this->authorizeAppointment($request, $appointment);
$organization = $this->organization($request);
abort_unless($this->queueBridge->isEnabled($organization), 404);
$ticket = $this->queueBridge->complete($organization, $appointment);
if (! $ticket) {
return back()->with('error', 'Could not complete queue ticket.');
}
return back()->with('success', 'Completed '.$ticket['ticket_number'].'.');
}
public function start(Request $request, Appointment $appointment): RedirectResponse
{
$this->authorizeAbility($request, 'consultations.manage');