@php
$badgeText = $data['badge_text'] ?? "";
$title = $data['title'] ?? "";
$subtitle = $data['subtitle'] ?? "";
$showDescription = $data['show_description'] ?? true;
$showFeatures = $data['show_features'] ?? true;
$showBadge = $data['show_badge'] ?? true;
$showTestsCount = $data['show_tests_count'] ?? true;
$showOldPrice = $data['show_old_price'] ?? true;
$cardHover = $data['card_hover_effect'] ?? true;
$aspectRatio = $data['image_aspect_ratio'] ?? 'video';
$buttonsConfig = $data['buttons'] ?? [];
// Currency Logic (Global vs Local)
$useGlobalCurrency = $data['use_global_currency'] ?? true;
$siteSettings = app(\App\Settings\SiteSettings::class);
if ($useGlobalCurrency) {
$currencyType = $siteSettings->currency_type ?? 'text';
$currencyText = $siteSettings->currency_text ?? 'ريال';
$currencySvg = $siteSettings->currency_svg ?? '';
$currencyImage = $siteSettings->currency_image ?? '';
$currencyPos = $siteSettings->currency_position ?? 'after';
$currencyIconSize = $siteSettings->currency_icon_size ?? 18;
$priceTagBg = $siteSettings->price_tag_bg ?? '#FFFFFF';
$priceTagColor = $siteSettings->price_tag_color ?? '#000000';
} else {
$currencyType = $data['currency_type'] ?? 'text';
$currencyText = $data['currency_text'] ?? 'ريال';
$currencySvg = $data['currency_svg'] ?? '';
$currencyImage = $data['currency_image'] ?? '';
$currencyPos = $data['currency_position'] ?? 'after';
$currencyIconSize = $data['currency_icon_size'] ?? 18; // Fallback or local
$priceTagBg = $data['price_tag_bg'] ?? '#FFFFFF';
$priceTagColor = $data['price_tag_text_color'] ?? '#000000';
}
$currencyHtml = '';
if ($currencyType === 'text') {
$currencyHtml = '' . e($currencyText) . '';
} elseif ($currencyType === 'svg') {
$currencyHtml = '' . $currencySvg . '';
} elseif ($currencyType === 'image' && $currencyImage) {
$currencyHtml = '';
}
// Default legacy button fallback if no buttons repeater data
if (empty($buttonsConfig)) {
$buttonsConfig = [
['text' => $data['button_text'] ?? "تفاصيل الباقة", 'action' => 'details', 'style' => 'primary'],
['text' => "التفاصيل", 'action' => 'details', 'style' => 'outline']
];
}
// Carousel settings
$carouselSpeed = ($data['carousel_speed'] ?? 10) * 1000;
// Get dynamic categories
$categories = collect($data['package_categories'] ?? []);
$hasAnyPackages = false;
// Gather all package IDs to fetch in one query
$allPackageIds = collect();
foreach ($categories as $category) {
if (!empty($category['packages'])) {
$allPackageIds = $allPackageIds->merge($category['packages']);
}
}
// Fetch packages
$packagesData = \App\Models\Package::active()
->whereIn('id', $allPackageIds->unique())
->get()
->keyBy('id');
$hasAnyPackages = $categories->count() > 0 && $packagesData->count() > 0;
// Package images (fallback)
$pkgImages = [
'https://images.unsplash.com/photo-1579684385127-1ef15d508118?w=400&q=80',
'https://images.unsplash.com/photo-1530497610245-94d3c16cda28?w=400&q=80',
'https://images.unsplash.com/photo-1505751172876-fa1923c5c528?w=400&q=80',
'https://images.unsplash.com/photo-1584308666744-24d5c474f2ae?w=400&q=80',
'https://images.unsplash.com/photo-1576091160399-112ba8d25d1d?w=400&q=80',
];
@endphp
@if($hasAnyPackages)
{{-- Packages Section CSS - matching prismad.html --}}
{{ $subtitle }}
{{ strip_tags($package->description) }}
@endif