@php /** * Shared dashboard layout (vendor + admin). * Expects: $nav (array of ['label','url','icon','match']), $roleLabel, $heading. */ use App\Support\App; use App\Support\Auth; $u = Auth::user(); $cur = App::path(); // "View site": a vendor and everyone on their team — the floor staff AND the driver, all // staff-scope roles now — jump to their own storefront (the restaurant detail page); admins // (and any non-restaurant role) go to the marketplace home. Vendors/staff already carry // $restaurant; a driver resolves the slug from users.restaurant_id (the rider dashboard // isn't scoped to a single restaurant view). $viewSiteRole = (string) ($u['role'] ?? ''); $viewSiteBound = $viewSiteRole === 'vendor' || \App\Models\Role::isStaff($viewSiteRole); $viewSiteSlug = (string) ($restaurant['slug'] ?? ''); if ($viewSiteSlug === '' && $viewSiteBound && !empty($u['restaurant_id'])) { $viewSiteSlug = (string) \App\Models\Restaurant::query()->whereKey((int) $u['restaurant_id'])->value('slug'); } // With the front end switched off there is no site to view: every destination this link could // take (a restaurant page, or the home page) is one the router now refuses. An empty string means // "offer no link at all" — the three places that render it check before drawing, so a services // install never shows a door that leads nowhere. $viewSiteUrl = \App\Services\Capability::has(\App\Services\Capability::STOREFRONT) ? (($viewSiteBound && $viewSiteSlug !== '') ? url('/restaurant/' . $viewSiteSlug) : route('home')) : ''; @endphp
@php // The dashboard is a self-localized management UI (its own language switcher: English / Español / // العربية). Tell Chrome NOT to offer machine translation of it — otherwise data-driven controls // (e.g. a "Featured product" select listing a restaurant's whole Italian menu) make Chrome detect // the page as that language and pop the Translate bar. The public storefront (public.php) keeps // translation enabled, so a diner CAN still translate a foreign menu. @endphp @partial('head', ['title' => $heading ?? t_raw('nav.dashboard'), 'pageStyles' => $pageStyles ?? []]) @php // Pre-hide notices dismissed earlier this session BEFORE the body paints, so a dismissed // banner never flashes in then out on the next page. The click-to-dismiss behaviour lives in // qm-dismiss.js (end of body); this only suppresses the initial paint. @endphp {{ t_raw('common.skip_to_content') }} @php // Restore the collapsed-sidebar choice before first paint (desktop only) to avoid a layout flash. @endphp