Sync Frontdesk queue integration flag with Ladill Queue on enable.
Deploy Ladill Frontdesk / deploy (push) Successful in 50s

Mirror Care fix so provision and settings keep frontdesk_enabled in sync.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-05 22:06:04 +00:00
co-authored by Cursor
parent f0a19e6e6f
commit 014976b757
3 changed files with 26 additions and 5 deletions
@@ -28,8 +28,17 @@ class ServiceQueueController extends Controller
try { try {
$counters = $queue->counters($owner); $counters = $queue->counters($owner);
} catch (RequestException) { } catch (RequestException $e) {
return redirect()->route('frontdesk.settings')->with('error', 'Could not reach Ladill Queue. Enable Frontdesk integration in Queue settings and verify API keys.'); if ($queue->configured() && $e->response?->status() === 403) {
try {
$queue->syncIntegration($owner, true);
$counters = $queue->counters($owner);
} catch (RequestException) {
return redirect()->route('frontdesk.settings')->with('error', 'Ladill Queue integration is not enabled. Save settings with Queue integration checked, and enable Frontdesk in Queue settings.');
}
} else {
return redirect()->route('frontdesk.settings')->with('error', 'Could not reach Ladill Queue. Enable Frontdesk integration in Queue settings and verify API keys.');
}
} }
return view('frontdesk.service-queues.index', compact('counters', 'organization')); return view('frontdesk.service-queues.index', compact('counters', 'organization'));
@@ -83,7 +83,7 @@ class SettingsController extends Controller
$hadQueue = (bool) data_get($settings, 'queue_integration_enabled', false); $hadQueue = (bool) data_get($settings, 'queue_integration_enabled', false);
$settings['queue_integration_enabled'] = $wantsQueue; $settings['queue_integration_enabled'] = $wantsQueue;
if ($wantsQueue && ! $hadQueue && $queue->configured()) { if ($wantsQueue && $queue->configured()) {
$branch = Branch::owned($owner)->where('organization_id', $organization->id)->orderBy('name')->first(); $branch = Branch::owned($owner)->where('organization_id', $organization->id)->orderBy('name')->first();
try { try {
$queue->enable($owner, $organization->name, $branch?->name); $queue->enable($owner, $organization->name, $branch?->name);
+14 -2
View File
@@ -46,11 +46,23 @@ class QueueClient
*/ */
public function enable(string $owner, string $organizationName, ?string $branchName = null): array public function enable(string $owner, string $organizationName, ?string $branchName = null): array
{ {
$response = $this->http($owner)->post($this->base().'/integrations/provision', array_filter([ $this->http($owner)->post($this->base().'/integrations/provision', array_filter([
'organization_name' => $organizationName, 'organization_name' => $organizationName,
'branch_name' => $branchName, 'branch_name' => $branchName,
'industry' => 'visitor', 'industry' => 'visitor',
])); ]))->throw();
return $this->syncIntegration($owner, true);
}
/**
* @return array<string, mixed>
*/
public function syncIntegration(string $owner, bool $enabled = true): array
{
$response = $this->http($owner)->patch($this->base().'/integrations', [
'frontdesk_enabled' => $enabled,
]);
$response->throw(); $response->throw();
return (array) ($response->json('data') ?? []); return (array) ($response->json('data') ?? []);