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:
@@ -5,8 +5,10 @@ namespace App\Http\Controllers\Qms;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\ServiceQueue;
|
||||
use App\Services\Qms\DeviceService;
|
||||
use App\Services\Qms\KioskService;
|
||||
use App\Services\Qms\QueueEngine;
|
||||
use App\Services\Qms\TicketPresenter;
|
||||
use App\Support\OrganizationBranding;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
@@ -16,21 +18,31 @@ class KioskDeviceController extends Controller
|
||||
public function __construct(
|
||||
protected QueueEngine $engine,
|
||||
protected DeviceService $devices,
|
||||
protected KioskService $kiosk,
|
||||
) {}
|
||||
|
||||
public function show(Request $request): View
|
||||
{
|
||||
$device = $request->attributes->get('qms.device');
|
||||
$queues = ServiceQueue::query()
|
||||
->where('organization_id', $device->organization_id)
|
||||
->when($device->branch_id, fn ($q) => $q->where('branch_id', $device->branch_id))
|
||||
->where('is_active', true)
|
||||
->orderBy('name')
|
||||
->get();
|
||||
$device->loadMissing('organization');
|
||||
$queues = $this->kiosk->queuesFor($device);
|
||||
$settings = $this->kiosk->settings($device);
|
||||
$organization = $device->organization;
|
||||
|
||||
$this->devices->recordHeartbeat($device);
|
||||
|
||||
return view('qms.kiosk.device', compact('device', 'queues'));
|
||||
return view('qms.kiosk.device', [
|
||||
'device' => $device,
|
||||
'queues' => $queues,
|
||||
'settings' => $settings,
|
||||
'logoUrl' => $organization
|
||||
? OrganizationBranding::logoUrl($organization)
|
||||
: OrganizationBranding::assetUrl(),
|
||||
'logoAlt' => $organization
|
||||
? OrganizationBranding::logoAlt($organization)
|
||||
: 'Ladill Queue',
|
||||
'poweredByLogoUrl' => OrganizationBranding::assetUrl(OrganizationBranding::POWERED_BY_LOGO),
|
||||
]);
|
||||
}
|
||||
|
||||
public function issue(Request $request): JsonResponse
|
||||
@@ -45,8 +57,10 @@ class KioskDeviceController extends Controller
|
||||
'priority' => ['nullable', 'string'],
|
||||
]);
|
||||
|
||||
abort_unless($this->kiosk->queueAllowedForIssue($device, (int) $validated['queue_id']), 403);
|
||||
|
||||
$queue = ServiceQueue::findOrFail($validated['queue_id']);
|
||||
abort_unless($queue->organization_id === $device->organization_id, 403);
|
||||
abort_if($queue->is_paused || ! $queue->is_active, 422, 'This queue is not accepting tickets right now.');
|
||||
|
||||
$ticket = $this->engine->issueTicket($queue, $device->owner_ref, [
|
||||
'customer_name' => $validated['customer_name'] ?? null,
|
||||
|
||||
Reference in New Issue
Block a user