@php /* |-------------------------------------------------------------------------- | Theme |-------------------------------------------------------------------------- */ $theme = array_merge( [ 'primary' => '#112d5c', 'primary_dark' => '#081c3d', 'accent' => '#d9b66b', 'accent_dark' => '#b28a3e', 'accent_light' => '#f0d89e', 'secondary' => '#668c21', 'secondary_dark' => '#4e7017', 'background' => '#fffdf8', 'surface' => '#ffffff', 'text' => '#282828', 'muted' => '#6c6c6c', ], (array) ($landingPage->theme ?? []) ); /* |-------------------------------------------------------------------------- | SEO |-------------------------------------------------------------------------- */ $seo = (array) ($landingPage->seo ?? []); $metaTitle = data_get($seo, 'meta_title') ?: $landingPage->title; $metaDescription = data_get($seo, 'meta_description') ?: \Illuminate\Support\Str::limit( strip_tags( (string) ( $product->short_description ?: $product->name ) ), 160 ); /* |-------------------------------------------------------------------------- | Images |-------------------------------------------------------------------------- */ $resolveImage = function ($image) { if (! $image) { return null; } $url = data_get($image, 'url') ?: data_get($image, 'image_url'); if (filled($url)) { return $url; } $path = data_get( $image, 'image_path' ); if (blank($path)) { return null; } return \App\Models\Product::resolveMediaUrl( $path ); }; $productImages = $product ->images ->map($resolveImage) ->filter() ->values(); $mainImage = $product->image_url ?: $productImages->get(0) ?: asset( 'images/product-placeholder.png' ); $image2 = $productImages->get( 1, $mainImage ); $image3 = $productImages->get( 2, $image2 ); $promoImage = $productImages->get( 3, $image3 ); /* |-------------------------------------------------------------------------- | Variants |-------------------------------------------------------------------------- */ $variants = $product->activeVariants; $defaultVariant = $variants->firstWhere( 'is_default', true ) ?: $variants->first(); if ( $product->has_variants && $defaultVariant ) { $basePrice = (float) ( $defaultVariant->sale_price ?? $defaultVariant->regular_price ?? 0 ); $regularPrice = (float) ( $defaultVariant->regular_price ?? $basePrice ); } else { $basePrice = (float) $product->final_price; $regularPrice = (float) $product->regular_price; } /* |-------------------------------------------------------------------------- | Maximum Quantity |-------------------------------------------------------------------------- */ $maxQuantity = 100; if (! $product->pre_order_enabled) { if ( $product->has_variants && $defaultVariant && $defaultVariant->track_stock ) { $maxQuantity = max( 1, min( 100, (int) $defaultVariant->stock_quantity ) ); } elseif ( ! $product->has_variants && $product->track_stock ) { $maxQuantity = max( 1, min( 100, (int) $product->stock_quantity ) ); } } /* |-------------------------------------------------------------------------- | Sections |-------------------------------------------------------------------------- */ $enabledSections = $sections ->filter( fn ($section) => $section->is_enabled ) ->sortBy('sort_order') ->values(); $heroSection = $sections->firstWhere( 'type', 'hero' ); $benefitsSection = $sections->firstWhere( 'type', 'benefits' ); $promoSection = $sections->firstWhere( 'type', 'promo' ); $usageSection = $sections->firstWhere( 'type', 'usage' ); $reviewsSection = $sections->firstWhere( 'type', 'reviews' ); $orderSection = $sections->firstWhere( 'type', 'order' ); $footerSection = $sections->firstWhere( 'type', 'footer' ); $heroContent = (array) optional( $heroSection )->content; $benefitsContent = (array) optional( $benefitsSection )->content; $promoContent = (array) optional( $promoSection )->content; $usageContent = (array) optional( $usageSection )->content; $reviewsContent = (array) optional( $reviewsSection )->content; $orderContent = (array) optional( $orderSection )->content; $footerContent = (array) optional( $footerSection )->content; /* |-------------------------------------------------------------------------- | Custom Hero Images |-------------------------------------------------------------------------- */ $heroMainImage = data_get( $heroContent, 'main_image_url' ) ?: $mainImage; $heroSideImage1 = data_get( $heroContent, 'side_image_1_url' ) ?: $image2; $heroSideImage2 = data_get( $heroContent, 'side_image_2_url' ) ?: $image3; /* |-------------------------------------------------------------------------- | Benefit Items |-------------------------------------------------------------------------- */ $benefits = collect( data_get( $benefitsContent, 'items', [] ) ) ->filter() ->values(); while ($benefits->count() < 6) { $benefits->push( 'পণ্যের সুবিধা এখানে লিখুন' ); } /* |-------------------------------------------------------------------------- | Usage Features |-------------------------------------------------------------------------- */ $usageFeatures = collect( data_get( $usageContent, 'features', [] ) ) ->filter() ->values(); if ($usageFeatures->isEmpty()) { $usageFeatures = collect([ '১০০% অরিজিনাল', 'দ্রুত ডেলিভারি', 'ক্যাশ অন ডেলিভারি', ]); } /* |-------------------------------------------------------------------------- | Reviews |-------------------------------------------------------------------------- */ $reviews = collect( data_get( $reviewsContent, 'items', [] ) ) ->filter( fn ($review) => filled( data_get( $review, 'text' ) ) ) ->values(); /* |-------------------------------------------------------------------------- | Footer Contact |-------------------------------------------------------------------------- */ $whatsapp = preg_replace( '/\D+/', '', (string) data_get( $footerContent, 'whatsapp_number', '8801732474420' ) ); $phone = preg_replace( '/\D+/', '', (string) data_get( $footerContent, 'phone_number', $whatsapp ) ); /* |-------------------------------------------------------------------------- | Default Delivery Area |-------------------------------------------------------------------------- */ $defaultDeliveryArea = $deliveryAreas->first(); /* |-------------------------------------------------------------------------- | JS Configuration |-------------------------------------------------------------------------- */ $landingPageJsData = [ 'preview' => (bool) $previewMode, 'pageId' => (int) $landingPage->id, 'productId' => (int) $product->id, 'productName' => (string) $product->name, 'productImage' => (string) $mainImage, 'basePrice' => (float) $basePrice, 'maxQuantity' => (int) $maxQuantity, 'quoteUrl' => route( 'landing-pages.quote', $landingPage ), 'incompleteUrl' => route( 'landing-pages.incomplete', $landingPage ), 'orderUrl' => route( 'landing-pages.order', $landingPage ), 'csrf' => csrf_token(), 'successTitle' => data_get( $orderContent, 'success_title', 'অর্ডার গ্রহণ করা হয়েছে' ), 'successText' => data_get( $orderContent, 'success_text', 'ধন্যবাদ। আপনার অর্ডার সফলভাবে গ্রহণ করা হয়েছে।' ), 'variants' => $variants ->map( function ($variant) use ($product) { $price = (float) ( $variant->sale_price ?? $variant->regular_price ?? 0 ); if ( $product->pre_order_enabled || ! $variant->track_stock ) { $maximum = 100; } else { $maximum = max( 1, min( 100, (int) $variant->stock_quantity ) ); } return [ 'id' => (int) $variant->id, 'name' => (string) $variant->name, 'price' => $price, 'regular_price' => (float) $variant->regular_price, 'max_quantity' => $maximum, ]; } ) ->values() ->all(), ]; @endphp {{ $metaTitle }} @if( filled( data_get( $seo, 'meta_keywords' ) ) ) @endif @if(! $previewMode) @endif {{-- Google Fonts --}} {{-- Font Awesome --}} {{-- AOS --}} {{-- Swiper --}} @if($previewMode)
ADMIN PREVIEW Preview mode-এ order submit হবে না
@endif @foreach( $enabledSections as $section ) @php $content = (array) $section->content; @endphp {{-- ================================================================ HERO ================================================================= --}} @if( $section->type === 'hero' )

{{ data_get( $content, 'title_1', 'মাত্র ৭ দিনেই' ) }} {{ data_get( $content, 'title_2', 'আপনার প্রয়োজনের সেরা সমাধান' ) }} {{ data_get( $content, 'title_3', $product->name ) }}

@php $rating = max( 0, min( 5, (float) data_get( $content, 'rating', 4.8 ) ) ); $fullStars = (int) floor( $rating ); @endphp @for( $star = 1; $star <= 5; $star++ ) @if( $star <= $fullStars ) @else @endif @endfor
{{ data_get( $content, 'promise_title', 'প্রিমিয়াম মানের পণ্য' ) }} {{ data_get( $content, 'promise_text', strip_tags( (string) $product->short_description ) ) }}
{{ data_get( $content, 'refund_text', 'সন্তুষ্ট না হলে ১০০% টাকা ফেরত' ) }}
{{ data_get( $content, 'customer_heading', 'উপকৃত হয়েছেন' ) }}
Customer Customer Customer Customer
{{ data_get( $content, 'customer_count', '০২ লক্ষ+ কাস্টমারস' ) }}
{{ $product->name }} {{ $product->name }} {{ $product->name }}
{{-- ================================================================ BENEFITS ================================================================= --}} @elseif( $section->type === 'benefits' ) @php $sectionBenefits = collect( data_get( $content, 'items', [] ) ) ->filter() ->values(); while ( $sectionBenefits->count() < 6 ) { $sectionBenefits->push( 'পণ্যের সুবিধা এখানে লিখুন' ); } @endphp

{{ data_get( $content, 'heading', $product->name ) }}

{{ data_get( $content, 'subheading', 'যে সুবিধাগুলো পাবেন' ) }}
প্রকৃতির ছোঁয়ায়
সেরা সমাধান
{{ $product->name }}
@php $badgeText = trim( (string) data_get( $content, 'badge', '100% QUALITY' ) ); @endphp
100% {{ str_ireplace( '100%', '', $badgeText ) }}
{{ $sectionBenefits->get(0) }}
{{ $sectionBenefits->get(1) }}
{{ $sectionBenefits->get(2) }}
{{ $sectionBenefits->get(3) }}
{{ $sectionBenefits->get(4) }}
{{ $sectionBenefits->get(5) }}
{{-- ================================================================ PROMO ================================================================= --}} @elseif( $section->type === 'promo' )
{{ $product->name }}
{{ data_get( $content, 'eyebrow', 'NEBULOID SELECTED PRODUCT' ) }}

{{ data_get( $content, 'title', $product->name ) }}

{{ data_get( $content, 'text', strip_tags( (string) $product->short_description ) ) }}

{{-- ================================================================ USAGE ================================================================= --}} @elseif( $section->type === 'usage' ) @php $sectionFeatures = collect( data_get( $content, 'features', [] ) ) ->filter() ->values(); if ( $sectionFeatures->isEmpty() ) { $sectionFeatures = collect([ '১০০% অরিজিনাল', 'দ্রুত ডেলিভারি', 'ক্যাশ অন ডেলিভারি', ]); } @endphp

{{ data_get( $content, 'title', 'সহজ ব্যবহারবিধি' ) }}

{{ data_get( $content, 'text', 'পণ্যের নির্দেশনা অনুযায়ী ব্যবহার করুন' ) }} {{ data_get( $content, 'highlight', 'সেরা ফলাফলের জন্য নিয়মিত ব্যবহার করুন' ) }}

@foreach( $sectionFeatures as $featureIndex => $feature )
{{ $feature }}
@endforeach
{{-- ================================================================ REVIEWS ================================================================= --}} @elseif( $section->type === 'reviews' ) @php $sectionReviews = collect( data_get( $content, 'items', [] ) ) ->filter( fn ($review) => filled( data_get( $review, 'text' ) ) ) ->values(); @endphp @if( $sectionReviews->isNotEmpty() )

{{ data_get( $content, 'heading', 'আমাদের কাস্টমারদের অভিজ্ঞতা' ) }}

{{ data_get( $content, 'subheading', 'নিয়মিত ব্যবহারকারীদের কিছু অভিজ্ঞতা' ) }}

@foreach( $sectionReviews as $reviewIndex => $review ) @php $reviewImage = data_get( $review, 'image_url' ) ?: $productImages->get( $reviewIndex % max( 1, $productImages->count() ), $mainImage ); $reviewRating = max( 1, min( 5, (int) data_get( $review, 'rating', 5 ) ) ); @endphp

{{ data_get( $review, 'text' ) }}

{{ data_get(
                                                        $review,
                                                        'name',
                                                        'Customer'
                                                    ) }}
{{ data_get( $review, 'name', 'ভেরিফাইড কাস্টমার' ) }} {{ data_get( $review, 'location', 'Bangladesh' ) }}
{{ $product->name }}
@endforeach
@endif {{-- ================================================================ ORDER ================================================================= --}} @elseif( $section->type === 'order' )

{{ data_get( $content, 'title', 'অর্ডার ফর্ম' ) }}

{{ data_get( $content, 'subtitle', 'অর্ডারটি সম্পন্ন করতে নিচের তথ্যগুলো পূরণ করুন' ) }}

{{ data_get( $content, 'refund_text', 'সন্তুষ্ট না হলে ১০০% টাকা ফেরত' ) }}

Your Product

@csrf
{{-- Billing --}}

Billing details

{{-- Product Variant --}} @if( $product->has_variants && $variants->isNotEmpty() )
@endif {{-- Delivery --}} {{ data_get( $content, 'delivery_heading', 'ডেলিভারি এলাকা' ) }} *
@foreach( $deliveryAreas as $areaIndex => $area ) @endforeach
{{-- Summary --}}

Your order

Product Subtotal
{{ $product->name }} {{ $product->name }} × 1 @if( $product->has_variants ) {{ optional( $defaultVariant )->name }} @else @endif
{{ number_format( $basePrice, 0 ) }}৳
Unit price {{ number_format( $basePrice, 0 ) }}৳
Subtotal {{ number_format( $basePrice, 0 ) }}৳
Delivery Calculating...
Total {{ number_format( $basePrice, 0 ) }}৳

{{ data_get( $content, 'payment_title', 'ক্যাশ অন ডেলিভারি (COD)' ) }}

{{ data_get( $content, 'payment_text', 'পণ্য হাতে পাওয়ার পর মূল্য পরিশোধ করবেন।' ) }}

আপনার নাম, ফোন নাম্বার এবং পূর্ণ ঠিকানা সঠিকভাবে লিখুন। পণ্য হাতে পাওয়ার পর মূল্য পরিশোধ করবেন।

{{-- ================================================================ FOOTER ================================================================= --}} @elseif( $section->type === 'footer' ) @if( $landingPage->show_footer_products && $footerProducts->isNotEmpty() ) @endif @endif @endforeach {{-- ========================================================================== Floating WhatsApp ============================================================================ --}} @if( ! $previewMode && filled($whatsapp) ) @endif {{-- ========================================================================== Mobile Order ============================================================================ --}} @if( ! $previewMode && optional( $orderSection )->is_enabled )   এখনই অর্ডার করুন @endif {{-- ========================================================================== Toast ============================================================================ --}} {{-- ========================================================================== Success Modal ============================================================================ --}} {{-- ========================================================================== JavaScript Data ============================================================================ --}}