Notifications

Notifications

Stay updated with all your important alerts

@if($unreadCount > 0)
@csrf @method('POST')
@endif
@if($notifications->count() > 0)
@foreach($notifications as $notification) @php $type = $notification->data['type'] ?? 'default'; $icons = [ 'contract_expiry' => ['icon' => 'fa-file-text', 'class' => 'warning'], 'contract_approved' => ['icon' => 'fa-check-circle', 'class' => 'success'], 'contract_terminated' => ['icon' => 'fa-times-circle', 'class' => 'danger'], 'leave_approved' => ['icon' => 'fa-check', 'class' => 'success'], 'leave_rejected' => ['icon' => 'fa-times', 'class' => 'danger'], 'leave_expired' => ['icon' => 'fa-clock-o', 'class' => 'warning'], 'leave_balance_low' => ['icon' => 'fa-exclamation-triangle', 'class' => 'warning'], 'loan_approved' => ['icon' => 'fa-money', 'class' => 'success'], 'loan_rejected' => ['icon' => 'fa-ban', 'class' => 'danger'], 'loan_due_soon' => ['icon' => 'fa-calendar', 'class' => 'info'], 'payroll_generated' => ['icon' => 'fa-dollar', 'class' => 'success'], ]; $iconData = $icons[$type] ?? ['icon' => 'fa-bell', 'class' => 'primary']; $isUnread = is_null($notification->read_at); @endphp

{{ $notification->data['message'] ?? 'New notification' }}

{{ $notification->created_at->diffForHumans() }} @if($isUnread) NEW @endif
@csrf @method('DELETE')
@endforeach
{{ $notifications->links() }}
@else
No Notifications Found

@if(request('filter') == 'unread') You're all caught up! No unread notifications. @elseif(request('filter') == 'read') No read notifications to display. @else You don't have any notifications yet. @endif

@endif
@if($readCount > 0)
Cleanup Actions
Remove notifications you've already read
@csrf @method('DELETE')
@endif