{{-- HEADER--}}

{{ $pageTitle }}

{{-- SECTIONS--}} @foreach ($sections as $section)
{{ $section->order }} {{ $section->title }}
@php $returnUrl = request()->fullUrl(); @endphp
@php $articleLayoutClass = match ($section->layout) { 'single-column' => 'flex flex-col gap-3', 'two-columns' => 'grid grid-cols-2 gap-3', 'two-thirds-left' => 'grid grid-cols-3 gap-3 [&>*:first-child]:col-span-2', 'two-thirds-right' => 'grid grid-cols-3 gap-3 [&>*:last-child]:col-span-2', 'three-columns' => 'grid grid-cols-3 gap-3', 'asymmetric-left' => 'grid grid-cols-4 gap-3 [&>*:first-child]:col-span-1 [&>*:last-child]:col-span-3', 'asymmetric-right' => 'grid grid-cols-4 gap-3 [&>*:first-child]:col-span-3 [&>*:last-child]:col-span-1', 'masonry', 'waterfall', 'custom' => 'flex flex-col gap-3', default => 'flex flex-col gap-3', }; @endphp {{-- ARTICLES--}}
@foreach ($section->articles as $article)
{{ $article->order }}
{{ $article->title }}
@php $contents = collect() ->merge($article->textContent) ->merge($article->images) ->merge($article->galleries) ->merge($article->videos) ->merge($article->buttons) ->merge($article->accordions) ->sortBy('order'); @endphp @foreach ($contents as $content) {{-- CONTENTS--}}
@php $editRoutes = [ 'TextContent' => 'filament.admin.resources.text-content.edit', 'Image' => 'filament.admin.resources.images.edit', 'Gallery' => 'filament.admin.resources.galleries.edit', 'Video' => 'filament.admin.resources.videos.edit', 'Button' => 'filament.admin.resources.buttons.edit', 'Accordion' => 'filament.admin.resources.accordions.edit', ]; $model = class_basename($content); @endphp @if(isset($editRoutes[$model])) @php $model = class_basename($content); $returnUrl = request()->fullUrl(); @endphp @endif
{{ class_basename($content) }} {{ $content->title ?? '[No Title]' }} Order: {{ $content->order }} {{-- Optional: preview/summary --}} @if ($content instanceof \App\Models\TextContent)
{!! \Illuminate\Support\Str::limit(strip_tags($content->content), 60) !!}
@elseif ($content instanceof \App\Models\Image) @if (!empty($content->original_path)) {{ $content->alt_text }} @else No image uploaded @endif @elseif ($content instanceof \App\Models\Gallery)
Gallery: {{ $content->title }} ({{ $content->images->count() }} images)
@elseif ($content instanceof \App\Models\Video) @php $platform = $content->platform ?? 'youtube'; $rawUrl = $content->embed_url ?? ''; $embedUrl = null; if ($platform === 'youtube') { if (preg_match('/(?:youtu\.be\/|youtube\.com\/watch\?v=|youtube\.com\/embed\/)([A-Za-z0-9_\-]{11})/', $rawUrl, $matches)) { $embedUrl = 'https://www.youtube.com/embed/' . $matches[1]; } } if ($platform === 'vimeo') { if (preg_match('/vimeo\.com\/(\d+)/', $rawUrl, $matches)) { $embedUrl = 'https://player.vimeo.com/video/' . $matches[1]; } elseif (preg_match('/player\.vimeo\.com\/video\/(\d+)/', $rawUrl, $matches)) { $embedUrl = $rawUrl; } } @endphp
Video: {{ $content->title }} ({{ $content->platform }})
@if ($embedUrl)
@else
Invalid video link
@endif @elseif ($content instanceof \App\Models\Button)
Button: {{ $content->text }} → {{ $content->url }}
@elseif ($content instanceof \App\Models\Accordion)
Accordion: {{ $content->title }}
@endif
@endforeach
@php $createRoutes = [ 'text_content' => 'filament.admin.resources.text-content.create', 'single_image' => 'filament.admin.resources.images.create', 'gallery' => 'filament.admin.resources.galleries.create', 'video' => 'filament.admin.resources.videos.create', 'button' => 'filament.admin.resources.buttons.create', 'accordion' => 'filament.admin.resources.accordions.create', ]; @endphp
@endforeach
@endforeach
{{-- MODALS --}} @if($showArticleDeleteModal)

Confirm Deletion

Are you sure you want to delete this article?

@endif @if($showSectionEditModal)

Edit Section


@endif @if($showSectionDeleteModal)

Confirm Deletion

Are you sure you want to delete this section?
All articles in this section will also be deleted.

@endif @if($showArticleEditModal)

Edit Article

@php $colorOptions = [ 'no-bg' => 'No Background', 'default' => 'Gray (default)', 'light' => 'Light', 'important' => 'Golden (important)', ]; @endphp @foreach($colorOptions as $key => $label) @endforeach
@php $animationOptions = [ 'from-left' => 'From Left', 'from-right' => 'From Right', 'from-bottom' => 'From Bottom', 'None' => 'None', ]; @endphp @foreach($animationOptions as $key => $label) @endforeach

@endif @if($showSectionCreateModal)

Add Section


@endif