Bring Frontdesk service-queue console to Queue handoff parity.
Deploy Ladill Frontdesk / deploy (push) Successful in 47s
Deploy Ladill Frontdesk / deploy (push) Successful in 47s
Match Care/Queue hand-off UX so visitors keep their ticket number across services. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -81,12 +81,30 @@ class ServiceQueueController extends Controller
|
||||
]);
|
||||
|
||||
try {
|
||||
$queue->consoleAction($owner, $counterUuid, $validated);
|
||||
} catch (RequestException) {
|
||||
return back()->with('error', 'Queue action failed. Try again.');
|
||||
$result = $queue->consoleAction($owner, $counterUuid, $validated);
|
||||
} catch (RequestException $e) {
|
||||
$message = $e->response?->json('message')
|
||||
?: $e->response?->json('error')
|
||||
?: 'Queue action failed. Try again.';
|
||||
|
||||
return back()->with('error', is_string($message) ? $message : 'Queue action failed. Try again.');
|
||||
}
|
||||
|
||||
return back()->with('success', 'Queue updated.');
|
||||
$success = match ($validated['action']) {
|
||||
'transfer' => sprintf(
|
||||
'Handed off %s to %s. Ticket number unchanged.',
|
||||
(string) ($result['ticket_number'] ?? 'ticket'),
|
||||
(string) data_get($result, 'queue.name', 'next queue'),
|
||||
),
|
||||
'call_next' => ! empty($result['ticket_number'])
|
||||
? "Called {$result['ticket_number']}."
|
||||
: 'No tickets waiting in that queue.',
|
||||
'available' => 'Counter marked available.',
|
||||
'offline' => 'Counter went offline.',
|
||||
default => 'Queue updated.',
|
||||
};
|
||||
|
||||
return back()->with('success', $success);
|
||||
}
|
||||
|
||||
protected function integrationEnabled(\App\Models\Organization $organization): bool
|
||||
|
||||
@@ -108,9 +108,13 @@ class QueueClient
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $payload
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function consoleAction(string $owner, string $counterUuid, array $payload): void
|
||||
public function consoleAction(string $owner, string $counterUuid, array $payload): array
|
||||
{
|
||||
$this->http($owner)->post($this->base().'/counters/'.$counterUuid.'/console', $payload)->throw();
|
||||
$response = $this->http($owner)->post($this->base().'/counters/'.$counterUuid.'/console', $payload);
|
||||
$response->throw();
|
||||
|
||||
return (array) ($response->json('data') ?? []);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user