@php /** * Dashboard top bar — the fixed chrome header: the sidebar toggle + page title on the left, and on * the right the branch switcher, full-screen toggle, language menu, AI assistant, notification bell * and the account menu. Extracted from layouts/dashboard.php so the top bar is its own component; * included via partial('top-bar', [...]). All display data is passed in (View::partial isolates scope). * * @var array|null $u the signed-in user row * @var string|null $heading page heading — shown as the H1 only when the title is NOT in the subheader * @var string $roleLabel the user's role label (e.g. "Restaurant vendor") * @var string $viewSiteUrl the "View site" destination for this role * @var bool $__titleInSubhead true when the page title lives in the subheader band, not here */ @endphp
@if (!$__titleInSubhead)

{{ $heading ?? t_raw('nav.dashboard') }}

@endif
@php // Branch switcher — a multi-branch owner re-points the WHOLE dashboard at any of their venues // from any page (the same session switch as the Branches page), then lands back on the current // page. Built on the account-menu shell (.qm-account) so the trigger + menu inherit our own // styling: the restaurant logo + name sit exactly like the user avatar beside it. // // Shown to every owner, including one running a single venue. This menu holds the only // "Add another location" link in the product, so requiring two venues to see it left the // owner who wants a second one with no way to ask for it. With one venue the list is simply // that single row (marked active) above the same two links - same markup, same styling, // nothing to switch to yet. $__branches = \App\Support\Auth::ownedRestaurants(); @endphp @if ($__branches) @php $__activeRid = (int) \App\Support\Auth::vendorRestaurantId(); $__activeRow = $__branches[0] ?? []; foreach ($__branches as $__b) { if ((int) $__b['id'] === $__activeRid) { $__activeRow = $__b; break; } } $__ret = \App\Support\App::path(); @endphp @endif @php // Full-screen focus mode — expands the page content to the whole screen and hides the chrome (useful for the Kitchen Pipeline / dine-in floor displays). Escape or the floating exit button returns. @endphp @if (count(available_languages()) > 1) @endif @php // AI assistant — opens the chat off-canvas (right → left). Anyone granted the assistant // reaches their restaurant one; super-admin the platform one. Restaurants only while // the platform leaves ai_vendor_enabled on. @endphp @if (($u['role'] ?? '') === 'super_admin' || (\App\Support\Auth::can('ai.use') && setting('ai_vendor_enabled', '1') === '1')) @endif @php // Notification bell — the same per-user bell as the storefront, sitting before the avatar. @endphp @partial('notif-bell')