Notifications
Stay updated on inventory movements, requests, approvals, and system alerts.
@if($unreadCount > 0)
@endif
@if($totalCount > 0)
@endif
@forelse($notifications as $notification)
@php
$isUnread = is_null($notification->read_at);
$type = strtoupper($notification->type ?? 'SYSTEM');
$title = $notification->title ?? ($notification->data['title'] ?? 'Notification');
$message = $notification->message ?? ($notification->data['message'] ?? '');
// Icon and color per type
$iconConfig = match($type) {
'APPROVAL' => ['icon' => 'bi-check-circle-fill', 'bg' => 'bg-success bg-opacity-10 text-success', 'badge' => 'bg-success'],
'REJECTION' => ['icon' => 'bi-x-circle-fill', 'bg' => 'bg-danger bg-opacity-10 text-danger', 'badge' => 'bg-danger'],
'MOVEMENT', 'DISPATCH', 'RETURN' => ['icon' => 'bi-arrow-left-right', 'bg' => 'bg-info bg-opacity-10 text-info', 'badge' => 'bg-info text-dark'],
'ALERT', 'EXCEPTION' => ['icon' => 'bi-exclamation-triangle-fill', 'bg' => 'bg-warning bg-opacity-10 text-warning', 'badge' => 'bg-warning text-dark'],
'VERIFICATION' => ['icon' => 'bi-clipboard-check-fill', 'bg' => 'bg-primary bg-opacity-10 text-primary', 'badge' => 'bg-primary'],
default => ['icon' => 'bi-bell-fill', 'bg' => 'bg-primary bg-opacity-10 text-primary', 'badge' => 'bg-primary'],
};
// Action URL if present
$actionUrl = $notification->data['url'] ?? null;
if (!$actionUrl && isset($notification->data['approval_id'])) {
$actionUrl = route('approvals.show', $notification->data['approval_id']);
}
@endphp
{{ $title }}
{{ str_replace('_', ' ', $type) }}
@if($isUnread)
NEW
@endif
{{ $message }}
{{ $notification->created_at ? $notification->created_at->diffForHumans() : '' }}
@if($notification->read_at)
•
Read {{ $notification->read_at->diffForHumans() }}
@endif
@if($actionUrl)
View
@endif
@if($isUnread)
@endif
@empty
No Notifications Found
@if(($filter ?? 'all') === 'unread')
You have read all of your notifications. Great job!
@elseif(($filter ?? 'all') === 'read')
You do not have any read notifications yet.
@else
You are all caught up! New alerts and approval requests will appear here.
@endif
@endforelse
@if(method_exists($notifications, 'hasPages') && $notifications->hasPages())
@endif