@extends('frontend::layouts.master') @section('content') @php /** แกลเลอรีหลักจาก DB ($detail['gallery']) — ใช้ก่อนเสมอถ้ามีรายการ */ $detailGallery = ($detail ?? [])['gallery'] ?? []; if ($detailGallery !== []) { $lightboxGallery = array_values(array_map(static function (array $image): array { return [ 'src' => $image['image'] ?? '', 'thumb' => $image['image'] ?? '', 'alt' => $image['name'] ?? '', ]; }, $detailGallery)); } else { $lightboxGallery = $galleryImages ?? []; } $mainImage = $detailGallery[0]['image'] ?? ($lightboxGallery[0]['src'] ?? null); @endphp
@lang('frontend::lang.back')
{{-- Hero / Main Image --}}
@if ($mainImage) {!! $detail['name'] ?? '' !!} @else
@endif @if ($mainImage) @lang('frontend::lang.click_to_enlarge_image') @endif
{{-- Thumbnails --}} @if (!empty($detailGallery))
@foreach ($detailGallery as $index => $image) @endforeach

@lang('frontend::lang.click_to_enlarge')

@endif
@if (!empty($detail['categories'][0]['name']))

@lang('frontend::lang.level_name') {{ $detail['categories'][0]['name'] }}

@endif

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

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

@if (!empty($detail['detail'])) {!! $detail['detail'] ?? '' !!} @endif

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

{{ $onlineDetail['price'] ?? '' }} @if (!empty($onlineDetail['originalPrice'])) {{ $onlineDetail['originalPrice'] ?? '' }} @endif
    @if (!empty($detail['feature_of_course']) and count($detail['feature_of_course']) > 0) @foreach ($detail['feature_of_course'] ?? [] as $feature_of_course)
  • {!! $feature_of_course->local->name ?? '' !!}
  • @endforeach @endif
@if (!empty($detail['period'])) @foreach ($detail['period'] as $section) @php $colorClasses = !empty($section['accentColor']) ? match ($section['accentColor']) { 'kru-blue' => 'border-kru-blue/40 bg-kru-blue/20', 'kru-purple' => 'border-kru-purple/40 bg-kru-purple/20', 'kru-green' => 'border-kru-green/40 bg-kru-green/20', 'kru-orange' => 'border-kru-orange/40 bg-kru-orange/20', default => 'border-kru-blue/40 bg-kru-blue/20', } : 'border-kru-blue/40 bg-kru-blue/20'; @endphp

{!! $section['name'] ?? '' !!}

{!! $section['detail'] ?? '' !!} {{-- ตารางรอบเรียน: div layout รองรับข้อความยาว + responsive --}}
@if (!empty($section['children'])) @foreach ($section['children'] ?? [] as $row)
{{-- แถวข้อมูล: มือถือเรียงแนวตั้ง จอใหญ่เป็น grid 2-3 คอลัมน์ --}}
@if (!empty($row['class_period_name']))
@lang('frontend::lang.period') {{ $row['class_period_name'] }}
@endif @if (!empty($row['period']))
@lang('frontend::lang.day') {{ $row['period'] }}
@endif @if (!empty($row['time']))
@lang('frontend::lang.time') {{ $row['time'] }}
@endif @if (!empty($row['count']))
@lang('frontend::lang.count') {{ $row['count'] ?? '—' }}
@endif @if (!empty($row['price']))
@lang('frontend::lang.price') {{ $row['price'] ?? '—' }}
@endif @if (!empty($row['course_type_name']))
@lang('frontend::lang.learning_format') {{ $row['course_type_name'] ?? '—' }}
@endif
{{-- สถานะและปุ่มสมัคร แยกบรรทัดชัดเจน --}}
@if (($row['is_full'] ?? '') === 0) @lang('frontend::lang.open_register') @else @lang('frontend::lang.full') @endif
@endforeach @endif
@endforeach @endif
{{-- Lightbox --}}

{{ $title ?? '' }}

@endsection