Add self-service kiosk for queue ticket issuance.
Deploy Ladill Queue / deploy (push) Successful in 36s
Deploy Ladill Queue / deploy (push) Successful in 36s
Customers can pick a service, optionally enter details, and receive a ticket on a branded touchscreen flow with admin-configurable queues and auto-reset. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -56,6 +56,7 @@ class DeviceController extends Controller
|
||||
return view('qms.devices.create', [
|
||||
'organization' => $organization,
|
||||
'branches' => $branches,
|
||||
'queues' => ServiceQueue::owned($owner)->where('organization_id', $organization->id)->orderBy('name')->get(),
|
||||
'deviceTypes' => config('qms.device_types'),
|
||||
]);
|
||||
}
|
||||
@@ -70,8 +71,37 @@ class DeviceController extends Controller
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'type' => ['required', 'string', 'in:'.implode(',', array_keys(config('qms.device_types')))],
|
||||
'branch_id' => ['nullable', 'exists:queue_branches,id'],
|
||||
'queue_ids' => ['nullable', 'array'],
|
||||
'queue_ids.*' => ['integer', 'exists:queue_service_queues,id'],
|
||||
'collect_name' => ['nullable', 'boolean'],
|
||||
'collect_phone' => ['nullable', 'boolean'],
|
||||
'reset_seconds' => ['nullable', 'integer', 'min:5', 'max:120'],
|
||||
'welcome_message' => ['nullable', 'string', 'max:255'],
|
||||
]);
|
||||
|
||||
$config = null;
|
||||
if ($validated['type'] === 'kiosk') {
|
||||
$queueIds = array_map('intval', $validated['queue_ids'] ?? []);
|
||||
if ($queueIds !== []) {
|
||||
$allowed = ServiceQueue::owned($owner)
|
||||
->where('organization_id', $organization->id)
|
||||
->whereIn('id', $queueIds)
|
||||
->pluck('id')
|
||||
->all();
|
||||
$queueIds = array_values(array_intersect($queueIds, $allowed));
|
||||
}
|
||||
|
||||
$config = [
|
||||
'service_queue_ids' => $queueIds,
|
||||
'collect_name' => $request->boolean('collect_name'),
|
||||
'collect_phone' => $request->boolean('collect_phone'),
|
||||
'reset_seconds' => $validated['reset_seconds'] ?? 15,
|
||||
'welcome_message' => filled($validated['welcome_message'] ?? null)
|
||||
? $validated['welcome_message']
|
||||
: null,
|
||||
];
|
||||
}
|
||||
|
||||
$device = Device::create([
|
||||
'owner_ref' => $owner,
|
||||
'organization_id' => $organization->id,
|
||||
@@ -79,6 +109,7 @@ class DeviceController extends Controller
|
||||
'name' => $validated['name'],
|
||||
'type' => $validated['type'],
|
||||
'status' => 'offline',
|
||||
'config' => $config,
|
||||
]);
|
||||
|
||||
$token = $this->devices->generateToken($device);
|
||||
|
||||
Reference in New Issue
Block a user