Files
ladill-queue/app/Http/Controllers/Qms/KioskDeviceController.php
T
isaaccladandCursor 4a608fedf2
Deploy Ladill Queue / deploy (push) Successful in 35s
Restyle Queue kiosk to match Frontdesk kiosk design.
Welcome screen, choice cards, form progress, and success state now follow the same lobby-tablet visual language with idle reset.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 23:31:29 +00:00

75 lines
2.6 KiB
PHP

<?php
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;
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');
$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', [
'device' => $device,
'organization' => $organization,
'queues' => $queues,
'settings' => $settings,
'logoUrl' => $organization
? OrganizationBranding::logoUrl($organization)
: OrganizationBranding::assetUrl(),
'logoAlt' => $organization
? OrganizationBranding::logoAlt($organization)
: 'Ladill Queue',
]);
}
public function issue(Request $request): JsonResponse
{
$device = $request->attributes->get('qms.device');
$this->devices->recordHeartbeat($device);
$validated = $request->validate([
'queue_id' => ['required', 'integer', 'exists:queue_service_queues,id'],
'customer_name' => ['nullable', 'string', 'max:255'],
'customer_phone' => ['nullable', 'string', 'max:50'],
'priority' => ['nullable', 'string'],
]);
abort_unless($this->kiosk->queueAllowedForIssue($device, (int) $validated['queue_id']), 403);
$queue = ServiceQueue::findOrFail($validated['queue_id']);
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,
'customer_phone' => $validated['customer_phone'] ?? null,
'priority' => $validated['priority'] ?? 'walk_in',
'source' => 'kiosk',
]);
return response()->json(['data' => TicketPresenter::toArray($ticket)]);
}
}