{{-- Dynamic Header Component for Products --}}
@php
// Get active demo
$activeDemo = get_active_demo();
$isLawFirm2 = ($activeDemo === 'demo-law-firm-2');
$isDigitalAgency2 = ($activeDemo === 'demo-digital-agency-2');
$isTransportationLogistic = ($activeDemo === 'demo-transportation-logistic');
$isArchitecture2 = ($activeDemo === 'demo-architecture-2');
$isAccounting2 = ($activeDemo === 'demo-accounting-2');
// Get module configuration for title
$moduleConfig = get_module_page_header_config('products');
$productsTitle = $moduleConfig['title'] ?? config('cd-system.modules.products.name', 'Productos');
$productsLabel = strtoupper($productsTitle);
// Determine current context and set content
if (isset($product) && $product) {
// Product detail view
$pageTitle = $product->name ?? 'Producto';
$breadcrumbItems = [
['url' => url('/'), 'label' => __('Inicio')],
['url' => route('front.products.index'), 'label' => $productsLabel],
['url' => null, 'label' => strtoupper(\Illuminate\Support\Str::limit($product->name ?? 'Producto', 30))]
];
// Subtitle con información de categoría
$pageSubtitle = isset($product->category)
? __('Equipo de') . ' ' . $product->category->name
: ($moduleConfig['subtitle'] ?? null);
} elseif (isset($category) && $category) {
// Category view
$pageTitle = $category->name ?? 'Categoría';
$breadcrumbItems = [
['url' => url('/'), 'label' => __('Inicio')],
['url' => route('front.products.index'), 'label' => $productsLabel],
['url' => null, 'label' => strtoupper($category->name ?? 'Categoría')]
];
$pageSubtitle = $category->description ?? null;
} elseif (isset($tag) && $tag) {
// Tag view
$pageTitle = $tag->name ?? 'Tag';
$breadcrumbItems = [
['url' => url('/'), 'label' => __('Inicio')],
['url' => route('front.products.index'), 'label' => $productsLabel],
['url' => null, 'label' => strtoupper($tag->name ?? 'Tag')]
];
$pageSubtitle = null;
} else {
// Index view
$pageTitle = $productsTitle;
$breadcrumbItems = [
['url' => url('/'), 'label' => __('Inicio')],
['url' => null, 'label' => $productsLabel]
];
$pageSubtitle = $moduleConfig['subtitle'] ?? null;
}
@endphp
@if($isLawFirm2)
{{-- Law Firm 2 Style Header --}}
@php
$headerBackground = $backgroundImage ?? asset('cd-project/img/demos/transportation-logistic/generic/generic-1.png');
@endphp
@elseif($isDigitalAgency2)
{{-- Digital Agency 2 Style Header --}}
@php
// Permitir personalizar la imagen de fondo desde el controlador o usar la por defecto
$headerBackground = $backgroundImage ?? asset('cd-project/img/demos/transportation-logistic/generic/generic-1.png');
@endphp
{{ $pageSubtitle }}{{ $pageTitle }}
@if(!empty($pageSubtitle))
{{ $pageSubtitle }}
@endif