@php use App\Support\Auth; use App\Services\Cart; // The burger opens the left store-type rail (#qm-side). Every storefront page // renders that rail, so this defaults to true; the kiosk passes false when its // rail is switched off, so the button is never left controlling nothing. $sidebarEnabled = $sidebarEnabled ?? true; // Per-element header visibility (Admin -> Appearance -> Header). Every element defaults ON, // so an untouched install renders the full header; a switch turned off hides that element. $hEl = static fn (string $k): bool => setting('header_' . $k, '1') === '1'; // The delivery/pickup control is the one header element with a second condition: with the // platform not delivering there is no choice left to offer, so the switch is gone whatever // its own visibility setting says. Folded in here rather than at the two render sites so // desktop and mobile cannot drift apart. $hDelivery = \App\Services\Capability::has(\App\Services\Capability::DELIVERY); $u = Auth::user(); $cartCount = Cart::count(); $snap = Cart::snapshot(); // The mini-cart's money comes from the SAME method the /cart/update and /cart/remove // responses return, so stepping a quantity redraws the popover to figures that agree with // the ones it was painted with. Nothing here is computed in the browser. $cartTotals = \App\Http\Controllers\Public\CartController::totals(); $cartCur = setting('currency_symbol', '$'); $logo = setting('logo', 'assets/admin/logo.png'); $city = trim((string) (is_scalar($cityIn = request()->query('city')) ? $cityIn : '')); // A returning customer's location is pre-set from their default saved address, so // they don't have to type it every visit. An explicit ?city= search still wins. if ($city === '') { $defaultAddr = customer_default_address(); if ($defaultAddr !== null && trim((string) ($defaultAddr['city'] ?? '')) !== '') { $city = trim((string) $defaultAddr['city']); } } $avatar = $u['avatar'] ?? null; $firstName = $u ? explode(' ', (string) $u['name'])[0] : ''; // Current-language flag, shared by both the desktop switcher and the mobile- // drawer's language row so they show the same real flag, not a generic globe. $curFlag = count(available_languages()) > 1 ? lang_flag() : null; // Account-dropdown links (customer); adapted-to-food loyalty extras. The 4th // item is the accent-chip colour, grouped the same way as the account sidebar // (partials/account-nav.php) so the same icon reads the same everywhere. $acctLinks = [ ['/account/orders', 'fa-history', t_raw('header.acct_all_orders'), 'blue'], ['/account/orders?f=active', 'fa-clock', t_raw('header.acct_active_orders'), 'blue'], ['/account/orders?f=past', 'fa-check-circle', t_raw('header.acct_past_orders'), 'blue'], ['/account/reviews', 'fa-star-half-alt', t_raw('header.acct_my_reviews'), 'blue'], ['/account/favorites', 'fa-bookmark', t_raw('header.acct_saved'), 'pink'], ['/account/loyalty', 'fa-star', t_raw('header.acct_my_rewards'), 'amber'], ['/account/perks', 'fa-gem', t_raw('header.acct_perks'), 'amber'], ['/account', 'fa-user', t_raw('common.account'), 'teal'], ['/help', 'fa-question-circle', t_raw('header.acct_help'), 'teal'], ]; // Pages mega-menu: ONE consistent menu for every visitor — role/dashboard links // live in the account dropdown, not here. The side panel is an ad // (active_ad('mega_menu')) that falls back to full-width columns when none is // booked. The whole menu is admin-toggleable via the header_pages_menu setting. $showPagesMenu = setting('header_pages_menu', '1') === '1'; // The mega-menu trigger label is admin-editable (Admin -> Navigation); a blank value // falls back to the translated default so an unconfigured install still reads "Pages". $pagesLabel = trim((string) setting('header_pages_menu_label', '')); if ($pagesLabel === '') { $pagesLabel = t('header.pages'); } // Sourced from Admin -> Navigation so the header links to the buyer's OWN pages and // posts. Falls back to mega_menu_for() until a menu has been saved, so a fresh install // still ships a populated header rather than an empty one. $mega = \App\Services\Navigation::megaMenu($u); $megaCols = $mega['cols']; $megaFootCta = $mega['footCta']; // Both menu sources supply this now, so the header renders the operator's choice and never // decides on one of its own. $megaFootIcon = (string) $mega['footIcon']; $megaAd = active_ad('mega_menu'); // Only the legal pages that are actually published. Deleting one — or saving it as a draft — // used to leave its menu entry pointing at a 404. $megaFooter = []; foreach ([ ['privacy', t_raw('footer.privacy')], ['terms', t_raw('header.mega_terms')], ] as [$megaSlug, $megaLabel]) { if (cms_page_live($megaSlug)) { $megaFooter[] = [$megaLabel, url('/page/' . $megaSlug)]; } } // ---- Announcement band ----------------------------------------------------------------- // One line above the header on every storefront page: a closure, a public holiday, a promotion. // Two conditions, both of which must hold, and both of which remove the ELEMENT rather than hide // it — an empty bar pushing the header down is worse than no bar. // // 1. the switch on Appearance → Header. It ships OFF: nothing announced itself before this // existed, and an upgrade must not grow a band nobody wrote. // 2. words. The message is page content, so blank renders blank exactly as it does everywhere // else, and clearing the box is how an operator takes the announcement down for good. // // The link is optional on top of that, and needs BOTH a destination and something to call it — a // bare URL with no words is a link nobody can see, and words with no URL are a dead button. $tickerOn = setting('section_header_ticker_enabled', '0') === '1'; $tickerText = $tickerOn ? trim(t_raw('header.ticker_text')) : ''; $tickerLabel = ''; $tickerUrl = ''; if ($tickerText !== '') { $tickerLabel = trim(t_raw('header.ticker_link_label')); // pc_link() resolves a route through url() and refuses a scheme that is not one of ours, so a // value stored before PageContent::clean() existed still cannot become a script link here. $tickerUrl = trim(t_raw('header.ticker_link_url')) !== '' ? pc_link('header.ticker_link_url') : ''; } @endphp @if ($tickerText !== '')
{{ $tickerText }} @if ($tickerUrl !== '' && $tickerLabel !== '') {{ $tickerLabel }} @endif