Visitor management app with SSO, kiosk, badges, reports, and Gitea CI deploy to frontdesk.ladill.com. Co-authored-by: Cursor <cursoragent@cursor.com>
74 lines
4.2 KiB
PHP
74 lines
4.2 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>
|
|
<div>
|
|
<label class="block text-sm font-medium">Type</label>
|
|
<select name="type" required class="mt-1 w-full rounded-lg border-slate-300 text-sm">
|
|
@foreach ($deviceTypes as $key => $label)
|
|
<option value="{{ $key }}" @selected(old('type', $device->type) === $key)>{{ $label }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
<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')
|
|
<a href="{{ route('frontdesk.kiosk.device', $device->device_token) }}" target="_blank" class="mt-2 inline-block text-sm text-teal-700 hover:underline">Open kiosk URL</a>
|
|
@endif
|
|
</div>
|
|
@endif
|
|
|
|
<div class="flex gap-3 pt-2">
|
|
<a href="{{ route('frontdesk.devices.index') }}" class="flex-1 rounded-lg border border-slate-200 py-2 text-center text-sm">Back</a>
|
|
<button type="submit" class="flex-1 rounded-lg bg-teal-600 py-2 text-sm font-semibold text-white">Save</button>
|
|
</div>
|
|
</form>
|
|
|
|
@if ($device->device_token)
|
|
<form method="POST" action="{{ route('frontdesk.devices.regenerate-token', $device) }}" class="mt-3">
|
|
@csrf
|
|
<button type="submit" class="text-sm text-amber-700 hover:underline" onclick="return confirm('Regenerate token? Existing kiosk sessions will stop working.')">Regenerate token</button>
|
|
</form>
|
|
@endif
|
|
|
|
<form method="POST" action="{{ route('frontdesk.devices.destroy', $device) }}" class="mt-4" onsubmit="return confirm('Remove this device?')">
|
|
@csrf @method('DELETE')
|
|
<button type="submit" class="text-sm text-red-600 hover:underline">Remove device</button>
|
|
</form>
|
|
</div>
|
|
</x-app-layout>
|