@extends('layouts.app') @php $plain = fn ($h) => trim(preg_replace('/\s+/u', ' ', html_entity_decode(strip_tags(str_replace('<', ' <', $h)), ENT_QUOTES | ENT_HTML5, 'UTF-8'))); $introText = $plain($intro); // Sub judul dari database diratakan ke h3 agar urutan heading di bawah h2 tidak melompat. $h3 = fn ($h) => preg_replace('~<(/?)h[45]>~', '<$1h3>', $h); $cut = fn ($t, $n = 300) => \Illuminate\Support\Str::limit($t, $n); // Daftar poin menjadi teks polos (untuk deskripsi, FAQ, dan JSON-LD). $texts = fn ($p) => collect($p['items'])->map(fn ($i) => rtrim($plain(is_array($i) ? $i['title'] : $i), ' .;,:'))->filter()->values(); $asText = fn ($p) => $texts($p)->isNotEmpty() ? $texts($p)->take(6)->implode('; ') : $plain($p['html'] ?? ''); // Judul yang sudah memuat kata "Training/Pelatihan" tidak diberi awalan lagi. $courseName = preg_match('~^(training|pelatihan|workshop)\b~i', $baseName) ? $baseName : "Pelatihan {$baseName}"; $topics = $texts($outline); $about = $topics->isNotEmpty() ? 'materi '.$topics->take(4)->implode(', ') : $asText($benefit); $desc = $metaDesc ?: $cut($introText ?: "{$courseName} dari Value Consult Training".($about !== '' ? ": {$about}" : ': online, inclass, dan in-house').'.', 155); // Ringkasan hero: kalimat awal deskripsi bila cukup pendek, jika tidak kalimat definisi. $first = preg_split('/(?<=[.!?])\s+/u', $introText)[0] ?? ''; $definition = "{$courseName} adalah program pelatihan".($series ? " dalam {$series['name']}" : '')." dari Value Consult Training, tersedia dalam format online, inclass, dan in-house training."; $summary = mb_strlen($first) >= 60 && mb_strlen($first) <= 220 ? $first : $definition; $pageTitle = $metaTitle ?: (preg_match('~\b(training|pelatihan|workshop)\b~i', $name) ? $name : "Training {$name}"); $heroImg = file_exists(public_path('images/assets/'.$hero)) ? asset('images/assets/'.$hero) : null; $schedule = collect($schedules)->flatten(1)->sortBy('start')->values(); $modes = ['online' => ['Online (Live)', 'display'], 'inclass' => ['Inclass (Tatap Muka)', 'people']]; $rp = fn ($v) => 'Rp '.number_format($v, 0, ',', '.'); $calendars = \App\Support\AnnualSchedule::options(); $contactUrl = route('home').'#inhouse-inquiry'; $relatedIcons = ['shield-check', 'award', 'rocket-takeoff', 'graph-up-arrow']; $has = fn ($p) => $p['items'] || $p['html']; // FAQ hanya berisi fakta yang juga ada di halaman; dipakai untuk tampilan dan FAQPage JSON-LD. $faq = [["Apa itu {$courseName}?", $definition.($first !== '' ? ' '.$cut($first) : '')]]; if ($has($audience) && ($t = $asText($audience)) !== '') { $faq[] = ["Siapa yang cocok mengikuti {$courseName}?", rtrim($cut($t), ' .').'.']; } if ($topics->isNotEmpty()) { $faq[] = ["Apa saja materi {$courseName}?", 'Materi yang dibahas antara lain: '.rtrim($cut($topics->take(8)->implode('; '), 400), ' .').'.']; } $next = collect($modes)->map(fn ($m, $k) => ($r = $schedules[$k][0] ?? null) ? $m[0].': '.$r['date'].' ('.$r['days'].' hari'.($r['city'] ? ', '.$r['city'] : '').')' : null)->filter(); $faq[] = ["Kapan jadwal terdekat {$courseName}?", $next->isNotEmpty() ? 'Jadwal terdekat. '.$next->implode('. ').'.' : 'Belum ada jadwal terbuka. Jadwal dapat diajukan melalui tim Value Consult Training, termasuk untuk in-house training.']; if ($prices) { $faq[] = ["Berapa biaya {$courseName}?", collect($prices)->map(fn ($p, $k) => $modes[$k][0].' '.$rp($p['fare']).' per peserta (jadwal '.$p['date'].')')->implode('; ').'. Biaya dapat berbeda untuk tiap jadwal dan lokasi.']; } $faq[] = ["Apakah {$courseName} bisa diselenggarakan secara in-house?", 'Bisa. Pelatihan ini dapat diselenggarakan sebagai in-house training dengan materi, durasi, dan studi kasus yang disesuaikan dengan kebutuhan perusahaan Anda.']; @endphp @section('title', $pageTitle.' | Value Consult Training') @section('canonical', url($path)) @section('description', $desc) @section('robots', $thin ? 'noindex, follow' : 'index, follow, max-image-preview:large, max-snippet:-1') @if ($heroImg)@section('og_image', $heroImg)@endif @push('head') @php $orgId = url('/').'#organization'; $pageUrl = url($path); $updTs = $updated && strtotime($updated) ? strtotime($updated) : null; $crumbs = [['Beranda', url('/')], ['Training Series', route('series.index')]]; if ($series) $crumbs[] = [$series['name'], route('series.show', $series['slug'])]; $crumbs[] = [$baseName, $pageUrl]; $offer = fn ($fare) => $fare > 0 ? ['@type' => 'Offer', 'category' => 'Paid', 'price' => (int) $fare, 'priceCurrency' => 'IDR', 'url' => $pageUrl] : null; // 5 jadwal terdekat per metode agar online dan inclass sama-sama terwakili. $instances = collect($schedules)->flatMap(fn ($rows) => array_slice($rows, 0, 5))->sortBy('start')->values()->map(fn ($r) => array_filter([ '@type' => 'CourseInstance', 'courseMode' => $r['online'] ? 'Online' : 'Onsite', 'startDate' => $r['start'], 'endDate' => $r['end'], 'courseWorkload' => 'P'.max(1, (int) $r['days']).'D', 'location' => $r['online'] ? ['@type' => 'VirtualLocation', 'url' => $pageUrl] : ['@type' => 'Place', 'name' => $r['city'] ?: 'Inclass', 'address' => ['@type' => 'PostalAddress', 'addressLocality' => $r['city'] ?: 'Indonesia', 'addressCountry' => 'ID']], 'offers' => $offer($r['fare']), ]))->all(); $offers = collect($prices)->map(fn ($p) => $offer($p['fare']))->values()->all(); $audienceText = $has($audience) ? $cut($asText($audience)) : ''; $graph = ['@context' => 'https://schema.org', '@graph' => [ ['@type' => 'BreadcrumbList', 'itemListElement' => collect($crumbs)->map(fn ($c, $i) => ['@type' => 'ListItem', 'position' => $i + 1, 'name' => $c[0], 'item' => $c[1]])->all()], array_filter(['@type' => 'WebPage', '@id' => $pageUrl, 'url' => $pageUrl, 'name' => $pageTitle, 'description' => $desc, 'inLanguage' => 'id-ID', 'isPartOf' => ['@id' => url('/').'#website'], 'mainEntity' => ['@id' => $pageUrl.'#course'], 'primaryImageOfPage' => $heroImg ? ['@type' => 'ImageObject', 'url' => $heroImg] : null, 'dateModified' => $updTs ? date('c', $updTs) : null]), array_filter(['@type' => 'Course', '@id' => $pageUrl.'#course', 'name' => $baseName, 'description' => $desc, 'url' => $pageUrl, 'inLanguage' => 'id-ID', 'image' => $heroImg, 'about' => $series ? $series['name'] : null, 'teaches' => $texts($benefit)->take(8)->all() ?: null, 'audience' => $audienceText !== '' ? ['@type' => 'Audience', 'audienceType' => $audienceText] : null, 'syllabusSections' => $topics->take(20)->map(fn ($t) => ['@type' => 'Syllabus', 'name' => $t])->all() ?: null, 'provider' => ['@type' => 'Organization', '@id' => $orgId, 'name' => 'Value Consult Training', 'url' => url('/')], 'offers' => $offers ?: null, 'hasCourseInstance' => $instances ?: null]), ['@type' => 'FAQPage', '@id' => $pageUrl.'#faq', 'mainEntity' => collect($faq)->map(fn ($f) => ['@type' => 'Question', 'name' => $f[0], 'acceptedAnswer' => ['@type' => 'Answer', 'text' => $f[1]]])->all()], ]]; @endphp @endpush @section('content') {{-- HERO --}}
@if ($heroImg){{ $courseName }} - Value Consult Training@endif
Topik Pelatihan

{{ $baseName }}

{{ $summary }}

{{-- NAVIGASI BAGIAN --}}
{{-- KONTEN UTAMA --}}

Tentang Topik

@if ($introText !== '')
{!! $h3($intro) !!}
@else

{{ $baseName }} adalah program pelatihan{{ $series ? ' dalam '.$series['name'] : '' }} dari Value Consult Training, tersedia dalam format online, inclass, dan in-house training.

@endif @if ($updated && strtotime($updated))

Diperbarui

@endif @if ($thin)

Detail program ini sedang disiapkan. Hubungi kami untuk silabus lengkap dan penawaran.

@endif
@if ($has($benefit))

Manfaat yang Anda Dapatkan

@if ($benefit['lead'])
{!! $h3($benefit['lead']) !!}
@endif @if ($benefit['items'])
    @foreach ($benefit['items'] as $item)
  • {!! $h3($item) !!}
  • @endforeach
@else
{!! $h3($benefit['html']) !!}
@endif
@endif @if ($has($audience) || $has($method))
!($has($audience) && $has($method))])> @foreach ([[$audience, 'Siapa yang Cocok Mengikuti?', 'people', 'chevron-right', 'arrows'], [$method, 'Metode Pelatihan', 'laptop', 'check-lg', 'checks']] as [$block, $title, $icon, $bullet, $cls]) @if ($has($block))

{{ $title }}

@if ($block['lead'])
{!! $h3($block['lead']) !!}
@endif @if ($block['items'])
    @foreach ($block['items'] as $item)
  • {!! $h3($item) !!}
  • @endforeach
@else
{!! $h3($block['html']) !!}
@endif
@endif @endforeach
@endif @if ($outline['items'] || $outline['html'])

Outline Materi

@if ($outline['lead'])
{!! $h3($outline['lead']) !!}
@endif @if ($outline['items'])
    @foreach ($outline['items'] as $i => $item)
  1. @if ($item['body'])
    {{ $i + 1 }}

    {{ $item['title'] }}

    {!! $h3($item['body']) !!}
    @else
    {{ $i + 1 }}

    {{ $item['title'] }}

    @endif
  2. @endforeach
@else
{!! $h3($outline['html']) !!}
@endif
@endif @if (trim($plain($extra)) !== '')

Informasi Tambahan

{!! $h3($extra) !!}
@endif {{-- INVESTASI --}}

Investasi

@if ($prices)
@foreach ($prices as $key => $p)
{{ $modes[$key][0] }} {{ $rp($p['fare']) }}per peserta @if ($p['group'] > 0 && $p['group'] < $p['fare'])

Harga grup{{ $p['groupMin'] > 1 ? ' (min. '.$p['groupMin'].' peserta)' : '' }}: {{ $rp($p['group']) }} per peserta

@endif Berdasarkan jadwal {{ $p['date'] }}{{ $p['city'] ? ' · '.$p['city'] : '' }}
@endforeach

Biaya dapat berbeda untuk tiap jadwal dan lokasi. Lihat brosur pada jadwal yang dipilih atau hubungi kami.

@else

Informasi investasi untuk topik ini tersedia melalui tim kami. Hubungi kami untuk penawaran.

@endif
{{-- FASILITAS --}}

Fasilitas

@if ($facilities['items']) @if ($facilities['lead'])
{!! $h3($facilities['lead']) !!}
@endif
    @foreach ($facilities['items'] as $item)
  • {!! $h3($item) !!}
  • @endforeach
@elseif ($facilities['html'])
{!! $h3($facilities['html']) !!}
@else

Fasilitas menyesuaikan metode dan lokasi pelatihan. Rinciannya tersedia pada brosur jadwal, atau tanyakan ke tim kami.

@endif
{{-- SIDEBAR --}}
{{-- FAQ (selaras dengan FAQPage JSON-LD) --}}

Pertanyaan Umum tentang {{ $courseName }}

@foreach ($faq as $i => $f)

{{ $f[0] }}

{{ $f[1] }}

@endforeach
{{-- TOPIK TERKAIT --}} @if ($related) @endif
@endsection