@extends('layouts.dashboard') @section('content') @php /** @var array $rows @var array $pager @var string $frole @var string $fstatus @var int $frestaurant @var string $fq @var array $roles @var bool $archived @var array $restaurants @var array|null $form */ $frole = $frole ?? ''; $fstatus = $fstatus ?? ''; $frestaurant = (int) ($frestaurant ?? 0); $fq = $fq ?? ''; $roles = $roles ?? []; $archived = $archived ?? false; $restaurants = $restaurants ?? []; $form = $form ?? null; $hasFilters = $frole !== '' || $fstatus !== '' || $frestaurant > 0 || $fq !== ''; $statusOpts = [ 'active' => t_raw('common.status_active'), 'pending' => t_raw('common.status_pending'), 'suspended' => t_raw('common.status_suspended'), 'archived' => t_raw('admin.users.status_archived'), ]; // Roles that belong to one restaurant, supplied by the controller from the roles table // so a role created on the Roles screen behaves like the shipped ones here too. $staffRoles = $staffRoles ?? []; // Status is a read-only pill; suspending/reactivating lives in the row's // actions menu with the other account levers. Same map the account page uses. $statusPill = ['active' => 'qm-pill-green', 'pending' => 'qm-pill-amber', 'suspended' => 'qm-pill-red']; // Current filters, so the Export link carries the same view the admin is looking at. $qs = http_build_query(array_filter([ 'role' => $frole, 'status' => $fstatus, 'restaurant_id' => $frestaurant ?: '', 'q' => $fq, ], static fn ($v) => (string) $v !== '')); // PROTOTYPE (Users): the PAGE primary action moves into the top-bar "subheader" slot, // leaving the table card header for TABLE-scoped utilities (Export). The modal stays in // this view; its [data-user-new] handler is delegated on document, so the button fires // from the top bar unchanged. ob_start(); @endphp @php /* .qm-d2: the dashboard density standard (app.css §35) */ @endphp
| {{ t_raw('common.name') }} | {{ t_raw('admin.users.f_role') }} | {{ t_raw('common.restaurant') }} | {{ t_raw('common.status') }} | {{ t_raw('common.joined') }} | {{ t_raw('admin.users.col_last_active') }} | {{ t_raw('common.actions') }} |
|---|---|---|---|---|---|---|
|
{!! brandmark_html($u['avatar'] ?? null, (string) $u['name'], 'md', 'qm-brandmark--round') !!}
{{ $u['name'] }}
{{ $u['email'] }}
@php // Phone rides under the name rather than as its own column — one identity cell.
@endphp
@if (!empty($u['phone'])){{ $u['phone'] }}@endif
|
@php // What the account IS, in its own column — the identity cell keeps who it is.
@endphp
{!! role_pill($u['role']) !!} | @if (!empty($u['restaurant_name'])) {!! restaurant_brandmark(['logo' => $u['restaurant_logo'] ?? null, 'name' => $u['restaurant_name'], 'cuisine_slug' => $u['restaurant_cuisine'] ?? ''], 'sm') !!} {{ $u['restaurant_name'] }} @else {!! dash() !!} @endif | {{ status_label('user', $u['status']) }} | {!! fmt_datetime($u['created_at']) !!} | @if (!empty($u['last_active_at'])) {{ time_ago($u['last_active_at']) }} @else {{ t_raw('admin.users.never_signed_in') }} @endif | @php $isSelf = (int) $u['id'] === (int) \App\Support\Auth::id(); $isStaffRole = in_array((string) $u['role'], $staffRoles, true); if ($archived) { $rowActions = [ ['label' => t_raw('common.view'), 'icon' => 'fa-eye', 'href' => '/admin/users/' . (int) $u['id'], 'primary' => true], [ 'label' => t_raw('admin.users.action_restore'), 'icon' => 'fa-undo', 'form' => ['action' => '/admin/users/restore', 'fields' => ['id' => (int) $u['id']]], ], ]; } else { $rowActions = [ ['label' => t_raw('common.view'), 'icon' => 'fa-eye', 'href' => '/admin/users/' . (int) $u['id'], 'primary' => true], // Suspend/reactivate rides with the other account levers — an // inline switch beside the pill read as decoration and could not // say which way it would move the account. Reversible, no confirm // (the same contract the old switch honoured). Never for a super // admin — that account cannot be suspended from a list row. $isSuper ? null : [ 'label' => t_raw($isActive ? 'admin.users.action_suspend' : 'admin.users.action_activate'), 'icon' => $isActive ? 'fa-user-slash' : 'fa-user-check', 'form' => [ 'action' => '/admin/users/status', 'fields' => ['id' => (int) $u['id'], 'status' => $isActive ? 'suspended' : 'active'], ], ], // Support levers: end every session this account holds, and clear a // staff screen-lock PIN the member can no longer remember. $isSelf ? null : [ 'label' => t_raw('admin.users.action_sign_out'), 'icon' => 'fa-sign-out-alt', 'form' => [ 'action' => '/admin/users/sign-out', 'fields' => ['id' => (int) $u['id']], 'confirm' => t_raw('admin.users.confirm_sign_out', [':name' => (string) $u['name']]), ], ], $isStaffRole ? [ 'label' => t_raw('admin.users.action_reset_pin'), 'icon' => 'fa-key', 'form' => [ 'action' => '/admin/users/reset-pin', 'fields' => ['id' => (int) $u['id']], 'confirm' => t_raw('admin.users.confirm_reset_pin', [':name' => (string) $u['name']]), ], ] : null, $isSelf ? null : [ 'label' => t_raw('common.delete'), 'icon' => 'fa-trash-alt', 'danger' => true, 'form' => [ 'action' => '/admin/users/delete', 'fields' => ['id' => (int) $u['id']], 'confirm' => t_raw('admin.users.confirm_delete'), ], ], ]; } @endphp @partial('row-actions', ['actions' => $rowActions]) |