@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 = []; $index = 0; $page = 0; while ($index < count($data)) { $chunkSize = 3; $chunks[] = array_slice($data, $index, $chunkSize); $index += $chunkSize; $page++; } return $chunks; } } @endphp @php $chunks = getCustomChunks($milestoneReport['progressData'] ?? []); while (count($chunks) < 3) { $chunks[] = []; } @endphp @foreach($chunks as $chunkIndex => $chunk) @php $isFirst = $chunkIndex === 0; $isThird = $chunkIndex === 2; @endphp @if(!$isFirst)
@endif
{{-- PAGE 1 HEADER --}} @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:

  • @foreach($milestoneReport['progressKeys'] ?? [] as $key)
  • {{ $key['name'] }}
  • @endforeach
@endif {{-- DOMAIN/SUBDOMAIN STRAND DATA --}} @if(!empty($chunk))
@foreach($chunk as $domain)

{{ $domain['name'] }}

@if($milestoneReport['student']->classSection->class_id == 1) @foreach($domain['sub_domains'] ?? [] as $subdomain) @php $strands = $subdomain['strands'] ?? []; $strandCount = count($strands); $splitStrands = $strandCount >= 9 ? [array_slice($strands, 0, 5), array_slice($strands, 5, 4)] : [$strands, []]; @endphp @if($strandCount >= 9)

{{ $subdomain['name'] }}

@foreach($splitStrands[0] as $strand) @endforeach
{{ $strand['strand'] ?? '' }} @if(!empty($strand['progress_key'])) @endif
@foreach($splitStrands[1] as $strand) @endforeach
{{ $strand['strand'] ?? '' }} @if(!empty($strand['progress_key'])) @endif
@else

{{ $subdomain['name'] }}

@php $maxStrandCount = $domain['maxStrandCount'] ?? count($strands); $strands = array_pad($strands, $maxStrandCount, null); @endphp @foreach($strands as $strand) @endforeach
{{ $strand['strand'] ?? '' }} @if(!empty($strand['progress_key'])) @endif
@endif @endforeach @else @foreach($domain['sub_domains'] ?? [] as $subdomain)

{{ $subdomain['name'] }}

@php $strands = $subdomain['strands'] ?? []; $maxStrandCount = $domain['maxStrandCount'] ?? count($strands); $strands = array_pad($strands, $maxStrandCount, null); @endphp @foreach($strands as $strand) @endforeach
{{ $strand['strand'] ?? '' }} @if(!empty($strand['progress_key'])) @endif
@endforeach @endif
@endforeach
@endif {{-- COMMENT BOX ONLY ON PAGE 3 --}} @if($isThird && !empty($milestoneReport['customTextBox']['title']) && !empty($milestoneReport['customTextBox']['value']))

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

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