@foreach($notifications as $notification)
@php
$data = $notification->data ?? [];
$url = $data['url'] ?? null;
$type = $data['type'] ?? 'info';
$icon = match (true) {
str_contains($type, 'reservation') => 'fa-calendar-check',
str_contains($type, 'maintenance') => 'fa-screwdriver-wrench',
str_contains($type, 'service') => 'fa-concierge-bell',
str_contains($type, 'purchase') => 'fa-truck-ramp-box',
str_contains($type, 'leave') => 'fa-user-clock',
str_contains($type, 'order') => 'fa-receipt',
default => 'fa-circle-info',
};
@endphp
{{ $data['title'] ?? 'Notification' }}
{{ $data['message'] ?? 'System update' }}
{{ $notification->created_at?->diffForHumans() }}
@if($url)
Open
@endif
@if(is_null($notification->read_at))
@endif
@endforeach