@php
// Check if user is a guest
$isGuest = !Auth::check();
// Get layout style from site config
$navStyle = $siteConfig['layout']['nav_style'] ?? 'default';
$sidebarEnabled = $siteConfig['layout']['sidebar_enabled'] ?? true;
$mobileNavStyle = $siteConfig['layout']['mobile_nav_style'] ?? 'bottom-bar';
// Get unread notifications count
$unreadNotificationsCount = 0;
try {
if (Auth::check()) {
$notificationService = app(\App\Services\NotificationService::class);
$unreadNotificationsCount = $notificationService->getUnreadCount(Auth::user()->id);
}
} catch (\Exception $e) {
\Log::error('Error getting unread notifications count: ' . $e->getMessage());
}
// Resolve current level details for the authenticated user (only if user-levels feature is active)
$currentLevelIcon = null;
$currentLevelName = null;
$currentLevelKey = null;
$currentLevelColor = null;
$userLevelsEnabled = false;
if (Auth::check()) {
// Check if user-levels feature is active for this user
$userLevelsEnabled = \Laravel\Pennant\Feature::for(Auth::user())->active('user-levels');
if ($userLevelsEnabled) {
$levelDetails = resolveUserLevelDetails(Auth::user());
$currentLevelIcon = $levelDetails['currentLevelIcon'] ?? null;
$currentLevelName = $levelDetails['currentLevelName'] ?? null;
$currentLevelKey = $levelDetails['currentLevelKey'] ?? null;
$currentLevelColor = $levelDetails['currentLevelColor'] ?? null;
}
}
// Navigation items للمستخدمين المسجلين فقط
$navItems = [];
$userDropdownItems = []; // Items for user avatar dropdown (SW default layout only)
if (Auth::check()) {
// Define the navigation items for the application
$navItems = [
// Notifications item
[
'icon' => 'bell',
'label' => 'الاشعارات',
'route' => 'user.notifications',
'tooltip' => 'الاشعارات',
'badge' => $unreadNotificationsCount > 0 ? $unreadNotificationsCount : '',
'badgeClass' => 'bg-danger',
'active' => request()->routeIs('user.notifications*'),
],
// Home item - also in mobile bottom nav
[
'icon' => 'gamepad-2',
'label' => 'الرئيسية',
'route' => 'index',
'tooltip' => 'الرئيسية',
'hideOnMobile' => true,
'showInBottomNav' => true,
],
// Orders item - also in mobile bottom nav
[
'icon' => 'shopping-cart',
'label' => 'الطلبات',
'route' => 'order.index',
'tooltip' => 'الطلبات',
'hideOnMobile' => true,
'showInBottomNav' => true,
],
// Payments item - also in mobile bottom nav
[
'icon' => 'banknote',
'label' => 'الدفعات',
'route' => 'payments.index',
'tooltip' => 'الدفعات',
'hideOnMobile' => true,
'showInBottomNav' => true,
],
// Balance request item (conditional)
[
'icon' => 'credit-card',
'label' => 'طلب رصيد',
'route' => 'charge.index',
'tooltip' => 'طلب رصيد',
'condition' => Auth::user()->canRequestBalance == 1,
],
// Support item
[
'label' => 'طلبات الرصيد',
'route' => 'payments.creditRequest.index',
'tooltip' => 'طلبات الرصيد',
'icon' => 'wallet',
'condition' => Auth::user()->canRequestBalance == 1,
],
// Balance Transfer - View Transfers
[
'icon' => 'arrow-left-right',
'label' => 'تحويلات الرصيد',
'route' => 'balance-transfer.index',
'tooltip' => 'عرض تحويلات الرصيد',
'condition' => Auth::user()->canTransferBalance == 1,
],
// Balance Transfer - Create Transfer
[
'icon' => 'circle-plus',
'label' => 'تحويل رصيد',
'route' => 'balance-transfer.create',
'tooltip' => 'إنشاء تحويل رصيد جديد',
'condition' => Auth::user()->canTransferBalance == 1,
],
// Complaints & Suggestions
[
'icon' => 'message-square-text',
'label' => 'الشكاوى والاقتراحات',
'route' => 'complaints.index',
'tooltip' => 'الشكاوى والاقتراحات',
'active' => request()->routeIs('complaints.*'),
],
// vendors => is_vendor
[
'icon' => 'users',
'label' => 'المتجر',
'route' => 'filament.vendor.pages.dashboard',
'tooltip' => 'المتجر الخاص بك',
'condition' => Auth::user()->is_vendor == 1,
],
[
'icon' => 'code',
'label' => 'API',
'route' => 'API_Documentation',
'tooltip' => 'Link',
'condition' => Auth::user()->api_token != null,
],
];
// User dropdown items (for SW default layout - shown in avatar dropdown)
$userDropdownItems = [
// Account item
[
'icon' => 'circle-user',
'label' => 'ملفي الشخصي',
'route' => 'profile.overview',
'tooltip' => 'عرض الملف الشخصي',
'active' => request()->routeIs('profile.overview'),
],
// Security Center item
[
'icon' => 'shield',
'label' => 'مركز الأمان',
'route' => 'security.index',
'tooltip' => 'جميع خيارات الأمان والحماية',
],
// PIN Code item
[
'icon' => 'key',
'label' => 'البين كود',
'route' => 'security.pin.index',
'tooltip' => 'إدارة البين كود',
],
// Biometric item
[
'icon' => 'fingerprint',
'label' => 'البصمة',
'route' => 'security.biometric.index',
'tooltip' => 'إدارة التحقق بالبصمة',
],
// User Logs item
[
'icon' => 'shield-alert',
'label' => 'سجلات الدخول',
'route' => 'security.logs.welcome',
'tooltip' => 'تتبع عمليات الدخول والأجهزة',
],
];
// For topbar-only layouts (Mega/Kaiali), merge user items back into navItems
if ($navStyle === 'topbar-only') {
$navItems = array_merge($navItems, $userDropdownItems);
$userDropdownItems = [];
}
}
@endphp
@if($navStyle === 'topbar-only')
{{-- Topbar-only layout (Kaiali, Mega) --}}
@php
$topbarStyle = $siteConfig['layout']['topbar_style'] ?? 'default';
@endphp
@if($topbarStyle === 'minimal')
{{-- Minimal topbar (cleaner, no username) --}}
@else
{{-- Default topbar --}}
@endif
@else
{{-- Default layout (SW) --}}
@endif