@php $currentLocale = session('store_locale', app()->getLocale() ?: 'ar'); $isEnglish = $currentLocale === 'en'; $pageDir = $isEnglish ? 'ltr' : 'rtl'; $siteSettings = \App\Models\SiteSetting::current(); $siteName = $isEnglish ? $siteSettings->site_name_en : $siteSettings->site_name_ar; $siteLogo = $siteSettings->logo_path ?: 'images/brand/raseednow-logo.png'; $cartCount = array_sum(session('raseednow_cart', [])); $isAccountMode = $accountMode ?? false; $headerUser = auth()->user(); $headerWalletBalance = ($headerUser?->wallet?->balance_minor ?? 0) / 100; $headerAvatar = mb_strtoupper(mb_substr($headerUser?->display_name ?: $headerUser?->name ?: 'U', 0, 1)); $headerUnreadCount = $headerUser ? $headerUser->customerNotifications()->whereNull('read_at')->count() : 0; $socialLinks = collect([ 'facebook' => ['label' => 'Facebook', 'url' => $siteSettings->facebook_url, 'image' => 'images/social/facebook.png'], 'instagram' => ['label' => 'Instagram', 'url' => $siteSettings->instagram_url, 'image' => 'images/social/instagram.png'], 'tiktok' => ['label' => 'TikTok', 'url' => $siteSettings->tiktok_url, 'image' => 'images/social/tiktok.png'], 'youtube' => ['label' => 'YouTube', 'url' => $siteSettings->youtube_url, 'image' => 'images/social/youtube.png'], 'whatsapp' => ['label' => 'WhatsApp', 'url' => $siteSettings->whatsapp_url, 'image' => 'images/social/whatsapp.png'], ])->filter(fn ($item) => filled($item['url'])); $clientPopup = null; try { $clientPopup = \App\Models\PopupNotification::live() ->latest() ->get() ->first(fn ($popup) => $popup->appliesTo($headerUser)); } catch (\Throwable $e) { $clientPopup = null; } @endphp {{ $title ?? $siteName }} @vite(['resources/css/app.css', 'resources/js/app.js']) @if($isAccountMode || request()->routeIs('login', 'register', 'signup')) @vite('resources/css/customer-reference.css') @endif @stack('styles') @php $activeCurrencies = \App\Models\Currency::where('is_active', true)->orderByDesc('is_base')->orderBy('code')->get(); $currentCurrencyCode = session('store_currency', 'EGP'); $currentCurrency = $activeCurrencies->firstWhere('code', $currentCurrencyCode) ?? $activeCurrencies->firstWhere('code', 'EGP'); $headerWalletCurrencyCode = $headerUser?->wallet?->currency_code ?: 'EGP'; $headerWalletCurrency = $activeCurrencies->firstWhere('code', $headerWalletCurrencyCode) ?? \App\Models\Currency::where('code', $headerWalletCurrencyCode)->first(); $headerWalletSourceRate = max((float) ($headerWalletCurrency?->exchange_rate ?? 1), 0.0001); $headerTargetRate = max((float) ($currentCurrency?->exchange_rate ?? 1), 0.0001); $headerConvertedWalletBalance = ($headerWalletBalance * $headerWalletSourceRate) / $headerTargetRate; $headerWalletDisplay = ($currentCurrency?->symbol_position === 'before') ? ($currentCurrency?->symbol ?? $currentCurrencyCode).number_format($headerConvertedWalletBalance, 2) : number_format($headerConvertedWalletBalance, 2).' '.($currentCurrency?->symbol ?? $currentCurrencyCode); $currencyFlagClasses = [ 'EGP' => 'kr-flag-eg', 'USD' => 'kr-flag-us', 'EUR' => 'kr-flag-eu', 'SAR' => 'kr-flag-sa', 'AED' => 'kr-flag-ae', ]; $currencyFlagImages = [ 'EGP' => 'eg.png', 'USD' => 'us.png', 'EUR' => 'eu.png', 'SAR' => 'sa.png', 'AED' => 'ae.png', ]; $currencyNames = [ 'EGP' => $isEnglish ? 'Egyptian Pound' : 'جنيه مصري', 'AED' => $isEnglish ? 'UAE Dirham' : 'درهم إماراتي', 'EUR' => $isEnglish ? 'Euro' : 'يورو', 'SAR' => $isEnglish ? 'Saudi Riyal' : 'ريال سعودي', 'USD' => $isEnglish ? 'US Dollar' : 'دولار أمريكي', ]; @endphp
{{ $isEnglish ? 'Currency' : 'العملة' }}{{ $currentCurrency?->symbol ?? 'ج.م' }}
@foreach($activeCurrencies as $currency)
@csrf
@endforeach
{{ $currentLocale === 'ar' ? 'عربي' : 'English' }}
@foreach(['ar' => 'عربي', 'en' => 'English'] as $localeCode => $localeLabel)
@csrf
@endforeach
@yield('content')
@unless($isAccountMode)
@endunless @if(app()->isLocal() && request()->boolean('inspect'))
اختار عنصر من الصفحة
@endif @if($clientPopup)
@if($clientPopup->image_path) @else @endif
{{ $clientPopup->is_gift ? ($isEnglish ? 'Special gift' : 'هدية خاصة') : ($isEnglish ? 'New update' : 'تنبيه مهم') }} {{ $clientPopup->title }} @if($clientPopup->body)

{{ $clientPopup->body }}

@endif @if($clientPopup->is_gift && $clientPopup->gift_code) {{ $isEnglish ? 'Redeem gift' : 'استرد الهدية' }} @elseif($clientPopup->link_url && $clientPopup->opens_link) {{ $isEnglish ? 'Open' : 'فتح الرابط' }} @endif
@endif @stack('scripts')