@php // Chunk calls into pages (each page holds $rows × $cols cards) $cardsPerPage = $rows * $cols; $pages = array_chunk($calls, $cardsPerPage); @endphp @foreach($pages as $pageIndex => $pageCalls) @php $padded = array_pad($pageCalls, $cardsPerPage, null); $isLast = $pageIndex === count($pages) - 1; @endphp
@for($row = 0; $row < $rows; $row++)
@for($col = 0; $col < $cols; $col++) @php $idx = $row * $cols + $col; $data = $padded[$idx] ?? null; @endphp
@if($data) @include('calls._pdf-card-bw', $data) @endif
@endfor
@endfor
@endforeach