@php if (!function_exists('getChunks')) { function getChunks($data, $size) { return array_chunk($data, $size); } } if (!function_exists('getColorByProgressKeyName')) { function getColorByProgressKeyName($progressKeys, $keyName) { return collect($progressKeys) ->firstWhere('name', $keyName)['color'] ?? '#ccc'; } } if (!function_exists('getCustomChunks')) { function getCustomChunks($data) { $chunks = []; $count = count($data); if ($count === 0) { return $chunks; } // First page gets 1 domain $chunks[] = array_slice($data, 0, 2); // Remaining pages get 2 domains per page $remaining = array_slice($data, 2); $chunks = array_merge($chunks, array_chunk($remaining, 2)); return $chunks; } } $chunks = getCustomChunks($milestoneReport['progressData'] ?? []); @endphp @foreach($chunks as $chunkIndex => $chunk) @php $isFirst = $chunkIndex === 0; $isLast = $chunkIndex === count($chunks) - 1; @endphp @if(!$isFirst)
@endif
{{-- Page Header (Only on first page) --}} @if($isFirst)

Progress Review

Academic Term 2024-2025

Learner’s Name: {{ $milestoneReport['student']['name'] ?? '' }}

@php $ageParts = explode(':', $milestoneReport['ageString'] ?? ''); @endphp

{{ $ageParts[0] ?? '' }}: {{ $ageParts[1] ?? '' }}

Grade: {{ $milestoneReport['student']->classSection->name ?? '' }}

Attendance: {{ $milestoneReport['totalDaysPresent'] ?? '' }} Out Of {{ $milestoneReport['totalWorkingDays'] ?? '' }}

Facilitators: @foreach($milestoneReport['classSectionTeacher'] ?? [] as $i => $teacher) {{ $teacher['name'] }}@if($i + 1 < count($milestoneReport['classSectionTeacher'])){{ ', ' }}@endif @endforeach

Date: {{ $milestoneReport['currentDate'] ?? '' }}

  • Progress key:

  • @php $progressOrder = [ 'Not yet' => 1, 'Sometimes' => 2, 'Most Of the Time' => 3 ]; $sortedKeys = collect($milestoneReport['progressKeys'] ?? [])->sortBy(function ($key) use ($progressOrder) { return $progressOrder[$key['name']] ?? 999; }); @endphp @foreach($sortedKeys as $key)
  • {{ $key['name'] }}
  • @endforeach
@endif {{-- Domain/Subdomain Strand Section --}} @if(!empty($chunk))
@foreach($chunk as $domain)

{{ $domain['name'] }}

@php $subdomainPairs = array_chunk($domain['sub_domains'] ?? [], 2); @endphp @foreach($subdomainPairs as $pair)
@foreach($pair as $subdomain) @php $strands = $subdomain['strands'] ?? []; $strandCount = count($strands); $other = $pair[0] === $subdomain && isset($pair[1]) ? $pair[1] : $pair[0]; $otherCount = count($other['strands'] ?? []); $maxCount = max($strandCount, $otherCount); $strands = array_pad($strands, $maxCount, null); @endphp

{{ $subdomain['name'] }}

@foreach($strands as $strand) @if($subdomain['name'] === 'Expresses Preferences in Work and Play') @elseif($subdomain['name'] === 'Pre-reading') @elseif($subdomain['name'] === 'Shapes and Colours') @elseif($subdomain['name'] === 'Music and Movement') @else @endif @endforeach
{{ $strand['strand'] ?? '' }} {{ $strand['strand'] ?? '' }} {{ $strand['strand'] ?? '' }} {{ $strand['strand'] ?? '' }} {{ $strand['strand'] ?? '' }} @if(!empty($strand['progress_key'])) @endif
@endforeach
@endforeach
@endforeach
@if($isLast && !empty($milestoneReport['customTextBox']['value']))

{{ $milestoneReport['customTextBox']['title'] }}

{{ $milestoneReport['customTextBox']['value'] }}
@endif @endif
@endforeach