Give the machine console its own session with PIN sign-in, make counters cumulative

The console under console/ has its own session cookie and console guard
(UseConsoleSession), so signing out or changing user there leaves the
normal interface alone. Links open it in a new window through a one-time
handoff key; a signed-out console asks for a PIN code or password on its
own login page. Users set their 4-6 digit PIN on the profile's PIN page,
and the console's change user dialog takes it on a keypad; five wrong
PINs lock PIN sign-in for 15 minutes.

Machine counters are cumulative: users record how much a job used and it
is added to the latest reading. A maintenance record restarts the whole
counter interval from the reading at the record.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-11-29 09:58:11 +02:00
co-authored by Claude Sonnet 5.5
parent 87e38260dc
commit 32c33e2a64
55 changed files with 1660 additions and 194 deletions
@@ -0,0 +1,40 @@
{{--
The fields of signing in with a console PIN code (spec 19.6), inside a
Livewire component that uses SignsInWithPin: the user's name as large
radio buttons, the PIN code and a number keypad for touch screens.
--}}
@props([
'users',
])
@php
$key = 'inline-flex min-h-14 items-center justify-center rounded-lg border border-zinc-500 bg-white text-2xl font-semibold text-zinc-900 hover:bg-zinc-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-700 dark:border-zinc-400 dark:bg-zinc-900 dark:text-zinc-100 dark:hover:bg-zinc-700 dark:focus-visible:outline-blue-400';
@endphp
<fieldset>
<legend class="mb-2 font-semibold">{{ __('users.pin_switch.user') }}</legend>
<div class="grid max-h-64 gap-2 overflow-y-auto sm:grid-cols-2">
@foreach ($users as $option)
<label wire:key="pin-user-{{ $option->id }}" class="flex min-h-11 cursor-pointer items-center gap-3 rounded-lg border border-zinc-300 px-3 py-2 has-checked:border-primary-600 has-checked:font-semibold dark:border-zinc-600 dark:has-checked:border-primary-400">
<input type="radio" name="pin-user" value="{{ $option->id }}" wire:model="userId" class="size-5 text-primary-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-700">
{{ $option->name }}
</label>
@endforeach
</div>
@error('userId')
<p role="alert" class="mt-1 text-sm font-medium text-red-700 dark:text-red-400">{{ $message }}</p>
@enderror
</fieldset>
<x-input id="pin-sign-in-pin" wire:model="pin" type="password" inputmode="numeric" maxlength="6" :label="__('users.pin_switch.pin')" autocomplete="off" />
<div class="grid grid-cols-3 gap-2" role="group" aria-label="{{ __('users.pin_switch.keypad') }}">
@foreach (['1', '2', '3', '4', '5', '6', '7', '8', '9'] as $digit)
<button type="button" class="{{ $key }}" x-on:click="if (($wire.pin ?? '').length < 6) $wire.pin = ($wire.pin ?? '') + '{{ $digit }}'">{{ $digit }}</button>
@endforeach
<button type="button" class="{{ $key }} text-base" x-on:click="$wire.pin = ''">{{ __('users.pin_switch.clear') }}</button>
<button type="button" class="{{ $key }}" x-on:click="if (($wire.pin ?? '').length < 6) $wire.pin = ($wire.pin ?? '') + '0'">0</button>
<button type="button" class="{{ $key }}" x-on:click="$wire.pin = ($wire.pin ?? '').slice(0, -1)" aria-label="{{ __('users.pin_switch.backspace') }}">
<x-icon name="backspace" class="size-7" aria-hidden="true" />
</button>
</div>