@extends('layouts.app') @section('content')
@foreach($homepageBlocks as $block) @php $isFullWidth = !empty($block['data']['is_full_width']); $containerClass = $isFullWidth ? 'w-full px-6 mb-24' : 'max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mb-24'; @endphp @switch($block['type']) @case('hero')
@if(!empty($block['data']['bg_image']))

{{ $block['data']['title'] }}

@if(!empty($block['data']['subtitle']))

{{ $block['data']['subtitle'] }}

@endif @if(!empty($block['data']['cta_text']) && !empty($block['data']['cta_url'])) {{ $block['data']['cta_text'] }} @endif
@else

{!! preg_replace('/Success Stories/i', 'Success Stories', e($block['data']['title'])) !!}

@if(!empty($block['data']['subtitle']))

{{ $block['data']['subtitle'] }}

@endif @if(!empty($block['data']['cta_text']) && !empty($block['data']['cta_url'])) @endif
@endif
@break @case('featured_stories') @php $limit = $block['data']['limit'] ?? 6; $displayStories = $featuredStories->take($limit); $isCarousel = !empty($block['data']['is_carousel']); @endphp

{{ $block['data']['title'] ?? 'Featured Stories' }}

View all stories
@if(!empty($block['data']['description']))

{{ $block['data']['description'] }}

@endif @if($displayStories->isEmpty())

No featured stories at the moment. Browse our projects to see more impact stories.

@else @if($isCarousel)
@else
@foreach($displayStories as $story) @php $firstTextBlock = collect($story->content)->firstWhere('type', 'text'); $summary = $firstTextBlock ? Str::limit(strip_tags($firstTextBlock['data']['content']), 150) : 'Click to read this success story...'; @endphp
@if($story->image) {{ $story->image_alt ?: $story->title }} @else
@endif @if($story->project)
{{ $story->project->short_name ?? $story->project->name }}
@endif
Published {{ $story->published_date ? $story->published_date->format('M d, Y') : $story->created_at->format('M d, Y') }}

{{ $story->title }}

{{ $summary }}

@endforeach
@endif @endif
@break @case('projects_grid') @php $isCarousel = !empty($block['data']['is_carousel']); @endphp

{{ $block['data']['title'] ?? 'Our Projects' }}

@if(!empty($block['data']['description']))

{{ $block['data']['description'] }}

@endif @if($isCarousel) @else @endif
@break @case('thematic_areas_grid')

{{ $block['data']['title'] ?? 'Thematic Areas' }}

@if(!empty($block['data']['description']))

{{ $block['data']['description'] }}

@endif
@break @case('newsletters') @php $limit = $block['data']['limit'] ?? 6; $displayNewsletters = $newsletters->take($limit); $isCarousel = !empty($block['data']['is_carousel']); @endphp

{{ $block['data']['title'] ?? 'Newsletters' }}

View all newsletters
@if(!empty($block['data']['description']))

{{ $block['data']['description'] }}

@endif @if($displayNewsletters->isEmpty())

No newsletters available at the moment.

@else @if($isCarousel)
@foreach($displayNewsletters as $newsletter) @php $firstTextBlock = collect($newsletter->content)->firstWhere('type', 'text'); $summary = $firstTextBlock ? Str::limit(strip_tags($firstTextBlock['data']['content']), 150) : 'Explore the details of this newsletter issue...'; @endphp
@if($newsletter->cover_image) {{ $newsletter->cover_image_alt ?: $newsletter->title }} @else
@endif @if($newsletter->category)
{{ $newsletter->category->name }}
@endif
Published {{ $newsletter->published_date ? $newsletter->published_date->format('M d, Y') : $newsletter->created_at->format('M d, Y') }}

{{ $newsletter->title }}

{{ $summary }}

View Details @if($newsletter->file_path || $newsletter->external_link) Download @endif
@endforeach
@else
@foreach($displayNewsletters as $newsletter) @php $firstTextBlock = collect($newsletter->content)->firstWhere('type', 'text'); $summary = $firstTextBlock ? Str::limit(strip_tags($firstTextBlock['data']['content']), 150) : 'Explore the details of this newsletter issue...'; @endphp
@if($newsletter->cover_image) {{ $newsletter->cover_image_alt ?: $newsletter->title }} @else
@endif @if($newsletter->category)
{{ $newsletter->category->name }}
@endif
Published {{ $newsletter->published_date ? $newsletter->published_date->format('M d, Y') : $newsletter->created_at->format('M d, Y') }}

{{ $newsletter->title }}

{{ $summary }}

View Details @if($newsletter->file_path || $newsletter->external_link) Download @endif
@endforeach
@endif @endif
@break @case('parallax') @php $isParallaxFullWidth = filter_var($block['data']['is_full_width'] ?? true, FILTER_VALIDATE_BOOLEAN); $titleColor = $block['data']['title_color'] ?? '#ffffff'; $subtitleColor = $block['data']['subtitle_color'] ?? '#ffffff'; $height = $block['data']['height'] ?? 'medium'; $heightStyle = $height == 'small' ? '300px' : ($height == 'large' ? '700px' : '500px'); @endphp @break @case('custom_html')
@if(!empty($block['data']['title']))

{{ $block['data']['title'] }}

@endif
{!! $block['data']['content'] !!}
@break @endswitch @endforeach
@endsection