@php /** * Notification settings (preferences) card — reused on the account pages of every * role and, for staff sub-accounts that have no account page, inline on their * notifications page. Self-contained: derives the user's preferences + role itself. * Posts to /notifications/prefs which redirects back to the hosting page. * * $returnTab — optional id of the tab panel hosting this card. A browser never sends * the fragment in the Referer, so a host that shows this inside a tab must name it or * the save bounces the member back to the first tab and loses their place. Left empty * on the pages where this card is not tabbed. * * Each row reads label-first with the switch right-aligned, and each category carries * its own accent chip so the card matches the chip treatment used by every other * dashboard card title. The chip is an carrying both the glyph and the chip * classes (the form used in the account menu and account nav) rather than the usual * wrapper, because `.qm-switch-row span` styles the row's text block as a flex * column and would otherwise capture the chip as well. */ $prefs = $prefs ?? notification_prefs((int) \App\Support\Auth::id()); $role = $role ?? (string) (\App\Support\Auth::user()['role'] ?? ''); $cats = notification_categories(); $returnTab = $returnTab ?? ''; // Hosts that already title the region above this card pass false; the default keeps the // heading, which is load-bearing wherever the card sits inside a tab panel. $showHeading = $showHeading ?? true; // Accent per category, so a member learns the colour alongside the name. $catAccent = [ 'orders' => 'blue', 'deliveries' => 'violet', 'reservations' => 'amber', 'platform' => 'teal', 'system' => 'slate', 'account' => 'green', ]; @endphp
@php // Hosted in a tab (account page / staff inbox): use the shared card-head so this // matches the Profile tab. On the customer page ($showHeading false) the region is // titled above, so keep the plain intro exactly as it was — no header, no divider. @endphp @if ($showHeading)

{{ t_raw('notif.settings_title') }}

@else

{{ t_raw('notif.settings_intro') }}

@endif
@csrf @if ($returnTab !== '')@endif

{{ t_raw('notif.notify_me_about') }}

@foreach ($cats as $key => $c) @php if (!in_array($role, $c['roles'], true)) { continue; } $col = $c['col']; $accent = $catAccent[$key] ?? 'slate'; @endphp @endforeach @php // Email opt-outs, shown only to roles that actually receive one of these mails. @endphp @php $emailCats = array_filter(notification_email_categories(), static fn ($c) => in_array($role, $c['roles'], true)); @endphp @if ($emailCats)

{{ t_raw('notif.email_me_about') }}

@foreach ($emailCats as $key => $c) @php $col = $c['col']; $accent = $catAccent[$key] ?? 'slate'; @endphp @endforeach

{{ t_raw('notif.email_security_note') }}

@endif