Add in-app Ladill Queue integration for service queue consoles.
Deploy Ladill Frontdesk / deploy (push) Successful in 46s

Settings toggle provisions Queue org via API; reception can call tickets from Frontdesk.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-29 21:51:23 +00:00
co-authored by Cursor
parent 8e45bc1cfb
commit a715faf511
12 changed files with 372 additions and 1 deletions
@@ -17,10 +17,12 @@ class FrontdeskPermissions
'settings.view', 'admin.branches.view', 'admin.desks.view', 'admin.desks.manage',
'watchlist.view', 'watchlist.manage', 'audit.view', 'audit.export',
'devices.view', 'devices.manage', 'reports.view', 'reports.export',
'service_queues.console',
],
'receptionist' => [
'dashboard.view', 'visits.view', 'visits.manage', 'visitors.view', 'visitors.manage',
'hosts.view', 'employees.view', 'kiosk.use', 'watchlist.view', 'devices.view',
'service_queues.console',
],
'security_officer' => [
'dashboard.view', 'visits.view', 'visitors.view', 'employees.view',
+104
View File
@@ -0,0 +1,104 @@
<?php
namespace App\Services\Queue;
use Illuminate\Http\Client\RequestException;
use Illuminate\Support\Facades\Http;
class QueueClient
{
private function base(): string
{
return rtrim((string) config('frontdesk.queue.api_url'), '/');
}
private function token(): string
{
return (string) (config('frontdesk.queue.api_key') ?? '');
}
private function http(string $owner)
{
return Http::withToken($this->token())
->acceptJson()
->timeout(12)
->withQueryParameters(['owner' => $owner]);
}
public function configured(): bool
{
return $this->token() !== '' && $this->base() !== '';
}
/**
* @return array<string, mixed>
*/
public function status(string $owner): array
{
$response = $this->http($owner)->get($this->base().'/integrations/status');
$response->throw();
return (array) ($response->json('data') ?? []);
}
/**
* @return array<string, mixed>
*/
public function enable(string $owner, string $organizationName, ?string $branchName = null): array
{
$response = $this->http($owner)->post($this->base().'/integrations/provision', array_filter([
'organization_name' => $organizationName,
'branch_name' => $branchName,
'industry' => 'visitor',
]));
$response->throw();
return (array) ($response->json('data') ?? []);
}
public function isLinked(string $owner): bool
{
if (! $this->configured()) {
return false;
}
try {
$status = $this->status($owner);
return (bool) ($status['provisioned'] ?? false)
&& (bool) data_get($status, 'integrations.frontdesk', false);
} catch (RequestException) {
return false;
}
}
/**
* @return list<array<string, mixed>>
*/
public function counters(string $owner): array
{
$response = $this->http($owner)->get($this->base().'/counters');
$response->throw();
return (array) ($response->json('data') ?? []);
}
/**
* @return array<string, mixed>
*/
public function console(string $owner, string $counterUuid): array
{
$response = $this->http($owner)->get($this->base().'/counters/'.$counterUuid.'/console');
$response->throw();
return (array) ($response->json('data') ?? []);
}
/**
* @param array<string, mixed> $payload
*/
public function consoleAction(string $owner, string $counterUuid, array $payload): void
{
$this->http($owner)->post($this->base().'/counters/'.$counterUuid.'/console', $payload)->throw();
}
}