{{-- Smart Report v2 - CBR meter card. Mirrors per-card layout from --}} {{-- SmartReportService::GetCbrPDF (lines 187-2572). All inner positions --}} {{-- are in mm relative to the (x, y) origin of the card. --}} {{-- v1 `continue`s before drawing anything when the package has no --}} {{-- eNDUSERPACKAGEREFERENCE (v1:241-245), so the card slot stays blank. --}} @if (!empty($Package->eNDUSERPACKAGEREFERENCE)) @php /** @var \App\Services\SmartReportV2Service $service */ $service = $service ?? app(\App\Services\SmartReportV2Service::class); $model = $service->buildCardViewModel($Package); $meter = $model['meter_offsets'] ?? ['top' => 1, 'left' => 9, 'width' => 45]; // Title bar font auto-sizing (v1 lines 296-318), computed by the service. $titleFontSize = $model['title_font_size'] ?? 10; // TCPDF Cell alignment -> CSS text-align. $alignMap = ['L' => 'left', 'C' => 'center', 'R' => 'right']; @endphp
{{-- Test name (white text on the coloured header bar). LTR-isolate any --}}
{{-- embedded Latin/symbol run ("(MCHC)", "(MCH)", …) so RTL order keeps --}}
{{-- the parentheses in place instead of flipping them. --}}
{{-- Card title is BOLD to match v1: setPatiantInfoWithAdvice leaves the --}}
{{-- TCPDF font in bold and GetCbrPDF draws this Cell without resetting it. --}}
@php
// A very long title ("فايروس الايدز النوع 1&2 - الأجسام المضادة …")
// overruns the 72mm title bar on a single line. For long titles drop a
// step to 7pt and allow the text to wrap onto two lines inside the 7mm
// bar; short titles keep the single-line 7mm line-box.
$titleLen = mb_strlen((string) $model['test_name_ar'], 'UTF-8');
$titleWrap = $titleLen > 34;
// Very long titles get 6pt so they fit the 72mm bar (wrapping to a
// second line inside the 7mm bar when still too wide).
$titlePt = $titleWrap ? ($titleLen > 44 ? 6 : 7) : $titleFontSize;
@endphp
{{-- ── Meter island: gauge PNG + threshold labels as one positioned unit. ── --}}
{{-- The island sits at the card origin (0,0), so every inner offset below is --}}
{{-- byte-for-byte the card-relative value it always had; nudging the whole --}}
{{-- gauge now means changing the island's top/left, not each element. --}}