@extends('layout.front.master')
@section('title', config('site.seo.title', config('site.name')))
@section('description', config('site.seo.description', ''))
@section('keywords', config('site.seo.keywords', ''))
@section('content')
{{-- ───────────────────────── HERO SLIDER ─────────────────────────
Fuente: $carouselImages del WelcomeCarouselController (editable
desde /admin/welcomecarousel). Fallback: 2 slides hardcoded con
defaults del demo si el módulo no inyecta data o está vacío.
--}}
@php
// Slides desde el módulo WelcomeCarousel. Cada slide tiene:
// image_path, title, subtitle, caption (opcionales)
$hasCarousel = isset($carouselImages) && $carouselImages->count() > 0;
// Fallback: 2 slides hardcoded con assets default + textos config
$defaultSlides = collect([
(object) [
'image_path' => site_asset_url('hero_background', 'cd-project/img/demos/medical/slides/slide-medical-1.jpg'),
'title' => config('site.welcome.hero1_headline', 'ESPECIALISTAS'),
'subtitle' => config('site.welcome.hero1_subheadline', '20 años cuidando de vos'),
'caption' => config('site.welcome.hero1_caption', config('site.contact.address', 'Atención de primer nivel')),
],
(object) [
'image_path' => site_asset_url('hero_background_2', 'cd-project/img/demos/medical/slides/slide-medical-2.jpg'),
'title' => config('site.welcome.hero2_headline', 'PEDÍ TU TURNO'),
'subtitle' => config('site.welcome.hero2_subheadline', 'Reservá online o por WhatsApp'),
'caption' => config('site.welcome.hero2_caption', 'Atención online y presencial'),
],
]);
$slides = $hasCarousel ? $carouselImages : $defaultSlides;
@endphp
@foreach($slides as $slide)
@php
$imageUrl = filter_var($slide->image_path, FILTER_VALIDATE_URL)
? $slide->image_path
: asset($slide->image_path);
$slideTitle = $slide->title ?? '';
$slideSubtitle = $slide->subtitle ?? '';
$slideCaption = $slide->caption ?? ($slide->description ?? '');
@endphp
@if($slideTitle)
@endif
@if($slideSubtitle)
@endif
@if($slideCaption)
@endif
@endforeach
@foreach($slides as $i => $slide)
@endforeach
{{-- ───────────────────────── 4 BOXES INFO ───────────────────────── --}}
{{-- Box 1: Atención médica --}}
{{ config('site.welcome.box1_title', __('Atención médica')) }}
{{-- Box 2: Especialidades (link a /services) --}}
{{-- Box 3: Horarios (expanded al hover) --}}
@php $hw = explode(':', config('site.contact.hours_weekday', 'Lun-Vie : 8:30 a 19:00'), 2); @endphp
{{ trim($hw[0]) }}
{{ trim($hw[1] ?? '') }}
@php $hs = explode(':', config('site.contact.hours_saturday', 'Sábado : 9:00 a 13:00'), 2); @endphp
{{ trim($hs[0]) }}
{{ trim($hs[1] ?? '') }}
@php $hd = explode(':', config('site.contact.hours_sunday', 'Domingo : cerrado'), 2); @endphp
{{ trim($hd[0]) }}
{{ trim($hd[1] ?? '') }}
{{ config('site.welcome.box3_title', __('Horarios de atención')) }}
{{-- Box 4: Urgencias --}}
{{-- ───────────────────────── ABOUT PREVIEW ───────────────────────── --}}
{{ config('site.welcome.about_heading', __('Sobre nosotros')) }}
{{ config('site.welcome.about_subtitle', config('site.tagline', __('Atención médica integral y humana'))) }}
{{ config('site.welcome.about_text', config('site.description', __('Somos un equipo de profesionales comprometidos con tu salud. Combinamos experiencia clínica, tecnología y atención personalizada para acompañarte en cada paso.'))) }}
{{ __('Conocernos') }}
@php $aboutImg = config('site.welcome.about_image', 'cd-project/img/demos/medical/gallery/gallery-1.jpg'); @endphp
{{-- ───────────────────────── SERVICES / DEPARTAMENTOS ───────────────────────── --}}
@if(is_module_active('services') && isset($services) && $services->count() > 0)
{{ config('site.welcome.services_heading', __('Especialidades')) }}
{{ config('site.welcome.services_subtitle', __('Nuestras áreas de atención')) }}
@foreach($services->take(6) as $index => $service)
@php
$serviceIcon = $service->icon ?? null;
$serviceImg = $service->header ?? null;
@endphp
@if($serviceImg && !filter_var($serviceImg, FILTER_VALIDATE_URL) === false)
@elseif($serviceIcon)
@else
@endif
{{ \Illuminate\Support\Str::limit(strip_tags($service->description ?? $service->content ?? ''), 120) }}
@endforeach
@endif
{{-- ───────────────────────── BLOG PREVIEW (RESOURCES STYLE) ───────────────────────── --}}
@php
// El controller inyecta $featuredPosts o $recentPosts según el demo. Soporto ambos.
$welcomePosts = $featuredPosts ?? ($recentPosts ?? ($posts ?? collect()));
@endphp
@if(is_module_active('blog') && $welcomePosts->count() > 0)
{{ config('site.welcome.blog_heading', __('Guía de salud y bienestar')) }}
{{ config('site.welcome.blog_subtitle', __('Información útil para tu bienestar')) }}
@foreach($welcomePosts->take(3) as $index => $post)
@php
$postImg = $post->header
?: asset('cd-project/img/demos/medical/blog/blog-' . (($index % 3) + 1) . '.jpg');
@endphp
@endforeach
@endif
{{-- ───────────────────────── PRODUCTS — destacados con slider ───────────────────────── --}}
@if(is_module_active('products'))
@php
// Cargamos los 8 productos más recientes activos. Owl Carousel los
// muestra en slides según breakpoint (4 cols desktop / 2 tablet / 1 mobile).
$featuredProducts = \App\Modules\Products\Models\Product::where('is_active', true)
->with('images', 'category')
->orderBy('id', 'desc')
->limit(8)
->get();
@endphp
@if($featuredProducts->count() > 0)
{{-- Header de sección --}}
Productos destacados
Suplementos formulados con criterio clínico + material educativo y programas digitales.
{{-- Slider Owl Carousel: 4 col desktop / 3 lg / 2 md / 1 sm --}}
@foreach($featuredProducts as $product)
@php $img = $product->images->first()->image_path ?? null; @endphp
{{-- Badges --}}
@if($product->created_at && $product->created_at->gt(now()->subDays(30)))
NUEVO
@endif
@if($product->is_digital)
DIGITAL
@endif
@if($img)
@else
@endif
@if($product->category)
{{ $product->category->name }}
@endif
${{ number_format($product->price, 0, ',', '.') }}
@if($product->quantity_label)
{{ $product->quantity_label }}
@endif
@endforeach
@endif
@endif
{{-- ───────────────────────── TESTIMONIALS ───────────────────────── --}}
@if(is_module_active('testimonials') && isset($testimonials) && $testimonials->count() > 0)
@foreach($testimonials as $t)
"
{{ $t->content ?? $t->testimonial }}
{{ $t->author ?? $t->name }}
@if(!empty($t->position) || !empty($t->title))
{{ $t->position ?? $t->title }}
@endif
@endforeach
@endif
@endsection