@extends('layouts.dashboard') @section('content') @php /** * Vendor → Staff: the restaurant owner manages internal staff sub-accounts. * * @var array $staff array of rows: id, name, email, role, phone, status * (role: any staff role slug; status: active|suspended) * @var array $roles slug => label for every role a member may hold (from the roles table) */ $staff = $staff ?? []; $roles = $roles ?? []; // Only the owner may touch an account whose role can itself manage staff — the same rule // StaffController enforces on save and delete, mirrored here so the UI never offers an // action the server would refuse. $staffAdminRole = static fn (string $slug): bool => in_array('staff.manage', \App\Models\Role::permissionsFor($slug), true); // Only the owner may manage manager accounts; managers see manager rows read-only // and never get the "Manager" role option (server enforces this too). $isOwner = $isOwner ?? \App\Support\Auth::is('vendor'); // Re-fill values + field error when a save was rejected (modal auto-re-opens). $formData = $formData ?? []; $formError = (string) ($formError ?? ''); $reopen = $formError !== ''; $fd = static fn (string $k, string $def = ''): string => (string) ($formData[$k] ?? $def); // Filter-bar state (mirrors the admin Users page): role / status / search. $frole = $frole ?? ''; $fstatus = $fstatus ?? ''; $fq = $fq ?? ''; $hasFilters = $frole !== '' || $fstatus !== '' || $fq !== ''; @endphp @php /* .qm-d2: the dashboard density standard (app.css §35) */ @endphp