{{-- resources/views/restaurant/partials/header.blade.php --}}
@php
$user = auth()->user();
$isOwner = $user->hasRole('restaurant_owner');
$restaurants = $isOwner ? $user->restaurants : collect();
$currentRestaurant = $user->activeRestaurant();
$isInstaKart = ($currentRestaurant?->service_type ?? null) === 'grocery';
$dashboardAllSelected = request()->routeIs('restaurant.dashboard') && request('scope') === 'all';
$canMenu = $user->hasRestaurantPermission('view_menu_items') || $user->hasRestaurantPermission('manage_menu');
$canReports = $user->hasRestaurantPermission('view_reports');
// Count pending orders for notification badge
$pendingOrders = 0;
if ($currentRestaurant) {
$pendingOrders = \App\Models\Order::where('restaurant_id', $currentRestaurant->id)
->where('status', 'pending')
->count();
}
// Count unread notifications
$unreadNotifications = 0;
if ($user && method_exists($user, 'unreadNotifications')) {
$unreadNotifications = $user->unreadNotifications()->count();
}
@endphp