@extends('front.layout.master') @section('content')

{{ $program->title }}

@if($program->subtitle) @endif @if(isset($program['buttons']) && !empty($program['buttons']))
@foreach($program['buttons'] as $button) {{ $button['text'] }} @endforeach
@endif
@php // Convert program model to array with relationships // Load sections with items if not already loaded if (!$program->relationLoaded('sections')) { $program->load('sections.items'); } $program = $program->toArray(); // Ensure sections and items are properly formatted if (isset($program['sections']) && is_array($program['sections'])) { foreach ($program['sections'] as $section) { if (isset($section['items']) && is_array($section['items'])) { $section['items'] = array_values($section['items']); } else { $section['items'] = []; } } //unset section if title is Program Details if (isset($section['title'][app()->getLocale()]) && $section['title'][app()->getLocale()] == 'Program Details') { unset($program['sections'][array_search($section, $program['sections'])]); } $program['sections'] = array_values($program['sections']); } else { $program['sections'] = []; } @endphp

{{ $program['overview'][app()->getLocale()]['title'] ?? '' }}

{!! $program['overview'][app()->getLocale()]['description'] ?? '' !!}
@if($program['media_type'] === 'video') @else {{ $program['overview'][app()->getLocale()]['title'] }} @endif
@if(isset($program['training_area']) && !empty($program['training_area'][app()->getLocale()]['title'])) @if($program['training_area'][app()->getLocale()] != null)

{{ $program['training_area'][app()->getLocale()]['title'] ?? '' }}

@if($program['training_area'][app()->getLocale()]['subtitle'] != null)

{{ $program['training_area'][app()->getLocale()]['subtitle'] ?? '' }}

@endif
checkmark

{{ __('generic.Clinical Areas') }}

{!! $program['training_area'][app()->getLocale()]['clinical'] ?? '' !!}
checkmark

{{ __('generic.Non-Clinical Areas') }}

{!! $program['training_area'][app()->getLocale()]['non-clinical'] ?? '' !!}
@if($program['note'][app()->getLocale()] != null)
Note Icon
{!! $program['note'][app()->getLocale()] ?? '' !!}

@endif @endif @endif @if($program['highlights'][app()->getLocale()]['type'] != 'hide')
@if($program['highlights'][app()->getLocale()]['type'] != 'hide')

{{ __('generic.Program Highlights') }}

@if($program['highlights'][app()->getLocale()]['type'] == 'fields')
checkmark

{{ __('generic.Duration:') }}

{{ $program['highlights'][app()->getLocale()]['duration'] ?? '' }}

checkmark

{{ __('generic.Start Date:') }}

{{ $program['highlights'][app()->getLocale()]['location'] ?? '' }}

checkmark

{{ __('generic.Target Audience:') }}

{{ $program['highlights'][app()->getLocale()]['fees'] ?? '' }}

@else
@php $highlightsHtml = $program['highlights'][app()->getLocale()]['content'] ?? ''; $highlightsList = []; if (preg_match_all('/]*>(.*?)<\/li>/is', $highlightsHtml, $matches)) { $highlightsList = array_map(function($item) { return trim(strip_tags($item)); }, $matches[1]); } @endphp @if(!empty($highlightsList))
    @foreach($highlightsList as $highlight)
  • checkmark {!! $highlight !!}
  • @endforeach
@else
{!! $highlightsHtml !!}
@endif
@endif
@endif @php // Check if at least objectives exist for current locale OR for English $objectivesLocalized = $program['objectives'][app()->getLocale()] ?? null; $objectivesEn = $program['objectives']['en'] ?? null; @endphp @if(!empty($objectivesLocalized) || !empty($objectivesEn))

{{ __('generic.Program Objectives') }}

@php $objectivesHtml = $program['objectives'][app()->getLocale()] ?? $program['objectives']['en'] ?? ''; $objectivesList = []; if ($objectivesHtml) { // Extract list items from HTML if (preg_match_all('/]*>(.*?)<\/li>/is', $objectivesHtml, $matches)) { $objectivesList = array_map(function($item) { // Clean up the item: strip tags but preserve formatting, decode entities, trim $cleaned = strip_tags(trim($item), ''); $cleaned = html_entity_decode($cleaned, ENT_QUOTES | ENT_HTML5, 'UTF-8'); return trim($cleaned); }, $matches[1]); } } @endphp @if(!empty($objectivesList))
    @foreach($objectivesList as $objective)
  • checkmark {!! $objective !!}
  • @endforeach
@else {!! $objectivesHtml !!} @endif
@endif
@endif @if(isset($program['sections']) && !empty($program['sections'])) @foreach($program['sections'] as $section)
@php $sectionTitle = is_array($section['title'] ?? null) ? ($section['title'][app()->getLocale()] ?? $section['title']['en'] ?? '') : ($section['title'] ?? ''); $sectionSubtitle = is_array($section['subtitle'] ?? null) ? ($section['subtitle'][app()->getLocale()] ?? $section['subtitle']['en'] ?? '') : ($section['subtitle'] ?? ''); @endphp

{{ $sectionTitle }}

@if($sectionSubtitle)

{{ $sectionSubtitle }}

@endif
@if(isset($section['items']) && !empty($section['items']))
@foreach($section['items'] as $item) @php $itemTitle = is_array($item['title'] ?? null) ? ($item['title'][app()->getLocale()] ?? $item['title']['en'] ?? '') : ($item['title'] ?? ''); $itemIcon = $item['icon']; @endphp
@if($itemIcon)
{{ $itemTitle }}
@endif

{{ $itemTitle }}

@if(isset($item['description']) && !empty($item['description'][app()->getLocale()]))

{{ $item['description'][app()->getLocale()] ?? '' }}

@endif
@endforeach
@endif
@endforeach @endif @if(($program['details'] != null))

{{ __('generic.Program Details') }}

@foreach($program['details'] as $detail)
{{ $detail['title'][app()->getLocale()] ?? '' }}

{{ $detail['title'][app()->getLocale()] ?? '' }}

{{ $detail['subtitle'][app()->getLocale()] ?? '' }}

{{ $detail['description'][app()->getLocale()] ?? '' }}

@endforeach
@endif @if(isset($program['eligibility_criteria']) && !empty($program['eligibility_criteria'][app()->getLocale()]['requirements'])) @if($program['eligibility_criteria'][app()->getLocale()] != null)

{{ $program['eligibility_criteria'][app()->getLocale()]['title'] ?? '' }}

@if($program['eligibility_criteria'][app()->getLocale()]['subtitle'] != null)

{{ $program['eligibility_criteria'][app()->getLocale()]['subtitle'] ?? '' }}

@endif

{{ __('generic.Requirements') }}

@php $requirements = $program['eligibility_criteria'][app()->getLocale()]['requirements'] ?? ''; if (is_string($requirements) && !empty($requirements)) { $reqItems = []; if (preg_match_all('/]*>(.*?)<\/li>/is', $requirements, $matches)) { foreach ($matches[1] as $reqHtml) { $text = strip_tags(trim($reqHtml), ''); $text = html_entity_decode($text, ENT_QUOTES | ENT_HTML5, 'UTF-8'); if ($text !== '') { $reqItems[] = $text; } } } if (!empty($reqItems)) { @endphp
    @foreach($reqItems as $req)
  • item {!! $req !!}
  • @endforeach
@php } else { echo $requirements; } } elseif (is_array($requirements) && !empty($requirements)) { @endphp
    @foreach($requirements as $req)
  • item {{ $req }}
  • @endforeach
@php } @endphp

{{ __('generic.Requirements Documents') }}

@php $requirementsDocuments = $program['eligibility_criteria'][app()->getLocale()]['requirements-documents'] ?? ''; // Parse HTML string to extract list items with images if (is_string($requirementsDocuments) && !empty($requirementsDocuments)) { // Extract list items from HTML $listItems = []; if (preg_match_all('/]*>(.*?)<\/li>/is', $requirementsDocuments, $matches)) { foreach ($matches[1] as $itemHtml) { // Extract image if present $imageSrc = null; if (preg_match('/]+src=["\']([^"\']+)["\'][^>]*>/i', $itemHtml, $imgMatches)) { $imageSrc = $imgMatches[1]; // Remove image tag from text $itemHtml = preg_replace('/]*>/i', '', $itemHtml); } // Clean up text (remove HTML tags, decode entities) $text = strip_tags(trim($itemHtml)); $text = html_entity_decode($text, ENT_QUOTES | ENT_HTML5, 'UTF-8'); if (!empty($text) || !empty($imageSrc)) { $listItems[] = [ 'text' => $text, 'image' => $imageSrc ]; } } } // If we found list items, display them with images if (!empty($listItems)) { @endphp
    @foreach($listItems as $document => $value)
  • {{ $value['text'] }}
  • @endforeach
@php } else { // No list items found, display as regular HTML echo $requirementsDocuments; } } elseif (is_array($requirementsDocuments) && !empty($requirementsDocuments)) { // Handle array format (if it exists) @endphp
    @foreach($requirementsDocuments as $document)
  • @if(isset($document['image']) && !empty($document['image']))
    {{ $document['text'] ?? '' }}
    @endif {{ $document['text'] ?? '' }}
  • @endforeach
@php } @endphp
@endif @endif

{{ $program['link_to_apply'][app()->getLocale()]['title'] ?? '' }}

{{ $program['link_to_apply'][app()->getLocale()]['subtitle'] ?? '' }}

{{ $program['link_to_apply'][app()->getLocale()]['button_text'] ?? '' }} @if(isset($program['link_to_apply'][app()->getLocale()]['subtitle2']) && !empty($program['link_to_apply'][app()->getLocale()]['subtitle2']))

{{ $program['link_to_apply'][app()->getLocale()]['subtitle2'] ?? '' }}

@endif
@endsection