@include('home.navbar') @php $statusFilter = request('status', 'all'); $typeFilter = request('type'); $search = request('search'); $currentItems = $notifications->getCollection(); $totalNotifications = $notifications->total(); $unreadCountOnPage = $currentItems->whereNull('read_at')->count(); $readCountOnPage = $currentItems->whereNotNull('read_at')->count(); $todayCountOnPage = $currentItems->filter(fn ($item) => optional($item->created_at)->isToday())->count(); $filteredNotifications = $currentItems->filter(function ($item) use ($search, $typeFilter) { $normalizedType = strtolower(trim((string) ($item->type ?? 'system'))); $searchText = strtolower(trim((string) $search)); $haystack = strtolower((string) (($item->title ?? '') . ' ' . ($item->message ?? ''))); $matchesType = !$typeFilter || $typeFilter === '' || str_contains($normalizedType, strtolower((string) $typeFilter)); $matchesSearch = $searchText === '' || str_contains($haystack, $searchText); return $matchesType && $matchesSearch; }); $iconByType = function (?string $type): string { return match (strtolower((string) $type)) { 'booking', 'booking_new', 'new_booking' => 'fa-regular fa-clipboard', 'payment', 'payment_uploaded', 'payment_verified', 'payment_rejected' => 'fa-solid fa-credit-card', 'review', 'review_new' => 'fa-regular fa-comment-dots', 'promo', 'promo_active', 'promo_expired' => 'fa-solid fa-tags', 'warning' => 'fa-solid fa-triangle-exclamation', 'error' => 'fa-solid fa-circle-xmark', 'success' => 'fa-solid fa-circle-check', default => 'fa-regular fa-bell', }; }; $badgeTypeClass = function (?string $type): string { return match (strtolower((string) $type)) { 'booking', 'booking_new', 'new_booking' => 'is-booking', 'payment', 'payment_uploaded', 'payment_verified', 'payment_rejected' => 'is-payment', 'review', 'review_new' => 'is-review', 'promo', 'promo_active', 'promo_expired' => 'is-promo', 'warning' => 'is-warning', 'error' => 'is-error', 'success' => 'is-success', default => 'is-system', }; }; $typeLabel = function (?string $type): string { $raw = strtolower(trim((string) $type)); if ($raw === '') { return 'System'; } return ucwords(str_replace(['_', '-'], ' ', $raw)); }; @endphp

Customer Area

Notifikasi Saya

Pantau update booking, pembayaran, dan aktivitas lain dari rental Anda dalam satu tempat.

@csrf @method('PATCH')
Total Notifikasi {{ $totalNotifications }}
Belum Dibaca {{ $unreadCountOnPage }}
Sudah Dibaca {{ $readCountOnPage }}
Hari Ini {{ $todayCountOnPage }}
Reset
@if ($notifications->count() > 0)
@forelse ($filteredNotifications as $index => $notification) @php $isUnread = is_null($notification->read_at); $type = (string) ($notification->type ?? 'system'); @endphp

{{ $notification->title ?? 'Notifikasi' }}

{{ $isUnread ? 'Belum Dibaca' : 'Sudah Dibaca' }} {{ $typeLabel($type) }}

{{ \Illuminate\Support\Str::limit((string) ($notification->message ?? ''), 180) }}

{{ optional($notification->created_at)->format('d M Y H:i') }} #{{ ($notifications->firstItem() ?? 1) + $index }}
@if (!empty($notification->url)) Lihat @else @endif @if ($isUnread)
@csrf @method('PATCH')
@else @endif
@empty

Tidak ada notifikasi yang cocok dengan filter saat ini.

@endforelse
{{ $notifications->links() }}
@else

Belum ada notifikasi

Update booking dan pembayaran Anda akan tampil di halaman ini.

@endif
@include('home.footer')