@extends('layouts.admin') @section('title', 'Notifikasi | Admin Rental') @section('page_title', 'Notifikasi') @push('styles') @endpush @section('content') @php $currentItems = $notifications->getCollection(); $statusFilter = request('status', 'all'); $typeFilter = request('type'); $search = request('search'); $totalNotifications = $notifications->total(); $unreadCountOnPage = $currentItems->whereNull('read_at')->count(); $readCountOnPage = $currentItems->whereNotNull('read_at')->count(); $todayCountOnPage = $currentItems->filter(function ($item) { return 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' => 'bi-journal-text', 'payment', 'payment_uploaded', 'payment_verified', 'payment_rejected' => 'bi-credit-card-2-front', 'review', 'review_new' => 'bi-chat-left-text', 'promo', 'promo_active', 'promo_expired' => 'bi-megaphone', 'warning' => 'bi-exclamation-triangle', 'error' => 'bi-x-octagon', 'success' => 'bi-check-circle', default => 'bi-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
Admin Rental Notifikasi
@if ($message = session('success'))
Berhasil

{{ $message }}

@endif @if ($message = session('error'))
Gagal

{{ $message }}

@endif @if ($message = session('warning'))
Peringatan

{{ $message }}

@endif @if ($message = session('info'))
Informasi

{{ $message }}

@endif

Notifikasi

Pantau pembaruan penting terkait booking, pembayaran, dan aktivitas rental Anda.

@csrf @method('PATCH')

Total Notifikasi

{{ $totalNotifications }}

Belum Dibaca (Halaman Ini)

{{ $unreadCountOnPage }}

Sudah Dibaca (Halaman Ini)

{{ $readCountOnPage }}

Notifikasi 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 ?? ''), 170) }}

{{ 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

Notifikasi terkait aktivitas rental Anda akan muncul di halaman ini.

@endif
@endsection