diff --git a/app/Filament/Admin/Resources/Products/Schemas/LandingPageSection.php b/app/Filament/Admin/Resources/Products/Schemas/LandingPageSection.php index 167c60f..abcbe5c 100644 --- a/app/Filament/Admin/Resources/Products/Schemas/LandingPageSection.php +++ b/app/Filament/Admin/Resources/Products/Schemas/LandingPageSection.php @@ -96,122 +96,7 @@ class LandingPageSection ]) ->columns(2) ->collapsible() - ->collapsed(), - - // App Features Section - Section::make(__('products.app_features_section')) - ->schema([ - Repeater::make('landing_page_data.features') - ->label(__('products.features')) - ->schema([ - Select::make('icon') - ->label(__('products.feature_icon')) - ->options($iconOptions) - ->searchable(), - TextInput::make('title') - ->label(__('products.feature_title')) - ->columnSpanFull(), - Textarea::make('description') - ->label(__('products.feature_description')) - ->rows(2) - ->columnSpanFull(), - ]) - ->columns(1) - ->defaultItems(0) - ->addActionLabel(__('products.add_feature')) - ->reorderable() - ->collapsible() - ->itemLabel(fn (array $state): ?string => $state['title'] ?? __('products.feature') . ' #' . ($state['_index'] ?? '')) - ->columnSpanFull(), - - // Note: Translations should match the order of features above - // Each feature translation array index should correspond to the feature index - ]) - ->collapsible() - ->collapsed(), - - // How It Works Section - Section::make(__('products.how_it_works_section')) - ->schema([ - FileUpload::make('landing_page_data.how_it_works.download_image') - ->label(__('products.how_it_works_image')) - ->image() - ->disk('public') - ->directory('products/landing') - ->columnSpanFull(), - TextInput::make('landing_page_data.how_it_works.download_form_label') - ->label(__('products.download_form_label')) - ->placeholder(__('products.download_form_label_placeholder')) - ->columnSpanFull(), - - // Steps (4 steps with translations) - Repeater::make('landing_page_data.how_it_works.steps') - ->label(__('products.steps')) - ->schema([ - TextInput::make('number') - ->label(__('products.step_number')) - ->numeric() - ->default(fn ($get) => ($get('../../../_index') ?? 0) + 1), - TextInput::make('title') - ->label(__('products.step_title')) - ->columnSpanFull(), - Textarea::make('description') - ->label(__('products.step_description')) - ->rows(2) - ->columnSpanFull(), - ]) - ->columns(1) - ->defaultItems(0) - ->reorderable() - ->collapsible() - ->itemLabel(fn (array $state): ?string => __('products.step') . ' ' . ($state['number'] ?? '') . ': ' . ($state['title'] ?? '')) - ->columnSpanFull(), - - // Note: Steps translations should match the order of steps above - // Each step translation array index should correspond to the step index - ]) - ->collapsible() - ->collapsed(), - - // Video Section - Section::make(__('products.video_section')) - ->schema([ - TextInput::make('landing_page_data.video.youtube_video_id') - ->label(__('products.youtube_video_id')) - ->placeholder('165101721') - ->helperText(__('products.youtube_video_id_helper')) - ->columnSpanFull(), - ]) - ->collapsible() - ->collapsed(), - - // FAQ Section - Section::make(__('products.faq_section')) - ->schema([ - Repeater::make('landing_page_data.faqs') - ->label(__('products.faqs')) - ->schema([ - TextInput::make('question') - ->label(__('products.faq_question')) - ->columnSpanFull(), - Textarea::make('answer') - ->label(__('products.faq_answer')) - ->rows(3) - ->columnSpanFull(), - ]) - ->columns(1) - ->defaultItems(0) - ->addActionLabel(__('products.add_faq')) - ->reorderable() - ->collapsible() - ->itemLabel(fn (array $state): ?string => $state['question'] ?? __('products.faq') . ' #' . ($state['_index'] ?? '')) - ->columnSpanFull(), - - // Note: FAQ translations should match the order of FAQs above - // Each FAQ translation array index should correspond to the FAQ index - ]) - ->collapsible() - ->collapsed(), + ->collapsed(false), ]) ->visible(fn (Get $get) => $get('type') === 'product') ->columnSpanFull(); diff --git a/app/Http/Controllers/ProductController.php b/app/Http/Controllers/ProductController.php index 4f05fbe..045a231 100644 --- a/app/Http/Controllers/ProductController.php +++ b/app/Http/Controllers/ProductController.php @@ -74,12 +74,7 @@ class ProductController extends Controller return view($product->view_template, compact('product', 'settings', 'renderedHeader', 'renderedFooter', 'meta')); } - // Use landing page template if landing_page_data exists - if (!empty($product->landing_page_data)) { - return view('front.products.landing', compact('product', 'settings', 'renderedHeader', 'renderedFooter', 'meta')); - } - - // Default view - return view('front.products.show', compact('product', 'settings', 'renderedHeader', 'renderedFooter', 'meta')); + // Use landing page template (Hero only) for all products + return view('front.products.landing', compact('product', 'settings', 'renderedHeader', 'renderedFooter', 'meta')); } } diff --git a/resources/views/front/products/landing.blade.php b/resources/views/front/products/landing.blade.php index 60bad3d..7d26456 100644 --- a/resources/views/front/products/landing.blade.php +++ b/resources/views/front/products/landing.blade.php @@ -10,11 +10,14 @@ use Illuminate\Support\Facades\Storage; @php $landingData = $product->landing_page_data ?? []; $hero = $landingData['hero'] ?? []; - $features = $landingData['features'] ?? []; - $howItWorks = $landingData['how_it_works'] ?? []; - $steps = $howItWorks['steps'] ?? []; - $video = $landingData['video'] ?? []; - $faqs = $landingData['faqs'] ?? []; + + // Fallback if hero data is empty + if (empty($hero['slogan']) && empty($hero['sub_slogan']) && empty($hero['featured_image'])) { + $hero['slogan'] = $product->translate('title'); + $hero['sub_slogan'] = Str::limit(strip_tags($product->translate('content')), 160); + $hero['featured_image'] = $product->hero_image; + } + $currentLang = app()->getLocale(); // Helper function to get translated value with fallback @@ -43,7 +46,7 @@ use Illuminate\Support\Facades\Storage; @endif
{{ $stepDescription }}
- @endif -{{ $stepDescription }}
- @endif -