@php /** * Notifications Center content — shared by the customer account page and every dashboard * role. Lists the signed-in user's notifications (paginated, All/Unread filter), lets them * open/delete each one and run bulk actions, and edit their per-user notification settings. * All actions are plain CSRF-protected forms (work without JS); the bell's live polling is * handled separately by notifications.js. * * @var array $rows Paginated notification rows. * @var array $pager paginate() result. * @var int $unread Unread count. * @var string $filter 'all' | 'unread'. * @var array $prefs The user's notification preferences (row or defaults). * @var string $base This page's path (e.g. '/admin/notifications'). * @var string $role The viewer's role (controls which categories show). */ $rows = $rows ?? []; $pager = $pager ?? paginate(0, 20); $unread = (int) ($unread ?? 0); $filter = ($filter ?? 'all') === 'unread' ? 'unread' : 'all'; $prefs = $prefs ?? notification_prefs_defaults(); $base = $base ?? '/account/notifications'; $role = $role ?? (\App\Support\Auth::user()['role'] ?? ''); $baseUrl = url(ltrim($base, '/')); $cats = notification_categories(); // 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; @endphp
@if ($showHeading)

{{ t_raw('header.notifications') }} @if ($unread){{ t_raw('notif.unread_count', [':count' => $unread]) }}@endif

@endif
@csrf
@csrf
@csrf
@if ($rows) @php /* The pager rebuilds the link from $_GET, so ?filter=unread already travels with it. Adding it to the BASE as well produced ".../notifications?filter=unread?filter=unread&page=2": `filter` then read "unread?filter=unread", matched nothing, and page two of the Unread view silently came back as All. */ @endphp
@partial('pagination', ['pager' => $pager, 'base' => $base])
@else

{!! $filter === 'unread' ? t('notif.empty_unread') : t('notif.empty_all') !!}

@endif
@php // Notification settings are personal preferences that live solely under the user's // account (My account → Notification settings) - not duplicated on this inbox page. // Every role now has a personal account page, so all of them manage prefs there. $acctUrls = [ 'super_admin' => '/admin/account', 'vendor' => '/vendor/account', 'driver' => '/driver/profile', 'customer' => '/account', ]; $acctUrl = $acctUrls[$role] ?? ''; @endphp @if ($acctUrl === '')
@partial('notification-prefs', ['prefs' => $prefs, 'role' => $role])
@endif