@php // Render nothing unless the wheel is enabled and has configured segments. if (theme_option('nest_lucky_wheel_enabled', 'no') !== 'yes') { return; } $wheelSlices = app(\Theme\Nest\Services\CustomerDiscountService::class)->getWheelSlices(); if (empty($wheelSlices)) { return; } // Hide entirely for a logged-in customer who already used the wheel. if (auth('customer')->check() && app(\Theme\Nest\Services\CustomerDiscountService::class)->hasUsedWidget('lucky_wheel')) { return; } $wheelLoginUrl = route('customer.login'); $wheelColorBrand = theme_option('color_brand') ?: '#1d8751'; $wheelColorBrandDark = theme_option('color_brand_dark') ?: '#166b40'; $wheelColorBrand2 = theme_option('color_brand_2') ?: '#FDC040'; $wheelColorBrandRgb = implode(',', BaseHelper::hexToRgb($wheelColorBrand)); // Default palette used when a segment does not define its own colors. $wheelPalette = [ ['bg' => $wheelColorBrand, 'color' => '#ffffff'], ['bg' => '#f0fdf4', 'color' => $wheelColorBrandDark], ['bg' => $wheelColorBrand2, 'color' => '#1e293b'], ['bg' => '#ffffff', 'color' => '#1e293b'], ['bg' => $wheelColorBrandDark, 'color' => '#ffffff'], ['bg' => '#fffbeb', 'color' => '#92400e'], ]; // Static icon set (design only — not configured in admin). $wheelIcons = ['🎟️', '🚚', '🎁', '💰', '🏷️', '🔥']; $wheelPrizesForJs = []; foreach ($wheelSlices as $i => $s) { // Colors + icons are automatic (design stays tied to the system). $auto = $wheelPalette[$i % count($wheelPalette)]; $wheelPrizesForJs[] = [ 'text' => $s['prize_text'] ?? '', 'sub' => $s['prize_sub'] ?? '', 'code' => $s['coupon_code'] ?? '', 'icon' => $wheelIcons[$i % count($wheelIcons)], 'bg' => $auto['bg'], 'color' => $auto['color'], ]; } $wheelSpinUrl = route('public.ajax.lucky-wheel.spin'); // Editable texts (design is fixed; only the content is configurable). $wheelBadge = theme_option('nest_lucky_wheel_badge', 'أرخص سعر بالسنة 🔥'); $wheelTitle = theme_option('nest_lucky_wheel_title', 'مبروك! 🎉'); $wheelSubtitle = theme_option('nest_lucky_wheel_subtitle', 'الخطوة الأخيرة: استلمي جائزتك الحصرية'); $wheelSpinText = theme_option('nest_lucky_wheel_spin_text', 'دَوّر'); $wheelTimerLabel = theme_option('nest_lucky_wheel_timer_label', 'تنتهي في'); $wheelWinText = theme_option('nest_lucky_wheel_win_text', '🎉 ألف مبروك فزت بـ:'); $wheelCtaText = theme_option('nest_lucky_wheel_cta_text', 'استلميها وابدي اشتري'); $wheelShopText = theme_option('nest_lucky_wheel_shop_text', 'تصفح العروض الآن'); $wheelShopUrl = theme_option('nest_lucky_wheel_shop_url', '/products') ?: '/products'; $wheelCountdownDays = max((int) theme_option('nest_lucky_wheel_countdown_days', 3), 0); $wheelDelay = max((int) theme_option('nest_lucky_wheel_delay', 3), 0); $wheelFrequency = theme_option('nest_lucky_wheel_frequency', 'once_per_session'); @endphp