Add in-app Ladill Queue integration for service queue consoles.
Deploy Ladill Care / deploy (push) Successful in 37s
Deploy Ladill Care / deploy (push) Successful in 37s
Settings toggle provisions Queue org via API; reception staff manage counters without leaving Care. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -7,6 +7,7 @@ use App\Http\Controllers\Care\Concerns\ScopesToAccount;
|
||||
use App\Models\Branch;
|
||||
use App\Services\Care\AuditLogger;
|
||||
use App\Services\Care\CarePermissions;
|
||||
use App\Services\Queue\QueueClient;
|
||||
use App\Support\OrganizationBranding;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -39,7 +40,7 @@ class SettingsController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function update(Request $request): RedirectResponse
|
||||
public function update(Request $request, QueueClient $queue): RedirectResponse
|
||||
{
|
||||
$this->authorizeAbility($request, 'settings.manage');
|
||||
$organization = $this->organization($request);
|
||||
@@ -51,12 +52,26 @@ class SettingsController extends Controller
|
||||
'facility_type' => ['required', 'string', 'in:clinic,hospital,diagnostic,specialist'],
|
||||
'logo' => ['nullable', 'image', 'mimes:jpeg,png,jpg,webp,svg', 'max:2048'],
|
||||
'remove_logo' => ['nullable', 'boolean'],
|
||||
'queue_integration_enabled' => ['nullable', 'boolean'],
|
||||
]);
|
||||
|
||||
$settings = $organization->settings ?? [];
|
||||
$settings['onboarded'] = true;
|
||||
$settings['facility_type'] = $validated['facility_type'];
|
||||
|
||||
$wantsQueue = $request->boolean('queue_integration_enabled');
|
||||
$hadQueue = (bool) data_get($settings, 'queue_integration_enabled', false);
|
||||
$settings['queue_integration_enabled'] = $wantsQueue;
|
||||
|
||||
if ($wantsQueue && ! $hadQueue && $queue->configured()) {
|
||||
$branch = Branch::owned($owner)->where('organization_id', $organization->id)->orderBy('name')->first();
|
||||
try {
|
||||
$queue->enable($owner, $organization->name, $branch?->name);
|
||||
} catch (\Throwable) {
|
||||
return back()->withInput()->with('error', 'Could not provision Ladill Queue for this account. Ensure Queue API keys are configured and Queue allows Care integration.');
|
||||
}
|
||||
}
|
||||
|
||||
$logoPath = $organization->logo_path;
|
||||
|
||||
if ($request->boolean('remove_logo')) {
|
||||
|
||||
Reference in New Issue
Block a user