@extends('backend.layouts.app') @section('title', __('Notifications')) @php use App\Enums\NotificationActionType; $totalNotifications = $notifications->total(); $unreadNotifications = auth()->user()->unreadNotifications()->count(); $readNotifications = auth()->user()->readNotifications()->count(); $activeFilter = $filter ?? 'all'; $filterTabs = [ 'all' => ['label' => __('All'), 'count' => $unreadNotifications + $readNotifications], 'unread' => ['label' => __('Unread'), 'count' => $unreadNotifications], 'read' => ['label' => __('Read'), 'count' => $readNotifications], ]; @endphp @section('content')
{{ __('Admin Center') }}

{{ __('Notification Center') }}

{{ trans_choice('{0} You are all caught up|{1} :count notification in your inbox|[2,*] :count notifications in your inbox', $unreadNotifications + $readNotifications, ['count' => number_format($unreadNotifications + $readNotifications)]) }} @if($unreadNotifications > 0) {{ trans_choice(':count unread|:count unread', $unreadNotifications, ['count' => number_format($unreadNotifications)]) }} @endif

@if($unreadNotifications > 0) {{ __('Mark all as read') }} @else {{ __('Inbox is clear') }} @endif
@if($notifications->isEmpty()) @else
@foreach($notifications as $notification) @php $data = (array) ($notification->data ?? []); $sender = (array) ($data['sender'] ?? []); $senderName = $sender['name'] ?? __('System Notification'); $senderAvatar = $sender['avatar'] ?? null; $title = $data['title'] ?? __('Notification'); $bodyMessage = $data['message'] ?? __('No additional details provided.'); $actionLink = $data['action_link'] ?? 'javascript:void(0);'; $isUnread = is_null($notification->read_at); $tone = isset($data['action_type']) && $data['action_type'] !== '' ? NotificationActionType::getClass((string) $data['action_type']) : 'primary'; $actionLabel = isset($data['action_type']) && $data['action_type'] !== '' ? __(ucfirst(str_replace('_', ' ', (string) $data['action_type']))) : __('Update'); $initial = mb_strtoupper(mb_substr(trim((string) $senderName), 0, 1, 'UTF-8') ?: 'N', 'UTF-8'); $bodyNorm = mb_strtolower(trim((string) $bodyMessage), 'UTF-8'); $senderNorm = mb_strtolower(trim((string) $senderName), 'UTF-8'); $showSender = $senderNorm !== '' && ($senderName === __('System Notification') || $bodyNorm === '' || ! str_contains($bodyNorm, $senderNorm)); @endphp @endforeach
@if($notifications->hasPages() || $notifications->total() > 0) @endif @endif
@endsection @push('scripts') @include('backend.notifications.partials._scripts') @endpush