@props(['title' => 'Ahli Gizi S-Gizi']) @php $user = auth()->user(); $initials = collect(explode(' ', trim((string) ($user?->name ?? 'Ahli Gizi'))))->filter()->take(2)->map(fn ($part) => mb_substr($part, 0, 1))->implode('') ?: 'AG'; $nutritionist = $user?->nutritionist; $expertId = trim((string) ($nutritionist?->expert_id ?: 'expert-'.$nutritionist?->user_id)); $unreadChats = $nutritionist ? \App\Models\ConsultationRoom::query() ->where('expert_id', $expertId) ->whereHas('messages', fn ($query) => $query->where('sender_type', 'parent')->where('is_read', false)) ->with(['user', 'child', 'messages' => fn ($query) => $query->where('sender_type', 'parent')->where('is_read', false)->latest()->take(1)]) ->latest('last_message_at') ->take(5) ->get() : collect(); $navItems = [ ['label' => 'Dashboard', 'icon' => 'bi-grid-1x2', 'route' => 'nutritionist.dashboard'], ['label' => 'Konsultasi', 'icon' => 'bi-chat-dots', 'route' => 'nutritionist.consultations'], ['label' => 'Rekomendasi', 'icon' => 'bi-egg-fried', 'route' => 'nutritionist.recommendations.manage', 'children' => [ ['label' => 'Manajemen Rekomendasi', 'icon' => 'bi-sliders', 'route' => 'nutritionist.recommendations.manage'], ['label' => 'Kirim ke Chat', 'icon' => 'bi-send', 'route' => 'nutritionist.recommendations.send'], ]], ['label' => 'Artikel', 'icon' => 'bi-newspaper', 'route' => 'nutritionist.articles.manage', 'children' => [ ['label' => 'Manajemen Artikel', 'icon' => 'bi-pencil-square', 'route' => 'nutritionist.articles.manage'], ['label' => 'Kirim ke Chat', 'icon' => 'bi-send', 'route' => 'nutritionist.articles.send'], ]], ['label' => 'Profil', 'icon' => 'bi-person-circle', 'route' => 'nutritionist.profile'], ]; @endphp