@extends('layouts.app') @section('title', 'LaravelStore - Sua Loja Online') @section('content') {{-- Dynamic Hero Section --}} @php $hero = $sections->firstWhere('section_key', 'hero'); @endphp @if($hero && $hero->is_active)
@if($hero->image) {{ $hero->title }} @endif

{{ $hero->title ?? 'Bem-vindo à nossa Loja' }}

{{ $hero->subtitle ?? 'Encontre os melhores produtos com preços especiais.' }}

@if($hero->button_text) {{ $hero->button_text }} @endif
@else

Bem-vindo à nossa Loja

Encontre os melhores produtos com preços especiais.

Ver Produtos
@endif {{-- Produtos em Destaque + Categorias --}}

Produtos em Destaque

Ver Todos
@forelse($products as $product) @php $hasActiveDiscount = $product->hasDiscount(); $hasScheduledDiscount = $product->hasScheduledDiscount(); $discountPercent = $hasActiveDiscount ? $product->getDiscountPercent() : 0; $hasCoupon = $activeCoupons->first(fn($c) => $c->appliesToProduct($product->id)); @endphp
@php $imgSource = $product->featured_image ?: $product->image; $imgSrc = null; if ($imgSource) { if (str_starts_with($imgSource, 'data:') || str_starts_with($imgSource, 'http')) { $imgSrc = $imgSource; } elseif (str_starts_with($imgSource, '/storage/')) { $imgSrc = asset(substr($imgSource, 1)); } else { $imgSrc = asset('storage/' . $imgSource); } } @endphp @if($imgSrc) {{ $product->name }} @else
@endif
{{ $product->is_digital ? 'Digital' : 'Físico' }} @if($hasCoupon) Cupão @endif @if($hasActiveDiscount) -{{ $discountPercent }}% @elseif($hasScheduledDiscount) Breve @endif
{{ $product->name }}

{{ Str::limit($product->description, 40) }}

@if($hasActiveDiscount) {{ number_format($product->price, 2) }}€ {{ number_format($product->discount_price, 2) }}€ @else {{ number_format($product->price, 2) }}€ @endif
@if($hasActiveDiscount && $product->getDiscountEndFormatted()) Termina {{ $product->getDiscountEndFormatted() }} @elseif($hasScheduledDiscount) Inicia {{ $product->getDiscountStartFormatted() }} @endif @if($product->shipping_cost > 0) Envio: {{ number_format($product->shipping_cost, 2) }}€ @else Envio Grátis @endif Ver Produto @if($product->is_used) USADO @endif
@php $productUrl = urlencode(route('product', $product->slug)); $productName = urlencode($product->name); @endphp @if($product->share_facebook) @else @endif @if($product->share_whatsapp) @else @endif @if($product->share_instagram) @else @endif
@empty

Sem produtos em destaque.

@endforelse

Categorias

@forelse($categories as $category) @empty

Sem categorias.

@endforelse
{{-- Dynamic Sections (Features, Newsletter, etc.) - Depois dos Produtos --}} @foreach($sections as $section) @if($section->section_key !== 'hero') @if($section->section_key === 'features') @include('shop.sections.features', ['section' => $section]) @elseif($section->section_key === 'newsletter') @include('shop.sections.newsletter', ['section' => $section]) @else @include('shop.sections.generic', ['section' => $section]) @endif @endif @endforeach @endsection @push('scripts') @endpush