Add queue kiosk and display devices for Care Queue management.
Deploy Ladill Care / deploy (push) Successful in 39s
Deploy Ladill Care / deploy (push) Successful in 39s
Register walk-up kiosks and waiting-room display devices under Devices, with public kiosk ticket issue and linked TV boards surfaced in sidebar and Queue shortcuts. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -33,14 +33,28 @@ class DeviceService
|
||||
public function issueToken(Device $device): string
|
||||
{
|
||||
$plain = $this->generateToken();
|
||||
$device->update(['device_token_hash' => $this->hashToken($plain)]);
|
||||
$meta = $device->metadata ?? [];
|
||||
if ($this->isQueueDeviceType($device->type)) {
|
||||
$meta['access_token'] = $plain;
|
||||
}
|
||||
|
||||
$device->update([
|
||||
'device_token_hash' => $this->hashToken($plain),
|
||||
'metadata' => $meta,
|
||||
]);
|
||||
|
||||
return $plain;
|
||||
}
|
||||
|
||||
public function revokeToken(Device $device): Device
|
||||
{
|
||||
$device->update(['device_token_hash' => null]);
|
||||
$meta = $device->metadata ?? [];
|
||||
unset($meta['access_token']);
|
||||
|
||||
$device->update([
|
||||
'device_token_hash' => null,
|
||||
'metadata' => $meta,
|
||||
]);
|
||||
|
||||
return $device->fresh();
|
||||
}
|
||||
@@ -66,6 +80,7 @@ class DeviceService
|
||||
public function defaultConnectionMode(string $type): string
|
||||
{
|
||||
return match ($type) {
|
||||
'kiosk', 'display' => Device::MODE_MANUAL,
|
||||
'barcode_scanner', 'qr_scanner' => Device::MODE_BROWSER_WEDGE,
|
||||
'badge_printer' => Device::MODE_MANUAL,
|
||||
'thermometer', 'bp_monitor', 'pulse_ox', 'weight_scale', 'lab_analyzer', 'agent' => Device::MODE_AGENT,
|
||||
@@ -73,6 +88,11 @@ class DeviceService
|
||||
};
|
||||
}
|
||||
|
||||
public function isQueueDeviceType(string $type): bool
|
||||
{
|
||||
return in_array($type, config('care.queue_device_types', []), true);
|
||||
}
|
||||
|
||||
public function typeRequiresPro(string $type): bool
|
||||
{
|
||||
return in_array($type, config('care.device_agent_types', []), true);
|
||||
@@ -80,6 +100,10 @@ class DeviceService
|
||||
|
||||
public function canRegisterType(Organization $organization, string $type, PlanService $plans): bool
|
||||
{
|
||||
if ($this->isQueueDeviceType($type)) {
|
||||
return $plans->hasPaidPlan($organization);
|
||||
}
|
||||
|
||||
if (! $this->typeRequiresPro($type)) {
|
||||
return true;
|
||||
}
|
||||
@@ -87,8 +111,23 @@ class DeviceService
|
||||
return $plans->hasPaidPlan($organization);
|
||||
}
|
||||
|
||||
public function publicAccessToken(Device $device): ?string
|
||||
{
|
||||
$token = $device->metadata['access_token'] ?? null;
|
||||
|
||||
return is_string($token) && $token !== '' ? $token : null;
|
||||
}
|
||||
|
||||
public function connectionHint(string $type, string $mode): string
|
||||
{
|
||||
if ($type === 'kiosk') {
|
||||
return 'Walk-up ticket kiosk. Open the public kiosk URL on a tablet in kiosk mode.';
|
||||
}
|
||||
|
||||
if ($type === 'display') {
|
||||
return 'Waiting-room / counter display. Opens the linked TV board URL on a screen or tablet.';
|
||||
}
|
||||
|
||||
return match ($mode) {
|
||||
Device::MODE_BROWSER_WEDGE => 'Works in the browser today as a USB keyboard wedge (scan into the focused field). No local agent required.',
|
||||
Device::MODE_AGENT => 'Needs the Care Device Agent on a local machine (serial / BLE / vendor SDK). Browser alone cannot talk to this hardware.',
|
||||
|
||||
Reference in New Issue
Block a user