@php $adminUser = Auth::guard('admin')->user(); $nameParts = explode(' ', $adminUser->name ?? 'Admin'); $initials = mb_strtoupper(mb_substr($nameParts[0] ?? 'A', 0, 1)) . mb_strtoupper(mb_substr($nameParts[1] ?? '', 0, 1)); $adminRole = $adminUser->role == 1 ? 'Super Admin' : 'Admin'; $allUnread = App\Models\AdminNotification::unread_notification(); $unreadCount = $allUnread->count(); $notifications = $allUnread->take(6); // Map type string → destination URL $notifUrl = function($notif) { $t = strtolower($notif->type ?? ''); $id = $notif->identity; if (str_contains($t, 'job')) return $id ? route('admin.job.details', $id) : route('admin.jobs'); if (str_contains($t, 'project')) return $id ? route('admin.project.details', $id) : route('admin.project'); if (str_contains($t, 'deposit')) return moduleExists('Wallet') ? route('admin.wallet.history') : route('admin.notification.all'); if (str_contains($t, 'subscription') || str_contains($t, 'connect')) return moduleExists('Subscription') ? route('admin.subscription.all') : route('admin.notification.all'); if (str_contains($t, 'withdraw')) return moduleExists('Wallet') ? route('admin.wallet.withdraw.request') : route('admin.notification.all'); return route('admin.notification.all'); }; // Map type string → inline SVG icon path(s) $notifIcon = function($type) { $t = strtolower($type ?? ''); if (str_contains($t, 'job')) return ''; if (str_contains($t, 'project')) return ''; if (str_contains($t, 'deposit') || str_contains($t, 'withdraw')) return ''; if (str_contains($t, 'subscription') || str_contains($t, 'connect') || str_contains($t, 'package')) return ''; return ''; }; // Accent color per type $notifColor = function($type) { $t = strtolower($type ?? ''); if (str_contains($t, 'job')) return '#6366f1'; if (str_contains($t, 'project')) return '#8b5cf6'; if (str_contains($t, 'deposit') || str_contains($t, 'withdraw')) return '#22c55e'; if (str_contains($t, 'subscription') || str_contains($t, 'connect') || str_contains($t, 'package')) return '#f59e0b'; return 'var(--accent)'; }; @endphp
{{-- Mobile menu toggle --}} {{-- Breadcrumbs --}}
@yield('breadcrumb_section', 'Overview') @yield('breadcrumb_page', 'Dashboard')
{{-- Theme toggle --}} {{-- Notification bell --}}
{{ __('Notifications') }} @if($unreadCount > 0) {{ $unreadCount }} new @endif
@can('notification-list') {{ __('View all') }} @endcan
@forelse($notifications as $notif) @php $nColor = $notifColor($notif->type); $nAlpha = 'color-mix(in srgb, ' . $nColor . ' 16%, transparent)'; @endphp {!! $notifIcon($notif->type) !!}
{{ Str::limit($notif->message ?? __('New notification'), 70) }}
{{ $notif->type }}
{{ $notif->created_at ? $notif->created_at->diffForHumans(null, true, true) : '' }}
@empty
{{ __('No unread notifications') }}
@endforelse
@if($unreadCount > 0) @else {{ __('All caught up') }} @endif @can('notification-list') {{ __('Settings') }} @endcan
{{-- User pill --}}
{{ $initials ?: 'AD' }}
{{ $adminUser->name ?? 'Admin' }}
{{ $adminUser->email ?? '' }}
{{ $adminRole }} Online