@php /* Palette index: [0] Main (blue/slate), [1] Packaging (teal), [2] Recycled (forest) — by category name, not _lft */ $productCategoryPaletteIndex = function (array $category): int { $name = trim((string) ($category['name'] ?? '')); if ($name === '') { return (int) ((($category['_lft'] ?? 0) / 2) % 3); } $lower = mb_strtolower($name, 'UTF-8'); $containsAny = static function (string $haystack, array $needles): bool { foreach ($needles as $needle) { $n = mb_strtolower((string) $needle, 'UTF-8'); if ($n !== '' && str_contains($haystack, $n)) { return true; } } return false; }; if ($containsAny($lower, ['packaging', 'package', 'บรรจุภัณฑ์', 'บรรจุ'])) { return 1; } if ($containsAny($lower, ['recycled', 'recycle', 'รีไซเคิล', 'รีไซ'])) { return 2; } if ($containsAny($lower, ['main product', 'main', 'ผลิตภัณฑ์หลัก', 'สินค้าหลัก', 'หมวดหลัก'])) { return 0; } return (int) ((($category['_lft'] ?? 0) / 2) % 3); }; /* Original hover overlays */ $categoryGradients = [ 'from-[var(--primary)]/20 to-[var(--primary)]/5', 'from-[var(--secondary)]/20 to-[var(--secondary)]/5', 'from-emerald-500/12 to-emerald-500/3', ]; /* Base cards: original light background set */ $categoryCardBgs = [ 'bg-gradient-to-br from-tsic-blue/15 via-white to-tsic-blue/5', // Main Product — blue/slate family 'bg-gradient-to-br from-tsic-green/15 via-white to-tsic-green/5', // [1] Packaging — teal/green family 'bg-gradient-to-br from-emerald-500/15 via-white to-emerald-500/5', // [2] Recycled — forest/emerald family ]; $useSlider = count($products['list']) > 3; @endphp
@include('frontend::components.tsic-ellipse-decoration', [ 'minEllipses' => 2, 'maxEllipses' => 2, ])

{{ __('frontend::lang.page.index.products') }}

{{ __('frontend::lang.page.index.products_desc') }}

@if ($useSlider) @push('styles') @endpush
@foreach ($products['list'] as $product) @php $cal_idx = $productCategoryPaletteIndex($product['categories'][0] ?? []); @endphp
Product icon

{{ $product['categories'][0]['name'] ?? '' }}

{{ $product['name'] ?? '' }}

{{ $product['desc'] ?? '' }}

@if (!empty($product['text']))
    @php $explodeText = explode(',', $product['text']); @endphp @foreach ($explodeText as $prop)
  • {{ $prop }}
  • @endforeach
@endif {{ __('frontend::lang.btn.learn_more') }}
@endforeach
@else
@foreach ($products['list'] as $product) @php $cal_idx = $productCategoryPaletteIndex($product['categories'][0] ?? []); @endphp
Product icon

{{ $product['categories'][0]['name'] ?? '' }}

{{ $product['name'] ?? '' }}

{{ $product['desc'] ?? '' }}

@if (!empty($product['text']))
    @php $explodeText = explode(',', $product['text']); @endphp @foreach ($explodeText as $prop)
  • {{ $prop }}
  • @endforeach
@endif {{ __('frontend::lang.btn.learn_more') }}
@endforeach
@endif
@if ($useSlider) @push('scripts') @endpush @endif