@php $activeOrdersCount = 0; $isMitraRole = auth()->check() && auth()->user()->role === 'mitra'; if (auth()->check()) { if ($isMitraRole) { $activeOrdersCount = auth()->user()->handledOrders() ->whereIn('status', ['searching', 'otw', 'in_progress']) ->count(); } else { $activeOrdersCount = auth()->user()->orders() ->whereIn('status', ['active', 'pending', 'confirmed', 'searching', 'otw', 'in_progress']) ->whereNotIn('status', ['cancelled', 'completed']) ->whereNotIn('payment_status', ['cancelled', 'failed', 'expired']) ->count(); } } $pesananUrl = auth()->check() ? ($isMitraRole ? mitra_url('order-mitra') : consumer_url('pesanan')) : consumer_url('login'); $notifUrl = auth()->check() ? ($isMitraRole ? mitra_url('notifikasi-mitra') : consumer_url('notifikasi')) : consumer_url('login'); $profilUrl = auth()->check() ? ($isMitraRole ? mitra_url('profil-mitra') : consumer_url('profil')) : consumer_url('login'); $consumerNotifCount = isset($unreadNotificationsCount) ? $unreadNotificationsCount : (auth()->check() ? auth()->user()->appNotifications()->where('is_read', false)->count() : 0); @endphp @if(auth()->check() && auth()->user()->role === 'konsumen') @endif