@php $user = auth()->user(); if (!$user) { return; // Don't render navbar if user is not authenticated } $roleLabels = [ 'pastor' => 'Pastor/Elder', 'clerk' => 'Church Clerk', 'welfare' => 'Welfare Leader', 'superintendent' => 'SS Superintendent', 'coordinator' => 'SS Coordinator', 'financial' => 'Financial Secretary', 'ict' => 'ICT Administrator', ]; $userRoleLabel = $roleLabels[$user->role ?? 'pastor'] ?? 'User'; // Get display name $displayName = $user->role === 'pastor' ? 'Pastor ' . $user->first_name : $user->first_name; // Get unread notification count $notificationCount = \App\Http\Controllers\NotificationsController::getUnreadCount(); @endphp {{-- Mobile Menu Button --}} Welcome, {{ $displayName }}! {{ $userRoleLabel }} {{-- Notifications --}} @php try { $notificationsUrl = route('notifications.index'); } catch (\Exception $e) { $notificationsUrl = url('/notifications'); } @endphp @if($notificationCount > 0) {{ $notificationCount > 99 ? '99+' : $notificationCount }} @endif {{-- User Dropdown --}} @if($user->avatar ?? false) @else @endif {{ $displayName }} {{-- Dropdown Menu --}} My Account @php try { $profileUrl = route('profile.edit'); } catch (\Exception $e) { $profileUrl = url('/profile'); } @endphp Profile @csrf Logout
{{ $userRoleLabel }}
My Account