Files
ladill-frontdesk/resources/views/frontdesk/devices/edit.blade.php
T
isaaccladandCursor 8f555bf2bf
Deploy Ladill Frontdesk / deploy (push) Successful in 43s
Replace native browser confirms with Ladill confirm dialogs.
Visits, devices, and admin destructive actions now use the shared modal UI.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-12 17:51:22 +00:00

111 lines
5.7 KiB
PHP

<x-app-layout title="Edit device">
<div class="mx-auto max-w-lg">
<h1 class="text-xl font-semibold text-slate-900">Edit device</h1>
<form method="POST" action="{{ route('frontdesk.devices.update', $device) }}" class="mt-6 space-y-4 rounded-2xl border border-slate-200 bg-white p-6">
@csrf @method('PUT')
<div>
<label class="block text-sm font-medium">Name</label>
<input type="text" name="name" value="{{ old('name', $device->name) }}" required class="mt-1 w-full rounded-lg border-slate-300 text-sm">
</div>
<x-frontdesk.device-type-field :device-types="$deviceTypes" :selected="$device->type" />
<div>
<label class="block text-sm font-medium">Status</label>
<select name="status" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
@foreach (['online', 'offline', 'maintenance'] as $status)
<option value="{{ $status }}" @selected(old('status', $device->status) === $status)>{{ ucfirst($status) }}</option>
@endforeach
</select>
</div>
<div>
<label class="block text-sm font-medium">Branch</label>
<select name="branch_id" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
<option value="">All branches</option>
@foreach ($branches as $branch)
<option value="{{ $branch->id }}" @selected(old('branch_id', $device->branch_id) == $branch->id)>{{ $branch->name }}</option>
@endforeach
</select>
</div>
<div>
<label class="block text-sm font-medium">Reception desk</label>
<select name="reception_desk_id" class="mt-1 w-full rounded-lg border-slate-300 text-sm">
<option value="">None</option>
@foreach ($desks as $desk)
<option value="{{ $desk->id }}" @selected(old('reception_desk_id', $device->reception_desk_id) == $desk->id)>{{ $desk->name }}</option>
@endforeach
</select>
</div>
@if ($device->device_token)
<div class="rounded-lg bg-slate-50 p-3">
<p class="text-xs font-medium uppercase text-slate-500">Device token</p>
<code class="mt-1 block break-all text-xs text-slate-700">{{ $device->device_token }}</code>
@if ($device->type === 'kiosk')
<x-btn
:href="route('frontdesk.kiosk.device', $device->device_token)"
target="_blank"
variant="link"
size="sm"
plain
class="mt-2"
>Open kiosk URL</x-btn>
@if (! empty($kioskQrSvg))
<div class="mt-4 rounded-xl border border-slate-200 bg-white p-4 text-center">
<p class="text-sm font-medium text-slate-900">Provision Ladill Kiosk app</p>
<p class="mt-1 text-xs text-slate-500">Scan with the tablet on first boot to link this device.</p>
<div class="mx-auto mt-3 inline-block">{!! $kioskQrSvg !!}</div>
</div>
@endif
@endif
</div>
@endif
<div class="flex gap-3 pt-2">
<x-btn href="{{ route('frontdesk.devices.index') }}" variant="secondary" class="flex-1 justify-center">Back</x-btn>
<x-btn type="submit" class="flex-1">Save</x-btn>
</div>
</form>
@if ($device->device_token)
<x-danger-zone title="Device actions" class="mt-4">
<x-confirm-dialog
:name="'regenerate-device-token-'.$device->id"
title="Regenerate token?"
message="Existing kiosk sessions will stop working until the device is reprovisioned."
:action="route('frontdesk.devices.regenerate-token', $device)"
confirm-label="Regenerate token"
variant="primary"
>
<x-slot:trigger>
<x-btn type="button" variant="warning">Regenerate token</x-btn>
</x-slot:trigger>
</x-confirm-dialog>
<x-confirm-dialog
:name="'remove-device-'.$device->id"
title="Remove this device?"
:action="route('frontdesk.devices.destroy', $device)"
method="DELETE"
confirm-label="Remove device"
>
<x-slot:trigger>
<x-btn type="button" variant="danger">Remove device</x-btn>
</x-slot:trigger>
</x-confirm-dialog>
</x-danger-zone>
@else
<x-danger-zone title="Device actions" class="mt-4">
<x-confirm-dialog
:name="'remove-device-'.$device->id"
title="Remove this device?"
:action="route('frontdesk.devices.destroy', $device)"
method="DELETE"
confirm-label="Remove device"
>
<x-slot:trigger>
<x-btn type="button" variant="danger">Remove device</x-btn>
</x-slot:trigger>
</x-confirm-dialog>
</x-danger-zone>
@endif
</div>
</x-app-layout>