@php /** * Staff screen-lock PIN pad, used in TWO presentations of the same markup: * - overlay (default): shown on the dashboard by assets/js/staff-lock.js after * $lockSeconds of inactivity; unchanged behaviour, but it now also engages the * SERVER lock (data-engage-url) so navigating away is bounced to the full page. * - full page ($fullpage=true): rendered by resources/views/vendor/lock-screen.blade.php as * the screen every request lands on while the `qm_locked` session flag is set. * * @var int $lockSeconds idle seconds before the overlay auto-locks (0 = disabled) * @var bool $fullpage render as the standalone full-page lock (default false) * @var string $home where the full-page unlock returns to (role landing) */ use App\Support\Auth; $u = Auth::user(); $role = $u['role'] ?? ''; $lockSeconds = (int) ($lockSeconds ?? 0); $fullpage = !empty($fullpage); $home = (string) ($home ?? '/'); if ($fullpage) { // The full-page lock always renders for a terminal staff member with a PIN. if (!staff_has_pin($u)) { return; } } else { // Overlay: unchanged — only for terminal staff with a PIN AND a positive idle // timeout configured by the owner. if (!\App\Models\Role::isStaff($role) || $lockSeconds <= 0 || empty($u['pin_hash'])) { return; } } $avatar = avatar_src($u['avatar'] ?? null); $name = (string) ($u['name'] ?? t_raw('dashboard.lock_name_fallback')); // The shipped roles name their department; anything created on the Roles screen shows its // own label rather than a generic fallback. $dept = ['kitchen_staff' => t_raw('dashboard.lock_dept_kitchen'), 'host_staff' => t_raw('dashboard.lock_dept_host'), 'waiter_staff' => t_raw('dashboard.lock_dept_waiter'), 'manager_staff' => t_raw('dashboard.lock_dept_manager')][$role] ?? ($role !== '' ? role_label($role) : t_raw('dashboard.lock_dept_fallback')); @endphp