Files
Toiminnanohjaus/app/Modules/Users/Presentation/Livewire/⚡pin-switch.blade.php
T
petriandClaude Opus 5.5 f4b58f6b1d Darken the dark canvas, add customer colours, the ongoing status and the board model
- Dark theme page background is #5a5e60; text on it is lifted to zinc-200 /
  primary-100 and TallStackUI's dark labels, hints and checkbox labels are
  lightened so everything stays at 4.5:1.
- Shared HexColor picks white or black text by the higher WCAG contrast; a
  native-dialog colour picker and a large work dialog component.
- Customers get a header colour (customers.header_color), set on the
  customer page.
- New job status Jatkuvat / Kausi (ongoing): open, never late, billed
  monthly like running jobs.
- Kanban model: board columns and views, urgent threshold, per-user board
  preferences (density, column colours and sort), card positions, tasks of
  continuing jobs pinned to the board, MoveBoardCard and board queries with
  logged hours from TimeTracking.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-30 06:11:49 +02:00

84 lines
3.0 KiB
PHP

<?php
use App\Modules\Users\Application\UseCases\LoginPins;
use App\Modules\Users\Presentation\Http\Middleware\UseConsoleSession;
use App\Modules\Users\Presentation\Livewire\Concerns\SignsInWithPin;
use Livewire\Attributes\Locked;
use Livewire\Component;
/**
* "Vaihda käyttäjä" on a machine console (spec 19.6): the next user picks
* their name and types their own PIN code. The console has its own session
* (UseConsoleSession), so this changes only the console's user. Users
* without a PIN code sign in with their email and password on the
* console's sign-in page, back to the console.
*/
new class extends Component
{
use SignsInWithPin;
/**
* The console to return to, given by the console page.
*/
#[Locked]
public string $returnTo = '';
public function mount(string $returnTo): void
{
abort_unless(UseConsoleSession::isConsoleUrl($returnTo) && ! str_contains($returnTo, '?'), 404);
$this->returnTo = $returnTo;
}
public function switchUser(LoginPins $pins): void
{
if ($this->signInWithPin($pins)) {
$this->redirect($this->returnTo);
}
}
public function render(): mixed
{
return $this->view();
}
};
?>
@php
$touch = 'inline-flex min-h-11 min-w-11 items-center justify-center gap-2 rounded-lg px-4 py-2 font-medium focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 dark:focus-visible:outline-primary-300';
@endphp
<div>
<button
type="button"
id="pin-switch-open"
x-on:click="document.getElementById('pin-switch-dialog').showModal()"
class="{{ $touch }} border border-zinc-300 text-zinc-100 hover:bg-zinc-700"
>
<x-icon name="user-circle" class="size-6" aria-hidden="true" />
{{ __('machines.console.change_user') }}
</button>
<x-confirm-dialog id="pin-switch-dialog" :title="__('users.pin_switch.title')" class="text-base">
@if ($this->pinUsers === [])
<p>{{ __('users.pin_switch.no_users') }}</p>
@else
<form id="pin-switch-form" wire:submit="switchUser" class="space-y-4" novalidate>
<x-users.pin-fields :users="$this->pinUsers" />
</form>
@endif
<form method="POST" action="{{ route('console.logout') }}" class="mt-4 border-t border-zinc-300 pt-3 dark:border-zinc-600">
@csrf
<input type="hidden" name="return_to" value="{{ $returnTo }}">
<button type="submit" class="text-sm font-medium text-primary-700 underline hover:no-underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 dark:focus-visible:outline-primary-300 dark:text-primary-100">{{ __('users.pin_switch.with_password') }}</button>
</form>
<x-slot:actions>
@if ($this->pinUsers !== [])
<x-button wire:click="switchUser" icon="arrow-right-end-on-rectangle" :text="__('users.pin_switch.submit')" />
@endif
</x-slot:actions>
</x-confirm-dialog>
</div>