Add service-point routing so call-next cannot steal assigned tickets.
Deploy Ladill Queue / deploy (push) Successful in 2m17s
Deploy Ladill Queue / deploy (push) Successful in 2m17s
Counters gain destination/staff metadata; tickets can be pre-assigned to a service point with assigned_only queues for healthcare while shared_pool preserves generic bank/government behavior. Display and announcements expose ticket, staff, and destination clearly for Care and public boards. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -58,17 +58,26 @@ class TicketController extends Controller
|
||||
'priority' => ['nullable', 'string', 'in:'.implode(',', array_keys(config('qms.ticket_priorities')))],
|
||||
'source' => ['nullable', 'string', 'in:'.implode(',', array_keys(config('qms.ticket_sources')))],
|
||||
'metadata' => ['nullable', 'array'],
|
||||
'assigned_counter_id' => ['nullable', 'uuid'],
|
||||
'assigned_counter_uuid' => ['nullable', 'uuid'],
|
||||
]);
|
||||
|
||||
$queue = ServiceQueue::where('uuid', $validated['service_queue_id'])->firstOrFail();
|
||||
$this->authorizeOwner($request, $queue);
|
||||
|
||||
$ticket = $this->engine->issueTicket($queue, $owner, [
|
||||
...$validated,
|
||||
'source' => $validated['source'] ?? 'api',
|
||||
'actor_ref' => $owner,
|
||||
'metadata' => $validated['metadata'] ?? null,
|
||||
]);
|
||||
try {
|
||||
$ticket = $this->engine->issueTicket($queue, $owner, [
|
||||
...$validated,
|
||||
'source' => $validated['source'] ?? 'api',
|
||||
'actor_ref' => $owner,
|
||||
'metadata' => $validated['metadata'] ?? null,
|
||||
'assigned_counter_uuid' => $validated['assigned_counter_uuid']
|
||||
?? $validated['assigned_counter_id']
|
||||
?? null,
|
||||
]);
|
||||
} catch (\RuntimeException $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 422);
|
||||
}
|
||||
|
||||
return response()->json(['data' => TicketPresenter::toArray($ticket)], 201);
|
||||
}
|
||||
@@ -108,6 +117,7 @@ class TicketController extends Controller
|
||||
'action' => ['required', 'string', 'in:recall,start,hold,skip,complete,no_show,cancel,delay,transfer'],
|
||||
'minutes' => ['nullable', 'integer', 'min:5', 'max:120'],
|
||||
'to_queue_id' => ['required_if:action,transfer', 'nullable', 'uuid'],
|
||||
'assigned_counter_id' => ['nullable', 'uuid'],
|
||||
'reason' => ['nullable', 'string', 'max:500'],
|
||||
]);
|
||||
|
||||
@@ -119,9 +129,25 @@ class TicketController extends Controller
|
||||
);
|
||||
$toQueue = ServiceQueue::where('uuid', $validated['to_queue_id'])->firstOrFail();
|
||||
$this->authorizeOwner($request, $toQueue);
|
||||
$result = $this->engine->transfer($ticket, $toQueue, null, $validated['reason'] ?? null, $actor);
|
||||
$assignTo = null;
|
||||
if (! empty($validated['assigned_counter_id'])) {
|
||||
$assignTo = \App\Models\Counter::where('uuid', $validated['assigned_counter_id'])->firstOrFail();
|
||||
$this->authorizeOwner($request, $assignTo);
|
||||
}
|
||||
try {
|
||||
$result = $this->engine->transfer(
|
||||
$ticket,
|
||||
$toQueue,
|
||||
null,
|
||||
$validated['reason'] ?? null,
|
||||
$actor,
|
||||
$assignTo,
|
||||
);
|
||||
} catch (\RuntimeException $e) {
|
||||
return response()->json(['message' => $e->getMessage()], 422);
|
||||
}
|
||||
|
||||
return response()->json(['data' => TicketPresenter::toArray($result->load(['serviceQueue', 'counter']))]);
|
||||
return response()->json(['data' => TicketPresenter::toArray($result->load(['serviceQueue', 'counter', 'assignedCounter']))]);
|
||||
}
|
||||
|
||||
$result = match ($validated['action']) {
|
||||
|
||||
Reference in New Issue
Block a user