@props(['user' => null]) @php $user = $user ?? auth()->user(); $role = $user?->role ?? 'guest'; // Get unassigned mothers count for clinic admin $unassignedMothersCount = 0; if ($role === 'clinic_admin' && $user && $user->clinic_id) { $unassignedMothersCount = \App\Models\ExpectantMother::where('clinic_id', $user->clinic_id) ->whereDoesntHave('currentAssignment') ->count(); } // Get pending clinic change requests count for clinic admin $pendingClinicChangeRequestsCount = 0; if ($role === 'clinic_admin' && $user && $user->clinic_id) { $pendingClinicChangeRequestsCount = \App\Models\ClinicChangeRequest::where(function($query) use ($user) { $query->where('current_clinic_id', $user->clinic_id) ->orWhere('requested_clinic_id', $user->clinic_id); }) ->where('status', 'PENDING') ->count(); } // Define navigation items for each role $navigationItems = [ 'expectant_mother' => [ 'dashboard' => [ 'label' => 'Dashboard', 'route' => 'dashboard.mother', 'active' => 'dashboard.mother', 'icon' => 'fas fa-tachometer-alt' ], 'appointments' => [ 'label' => 'Appointment', 'route' => 'appointments', 'active' => 'appointments', 'icon' => 'fas fa-user-nurse' ], 'health_records' => [ 'label' => 'My Health Records', 'route' => 'mother.health-records.index', 'active' => 'mother.health-records.*', 'icon' => 'fas fa-file-medical' ], 'color_code_history' => [ 'label' => 'Risk Level', 'route' => 'mother.color-code.history', 'active' => 'mother.color-code.history', 'icon' => 'fas fa-exclamation-triangle' ], 'kick_hiccup' => [ 'label' => 'Kick Hiccup Tracker', 'route' => 'kick-hiccup-tracker', 'active' => 'kick-hiccup-tracker', 'icon' => 'fas fa-baby' ], 'profile' => [ 'label' => 'Profile', 'route' => 'profile', 'active' => 'profile*', 'icon' => 'fas fa-user-circle' ] ], 'nurse' => [ 'dashboard' => [ 'label' => 'Dashboard', 'route' => 'dashboard.nurse', 'active' => 'dashboard.nurse', 'icon' => 'fas fa-tachometer-alt' ], 'appointments' => [ 'label' => 'Appointments', 'route' => 'nurse.appointments', 'active' => 'nurse.appointments*', 'icon' => 'fas fa-calendar-check' ], 'color_code_management' => [ 'label' => 'Color Code Management', 'route' => 'color-code.management', 'active' => 'color-code.*', 'icon' => 'fas fa-palette' ], 'health_records' => [ 'label' => 'Health Records', 'route' => 'nurse.health-records.index', 'active' => 'nurse.health-records.*', 'icon' => 'fas fa-file-medical' ], 'kick_hiccup' => [ 'label' => 'Kick Hiccup Tracker', 'route' => 'nurse.kick-hiccup-tracker', 'active' => 'nurse.kick-hiccup-tracker*', 'icon' => 'fas fa-baby' ], 'profile' => [ 'label' => 'Profile', 'route' => 'nurse.profile', 'active' => 'nurse.profile*', 'icon' => 'fas fa-user-circle' ] ], 'clinic_admin' => [ 'dashboard' => [ 'label' => 'Dashboard', 'route' => 'dashboard.clinic-admin', 'active' => 'dashboard.clinic-admin', 'icon' => 'fas fa-tachometer-alt' ], 'nurse_management' => [ 'label' => 'Nurse Management', 'route' => 'clinic-admin.nurse-management', 'active' => 'clinic-admin.nurse-management*', 'icon' => 'fas fa-user-nurse' ], 'zone_management' => [ 'label' => 'Zone Management', 'route' => 'clinic-admin.zone-management', 'active' => 'clinic-admin.zone-management*', 'icon' => 'fas fa-map-marked-alt' ], 'duty_management' => [ 'label' => 'Duty Management', 'route' => 'clinic-admin.duty-management', 'active' => 'clinic-admin.duty-management*', 'icon' => 'fas fa-calendar-alt', 'submenu' => [ 'duty_roster' => [ 'label' => 'Duty Roster', 'route' => 'clinic-admin.duty-management', 'active' => 'clinic-admin.duty-management', 'icon' => 'fas fa-calendar-alt' ], 'duty_history' => [ 'label' => 'Duty History', 'route' => 'clinic-admin.duty-history', 'active' => 'clinic-admin.duty-history', 'icon' => 'fas fa-history' ] ] ], 'mother_management' => [ 'label' => 'Mother Management', 'route' => 'clinic-admin.mother-management', 'active' => 'clinic-admin.mother-management*', 'icon' => 'fas fa-female', 'submenu' => [ 'mothers' => [ 'label' => 'Registered Mothers', 'route' => 'clinic-admin.mother-management', 'active' => 'clinic-admin.mother-management', 'icon' => 'fas fa-list' ], 'clinic_change_requests' => [ 'label' => 'Clinic Change Requests', 'route' => 'clinic-admin.clinic-change-requests.index', 'active' => 'clinic-admin.clinic-change-requests.*', 'icon' => 'fas fa-exchange-alt' ] ] ], 'appointments' => [ 'label' => 'Appointments', 'route' => 'clinic-admin.appointments', 'active' => 'clinic-admin.appointments*', 'icon' => 'fas fa-calendar-check', 'dropdown' => [ 'quota' => [ 'label' => 'Quota Management', 'route' => 'clinic-admin.appointments', 'active' => 'clinic-admin.appointments', 'icon' => 'fas fa-sliders-h' ], 'view' => [ 'label' => 'View Appointments', 'route' => 'clinic-admin.appointments.index', 'active' => 'clinic-admin.appointments.index', 'icon' => 'fas fa-list' ] ] ], 'profile' => [ 'label' => 'Profile', 'route' => 'clinic-admin.profile', 'active' => 'clinic-admin.profile*', 'icon' => 'fas fa-user-circle' ] ], 'head_nurse' => [ 'dashboard' => [ 'label' => 'Dashboard', 'route' => 'dashboard.head-nurse', 'active' => 'dashboard.head-nurse', 'icon' => 'fas fa-tachometer-alt' ], 'clinic_admin_management' => [ 'label' => 'Clinic Admins', 'route' => 'head-nurse.clinic-admin-management', 'active' => 'head-nurse.clinic-admin-management*', 'icon' => 'fas fa-user-tie' ], 'report_management' => [ 'label' => 'Report Management', 'route' => 'head-nurse.reports', 'active' => 'head-nurse.reports*', 'icon' => 'fas fa-chart-line' ], 'profile' => [ 'label' => 'Profile', 'route' => 'head-nurse.profile', 'active' => 'head-nurse.profile*', 'icon' => 'fas fa-user-circle' ] ], 'guest' => [ 'dashboard' => [ 'label' => 'Dashboard', 'route' => 'dashboard', 'active' => 'dashboard', 'icon' => 'fas fa-tachometer-alt' ], 'profile' => [ 'label' => 'Profile', 'route' => 'profile', 'active' => 'profile*', 'icon' => 'fas fa-user-circle' ] ] ]; // Get navigation items for current user role $navItems = $navigationItems[$role] ?? $navigationItems['guest']; // Get dashboard route based on role $dashboardRoute = match($role) { 'expectant_mother' => 'dashboard.mother', 'nurse' => 'dashboard.nurse', 'head_nurse' => 'dashboard.head-nurse', 'clinic_admin' => 'dashboard.clinic-admin', default => 'dashboard' }; // Get navbar background color based on role $navbarBg = match($role) { 'clinic_admin' => '', 'head_nurse' => '', 'expectant_mother' => 'accent-bg', 'nurse' => '', default => 'bg-gradient-to-r from-pink-600 to-purple-600' }; // Get navbar style for all roles with inline styles $navbarStyle = match($role) { 'clinic_admin' => 'background-color: #654133;', 'head_nurse' => 'background: linear-gradient(135deg, #7B5BA1 0%, #5E4075 100%);', 'nurse' => 'background: linear-gradient(135deg, #CD7A98 0%, #94426A 100%);', default => '' }; @endphp