@extends('layouts.app') @php use App\Enums\NotificationType; /** @var \App\Models\Notification[] $notifications */ /** @var int $totalCount */ /** @var int $unreadCount */ /** @var int $readCount */ $typeCounts = $typeCounts ?? []; // Compute totals per group so we can show badges on the filter card. $groupTotals = []; foreach ($typeCounts as $type => $count) { $enum = NotificationType::tryFrom($type); if ($enum) { $group = $enum->group(); $groupTotals[$group] = ($groupTotals[$group] ?? 0) + $count; } } @endphp @section('title', 'Notifications') @section('page-header')

Notifications

@csrf
@csrf @method('DELETE')
@endsection @section('content') {{-- ═══════════════════════════════════════════════════════ STATISTICS ═══════════════════════════════════════════════════════ --}}
Total Notifications
{{ $totalCount }}
Unread
{{ $unreadCount }}
Read
{{ $readCount }}
{{-- ═══════════════════════════════════════════════════════ QUICK FILTERS BY QMS CATEGORY ═══════════════════════════════════════════════════════ --}}
Quick Filters
@php $groups = [ 'Documents' => ['icon' => 'fa-file-alt', 'color' => 'primary'], 'Training' => ['icon' => 'fa-graduation-cap', 'color' => 'info'], 'CAPA' => ['icon' => 'fa-tasks', 'color' => 'success'], 'Deviations' => ['icon' => 'fa-exclamation-triangle', 'color' => 'warning'], 'Audits' => ['icon' => 'fa-clipboard-list', 'color' => 'secondary'], 'Change Control' => ['icon' => 'fa-exchange-alt', 'color' => 'primary'], 'Risk' => ['icon' => 'fa-shield-alt', 'color' => 'dark'], 'Complaints' => ['icon' => 'fa-comment-dots', 'color' => 'info'], ]; @endphp @foreach($groups as $group => $meta) @php $groupTypes = array_filter( NotificationType::cases(), fn ($t) => $t->group() === $group ); $ids = array_map(fn ($t) => $t->value, $groupTypes); $count = $groupTotals[$group] ?? 0; @endphp @endforeach
{{-- ═══════════════════════════════════════════════════════ FILTERS ═══════════════════════════════════════════════════════ --}}
Filter Notifications
{{-- ═══════════════════════════════════════════════════════ NOTIFICATIONS LIST ═══════════════════════════════════════════════════════ --}}
All Notifications
{{ $notifications->total() }} total @if($notifications->total() > 0) · page {{ $notifications->currentPage() }} of {{ $notifications->lastPage() }} @endif
@if($notifications->count() > 0)
@foreach($notifications as $notification)
{{-- Icon --}}
{{-- Content --}}
{{ $notification->title }}
@if($notification->is_unread) New @endif {{ $notification->type_label }}

{{ $notification->message }}

{{ $notification->time_ago }}
{{-- Actions --}}
@endforeach
{{-- Pagination --}} @else
No Notifications Found

You don't have any notifications at the moment.

@if(request()->hasAny(['filter', 'type', 'from', 'to'])) Clear Filters @endif
@endif
{{-- ═══════════════════════════════════════════════════════ LEGEND — what each category means ═══════════════════════════════════════════════════════ --}}
Notification Categories
@foreach(NotificationType::cases() as $type)
{{ $type->label() }} — {{ $type->group() }}
@endforeach
@endsection @push('scripts') @endpush