@php // --- 1. Ad Banner Popup Settings --- $adEnabled = theme_option('ad_banner_popup_enabled', 'yes') === 'yes'; $adImage = theme_option('ad_banner_popup_image'); $adLink = theme_option('ad_banner_popup_link', url('/products')); $adOpenInNewTab = theme_option('ad_banner_popup_open_in_new_tab', 'no') === 'yes'; $adDelay = (int) theme_option('ad_banner_popup_delay', 120); if ($adDelay <= 0) { $adDelay = 120; } $adFrequency = theme_option('ad_banner_popup_frequency', 'once_per_session'); // --- 2. Discount Offer Modal Settings --- $offerEnabled = theme_option('banner_offer_modal_enabled', 'yes') === 'yes'; $offerDelay = (int) theme_option('banner_offer_modal_delay', 60); if ($offerDelay <= 0) { $offerDelay = 60; } $offerFrequency = theme_option('banner_offer_modal_frequency', 'once_per_session'); $offerImage = theme_option('banner_offer_modal_image'); $offerBadge = theme_option('banner_offer_modal_badge', __('عرض حصري لزوارنا الكرام 🔥')); $offerTitle = theme_option('banner_offer_modal_title', __('وفر 20% على طلبك اليوم!')); $offerSubtitle = theme_option('banner_offer_modal_subtitle', __('استمتع بخصم إضافي على جميع المنتجات لفترة محدودة')); $offerDescription = theme_option('banner_offer_modal_description', __('انسخ كود الخصم واستخدمه في صفحة الدفع للحصول على خصم فوري على سلة مشترياتك!')); $offerCouponCode = theme_option('banner_offer_modal_coupon_code', 'OFFER20'); $offerBtnText = theme_option('banner_offer_modal_btn_text', __('تسوق الآن واستفد من الخصم 🛍️')); $offerBtnUrl = theme_option('banner_offer_modal_btn_url', url('/products')); $offerShowCountdown = theme_option('banner_offer_modal_show_countdown', 'yes') === 'yes'; $offerCountdownMinutes = (int) theme_option('banner_offer_modal_countdown_minutes', 15); if ($offerCountdownMinutes <= 0) { $offerCountdownMinutes = 15; } // --- 3. Color Brand Settings --- $colorBrand = theme_option('color_brand') ?: '#1d8751'; $colorBrandDark = theme_option('color_brand_dark') ?: '#166b40'; $colorBrand2 = theme_option('color_brand_2') ?: '#FDC040'; $colorBrandRgb = implode(',', BaseHelper::hexToRgb($colorBrand)); // Hide the coupon offer modal for a logged-in customer who already used it // (the plain image ad banner is not affected). if ($offerEnabled && auth('customer')->check() && app(\Theme\Nest\Services\CustomerDiscountService::class)->hasUsedWidget('banner_offer')) { $offerEnabled = false; } if (! $adEnabled && ! $offerEnabled) { return; } $offerClaimUrl = is_plugin_active('ecommerce') ? route('public.ajax.banner-offer.claim') : null; $offerCouponMode = theme_option('banner_offer_modal_coupon_mode', 'fixed'); $offerLoginUrl = route('customer.login'); @endphp {{-- ========================================================= --}} {{-- 1. AD BANNER POPUP MODAL (Clean Image + Link, 2-Min Timer) --}} {{-- ========================================================= --}} @if ($adEnabled && $adImage) @endif {{-- ========================================================= --}} {{-- 2. DISCOUNT OFFER MODAL (Badge, Coupon, Countdown, CTA) --}} {{-- ========================================================= --}} @if ($offerEnabled) @endif {{-- ========================================================= --}} {{-- 3. JAVASCRIPT CONTROLLER FOR BOTH POPUPS --}} {{-- ========================================================= --}}