@extends('layout.front.master') @section('title', $seoData['title'] ?? config('site.name')) @section('description', $seoData['description'] ?? config('site.seo.description', '')) @section('keywords', $seoData['keywords'] ?? config('site.seo.keywords', '')) @section('og_title', $seoData['og_title'] ?? config('site.name')) @section('og_description', $seoData['og_description'] ?? config('site.seo.description', '')) @section('content') @php use App\Models\TenantProject; use App\Modules\Products\Models\Product; use App\Modules\Products\Models\ProductCategory; // Si el user está logueado como Client, cargamos sus proyectos para mostrar // el ClientHub al principio (versión "logged" del home — enfocada en gestión). $isClient = auth()->check() && auth()->user()->hasRole('Client'); $clientProjects = collect(); $clientOpenTickets = 0; if ($isClient) { $clientProjects = auth()->user()->tenantProjects() ->orderByDesc('created_at') ->get(); try { $clientOpenTickets = \App\Modules\Support\Models\SupportTicket::where('user_id', auth()->id()) ->whereIn('status', ['open', 'waiting_staff', 'waiting_client']) ->count(); } catch (\Throwable $e) { /* support module puede no estar */ } } $hasCarouselImage = isset($carouselImages) && $carouselImages->count() > 0; $heroBg = $hasCarouselImage ? (filter_var($carouselImages->first()->image_path, FILTER_VALIDATE_URL) ? $carouselImages->first()->image_path : asset($carouselImages->first()->image_path)) : null; $siteName = config('site.name', ''); $siteTagline = config('site.tagline', ''); $siteDescription = config('site.description', ''); $whatsappUrl = config('site.social_media.whatsapp.url', ''); // Datos del marketplace para las nuevas secciones (Featured + Industrias) try { $featuredProducts = Product::with('category') ->where('is_active', true) ->orderByDesc('updated_at') ->limit(8) ->get(); $industries = ProductCategory::withCount(['products' => fn($q) => $q->where('is_active', true)]) ->get() ->where('products_count', '>', 0) ->sortByDesc('products_count') ->values(); $totalActive = Product::where('is_active', true)->count(); } catch (\Throwable $e) { $featuredProducts = collect(); $industries = collect(); $totalActive = 0; } // Mapping industria → icon FA (matchea visualmente con el mega-menu) $industryIcons = [ 'professional' => 'fa-briefcase', 'corporate' => 'fa-building', 'services' => 'fa-cogs', 'personal' => 'fa-user-tie', 'events' => 'fa-calendar-star', 'art' => 'fa-palette', 'health-and-wellness' => 'fa-heart', 'petite-website' => 'fa-feather', 'e-commerce' => 'fa-shopping-cart', 'crafts' => 'fa-paint-brush', 'design' => 'fa-pencil-ruler', 'standard-web-app' => 'fa-window-maximize', 'home-deco' => 'fa-couch', ]; @endphp {{-- ============================================================ 0. CLIENT HUB — Solo visible si User logueado con rol Client. Bloque de bienvenida + acceso rápido a sus proyectos. Reemplaza visualmente al hero genérico cuando estás logueado como cliente. ============================================================ --}} @if($isClient)
{{ strtoupper(substr(auth()->user()->first_name ?: auth()->user()->email, 0, 1)) }}

Hola {{ auth()->user()->first_name ?: explode('@', auth()->user()->email)[0] }} 👋

@if($clientProjects->count() === 0) Bienvenido a tu plataforma BewPro. Lanzá tu primer proyecto en minutos. @elseif($clientProjects->count() === 1) Gestionás 1 proyecto en BewPro. @else Gestionás {{ $clientProjects->count() }} proyectos en BewPro. @endif

{{-- Quick action cards --}} {{-- Lista compacta de proyectos --}} @if($clientProjects->isNotEmpty())
Tus proyectos
Ver todos
@foreach($clientProjects->take(6) as $project) @php [$badgeLabel, $badgeClass] = $project->status_badge; $isReachable = method_exists($project, 'isReachable') ? $project->isReachable() : ($project->pipeline_status === 'active'); @endphp @endforeach
@endif
@endif {{-- ============================================================ 1. HERO SECTION (solo se muestra si NO logueado como Client) ============================================================ --}} @unless($isClient)
{{-- Pretitle badge tech style --}}
{{ $siteTagline ?: 'PLATAFORMA DE SITIOS WEB PROFESIONALES' }}
{{-- Headline punchy: orientado a beneficio (no al brand) --}}

Tu sitio web profesional
en minutos, no en meses.

@if($siteDescription)

{{ $siteDescription }}

@endif {{-- Hero stats reales: catálogo + industrias + tiempo de setup --}} @php $heroStats = config('site.welcome.hero_stats', []); if (is_string($heroStats)) { $heroStats = json_decode($heroStats, true) ?? []; } // Defaults dinámicos basados en datos reales del catálogo BewPro if (empty($heroStats)) { $heroStats = [ ['icon' => 'fas fa-layer-group', 'text' => __(':count modelos profesionales', ['count' => 250])], ['icon' => 'fas fa-th-large', 'text' => __(':count industrias', ['count' => 13])], ['icon' => 'fas fa-bolt', 'text' => __('Online en minutos')], ]; } @endphp
@foreach($heroStats as $stat) @if(!empty($stat['icon']))@endif {{ __($stat['text'] ?? '', isset($stat['count']) ? ['count' => $stat['count']] : []) }} @endforeach
@if($heroBg)
{{ $siteName }}
@endif
@if(!$heroBg)
@endif
@endunless {{-- /isClient guard del hero --}} {{-- ============================================================ 1.B FEATURED PRODUCTS — Modelos destacados (carrusel/grid) ============================================================ --}} @if($featuredProducts->isNotEmpty())
Modelos destacados

Empezá con uno de estos modelos

Diseño profesional + módulos listos. Personalizá en minutos.
Explorar catálogo completo
@endif {{-- ============================================================ 1.C BROWSE BY INDUSTRY — Cards visuales de las 13 industrias ============================================================ --}} @if($industries->isNotEmpty())
Por industria

Modelos pensados para cada rubro

No usamos templates genéricos. Cada industria tiene sus módulos, copy y SEO específicos.
@foreach($industries as $cat) @php $icon = $industryIcons[$cat->slug] ?? 'fa-th-large'; @endphp @endforeach
@endif {{-- ============================================================ 1.D OFFICIAL RESELLERS · CD as Partner (oculto para Clients) ============================================================ --}} @unless($isClient)
{{ __('PARTNER OFICIAL') }} {{ __('Powered by Compañía Digital — Reseller oficial BewPro') }}
{{ __('Conocé más') }}
@endunless {{-- /isClient guard del Partner section --}} {{-- ============================================================ 2. SOCIAL PROOF STATS (solo no-Client) ============================================================ --}} @unless($isClient) @php $counters = config('site.welcome.stats', []); if (is_string($counters)) { $counters = json_decode($counters, true) ?? []; } @endphp @if(!empty($counters))
@foreach($counters as $index => $counter)
0
@endforeach
@endif @endunless {{-- /isClient guard del Social Proof Stats --}} {{-- ============================================================ 3. HOW IT WORKS ============================================================ --}} @php $steps = config('site.welcome.how_it_works_steps', []); if (is_string($steps)) { $steps = json_decode($steps, true) ?? []; } @endphp @if(!empty($steps))
{{ config('site.welcome.how_it_works_badge', __('Cómo Funciona')) }}

{{ config('site.welcome.how_it_works_heading', __('Tu sitio en 3 simples pasos')) }}

@foreach($steps as $index => $step)
{{ $index + 1 }}

{{ $step['title'] ?? '' }}

{{ $step['description'] ?? '' }}

@endforeach
@endif {{-- ============================================================ 4. PRODUCTS / MODELS GALLERY ============================================================ --}} @if(is_module_active('products') && isset($featuredProducts) && $featuredProducts->count() > 0)
{{ config('site.welcome.products_badge', __('Productos')) }}

{{ config('site.welcome.products_heading', __('Nuestro Catálogo')) }}

@foreach($featuredProducts->take((int) config('site.welcome.products_per_page', 8)) as $index => $product) @php $productImage = ($product->images && $product->images->count() > 0) ? (filter_var($product->images->first()->image_path, FILTER_VALIDATE_URL) ? $product->images->first()->image_path : asset($product->images->first()->image_path)) : null; $productUrl = Route::has('front.products.show') ? route('front.products.show', $product->slug) : '#'; @endphp @endforeach
@if(Route::has('front.products.index')) @endif
@endif {{-- ============================================================ 5. SERVICES / FEATURES ============================================================ --}} @if(is_module_active('services') && isset($services) && $services->count() > 0)
{{ config('site.welcome.services_badge', __('Características')) }}

{{ config('site.welcome.services_heading', __('Todo lo que necesitás')) }}

@if(config('site.welcome.services_style', 'features') === 'features') {{-- SaaS-style: icon + title + description grid --}}
@foreach($services->take(6) as $index => $service) @php $iconClass = $service->icon ?? 'fas fa-check-circle'; @endphp
{{ $service->title }}

{{ $service->subtitle ?? Str::limit(strip_tags($service->description), 150) }}

@endforeach
@else {{-- Legacy: big colored cards --}}
@foreach($services->take(3) as $index => $service) @php $bgClass = ($index % 2 === 0) ? 'bg-color-primary' : 'bg-color-dark'; $iconClass = $service->icon ?? 'fas fa-cogs'; $serviceUrl = Route::has('frontend.services.detail') ? route('frontend.services.detail', $service->slug) : '#'; @endphp @endforeach
@if($services->count() > 3 && Route::has('frontend.services.index')) @endif @endif
@endif {{-- ============================================================ 6. BLOG / INSIGHTS SECTION ============================================================ --}} @if(is_module_active('blog') && isset($featuredPosts) && $featuredPosts->count() > 0)
{{ config('site.welcome.blog_badge', 'Blog') }}

{{ config('site.welcome.blog_heading', __('Últimas Publicaciones')) }}

@foreach($featuredPosts->take(3) as $index => $post) @php $postUrl = Route::has('frontend.blog.show') ? route('frontend.blog.show', $post->slug) : '#'; @endphp
@include('modules.blog.frontend.partials.homepage-post-media', [ 'post' => $post, 'mediaMinHeight' => '200px', 'imageClass' => '', ]) @if($post->category) {{ $post->category->name }} @endif
{{ $post->created_at->format('d M, Y') }}
{{ $post->title }}
@endforeach
@if(Route::has('frontend.blog.index')) @endif
@endif {{-- ============================================================ 7. FAQS SECTION ============================================================ --}} @if(is_module_active('faqs') && isset($featuredFaqs) && $featuredFaqs->count() > 0)
{{ config('site.welcome.faq_badge', 'FAQ') }}

{{ config('site.welcome.faq_heading', __('Preguntas Frecuentes')) }}

@foreach($featuredFaqs->take(5) as $index => $faq)
{!! $faq->answer !!}
@endforeach
@endif {{-- ============================================================ 8. PROJECTS / PORTFOLIO (conditional, secondary) ============================================================ --}} @if(is_module_active('projects') && isset($featuredProjects) && $featuredProjects->count() > 0)
{{ config('site.welcome.projects_badge', __('Portfolio')) }}

{{ config('site.welcome.projects_heading', __('Nuestros Proyectos')) }}

@foreach($featuredProjects->take(4) as $index => $project) @php $projectImage = $project->featured_image ? (filter_var($project->featured_image, FILTER_VALIDATE_URL) ? $project->featured_image : asset($project->featured_image)) : null; $projectUrl = Route::has('frontend.projects.show') ? route('frontend.projects.show', $project->slug) : '#'; $projectCategory = $project->categories->first()->name ?? ''; @endphp @endforeach
@if(Route::has('frontend.projects.index')) @endif
@endif {{-- ============================================================ 9. GALLERY (conditional, secondary) ============================================================ --}} @if(is_module_active('gallery') && isset($galleryImages) && $galleryImages->count() > 0)
{{ config('site.welcome.gallery_badge', __('Galería')) }}

{{ config('site.welcome.gallery_heading', __('Nuestro Trabajo')) }}

@foreach($galleryImages->take(6) as $index => $image) @php $imgSrc = filter_var($image->image_path, FILTER_VALIDATE_URL) ? $image->image_path : asset($image->image_path); @endphp @endforeach
@if(Route::has('frontend.gallery.index')) @endif
@endif {{-- ============================================================ 10. CTA / GET IN TOUCH SECTION ============================================================ --}}

{{ config('site.welcome.cta_badge', __('Hablemos')) }}

{{ config('site.welcome.cta_title', __('Estamos listos para ayudarte')) }}

@if(config('site.welcome.cta_subtitle'))

{{ config('site.welcome.cta_subtitle') }}

@endif
@endsection