- Dark indigo header and tinted page background; the mobile main menu gets its own row, in the same order as the keyboard reaches it. - Page titles with an icon chip (x-page-title, x-page, x-page-header) and card sections (x-panel, the card utility); x-table styled as a card with an indigo header row in AppServiceProvider::styleTables(). - Job and task statuses, late work, unapproved hours and stock states as badges with icon and text (x-status-badge, x-jobs.status, x-jobs.task-status), never colour alone. - Empty lists as x-empty-state; dashboard quick link tiles, week hour bars and trend arrows; Kanban columns and task cards edged by status; calendar today column and bar accents; quick sale, reports and machine console restyled; signed-out pages show the app name. - Focus rings use the primary colour in both themes (white in the header). - Document the components in CLAUDE.md; test the status badges. Co-Authored-By: Claude Opus 5.5 <[email protected]>
84 lines
3.0 KiB
PHP
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-300">{{ __('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>
|