{{-- Smart Report v2 - "smart-report.pdf" template group (CBR + CBC + BTS/WTS + HE). --}} {{-- PR1: Scaffold with patient header + 4-up card grid. PR2 finalises the card internals. --}} @php /** @var array $group Group view-model built by SmartReportV2Service */ $packages = $group['packages'] ?? []; $firstPackage = $group['firstPackage'] ?? ($packages[0] ?? null); // Split into 4-up pages the same way SmartReportService::GetCbrPDF does // (key % 4 === 0 triggers a new page in FPDI). $pages = array_chunk($packages, 4); @endphp @foreach ($pages as $pageIdx => $pagePackages)
@include('pdf.smart_report.components.backgrounds.bg', ['template' => 'smart-report', 'page' => 1]) {{-- Patient info header (top of page, coordinates mirror setPatiantInfoWithAdvice) --}} @include('pdf.smart_report.components.patient_header', [ 'Order' => $Order, 'Profile' => $Profile, 'firstPackage' => $firstPackage, 'Category' => $group['category_ar'] ?? '', 'Description' => $group['category_description_ar'] ?? '', ]) {{-- 4-up meter card grid. The FPDI layout uses: key % 2 == 0 -> y = 94mm, key % 2 == 1 -> y = 157mm key % 4 in (0,1) -> left column x = 100mm key % 4 in (2,3) -> right column x = 0mm We preserve that mapping 1:1. --}} @foreach ($pagePackages as $cardIdx => $Package) @php $y = ($cardIdx % 2 === 0) ? 94 : 157; $x = ($cardIdx % 4 < 2) ? 100 : 0; @endphp @include('pdf.smart_report.components.cbr_card', [ 'Package' => $Package, 'card' => $card ?? [], 'x' => $x, 'y' => $y, ]) @endforeach
@endforeach