{{-- Smart Report v2 - Patient / page header. --}} {{-- Coordinates mirror SmartReportService::setPatiantInfoWithAdvice 1:1 --}} {{-- (lines 6025-6390). All positioning is in mm against the rasterised --}} {{-- smart-report.pdf background. The view-model is built by --}} {{-- SmartReportV2Service::buildPageHeaderModel. --}} @php /** * @var \App\Services\SmartReportV2Service $service * @var array $header Built by SmartReportV2Service::buildPageHeaderModel() */ $service = $service ?? app(\App\Services\SmartReportV2Service::class); if (!isset($header)) { [$titles] = [$service->deriveHeaderTitles($firstPackage)]; $header = $service->buildPageHeaderModel( $Order, $firstPackage, $Profile, $Name ?? ($firstPackage->NAME ?? $titles['name']), $Category ?? $titles['category'], $Description ?? $titles['description'], $Packages ?? null, $setAdvice ?? true ); } @endphp {{-- Category icon (top-right under hospital logo) --}} @if (!empty($header['category_icon'])) {{-- Aligns with the category title at v1's 54mm. --}} @endif {{-- Profile-specific hospital logo (only Profile #18 in v1) --}} @if (!empty($header['profile_logo'])) @endif {{-- Blazma logo bottom-right --}} @if (!empty($header['blazma_logo']) && is_file($header['blazma_logo'])) @endif {{-- =================================================================== --}} {{-- Footer band (flow / flexbox — Phase 1 refactor). One row under the --}} {{-- hairline: profile footer logo (left) · Blazma+تقنية سعودية (centre) · --}} {{-- signatures + QR (right). Element order/size is controlled by the --}} {{-- .sr-footer* utility classes in result.blade.php, not per-item mm. --}} {{-- =================================================================== --}} @php $blazmaTechLogo = public_path('img/smart-report-pdf/bg-html/teal/blazma-tech-logo.png'); @endphp {{-- =================================================================== --}} {{-- Gender avatar (left side) --}} {{-- =================================================================== --}} @if (!empty($header['gender_icon'])) {{-- Figma avatar: 130px circle, 22.8mm. On the per-test pages there is no --}} {{-- top logo/badge strip (that is summary-only), so the whole header is --}} {{-- pulled up to a ~12mm top margin instead of Figma's logo-reserved 33.8mm. --}} @endif {{-- =================================================================== --}} {{-- Top information strip (gender, age, identification, hospital, dates) --}} {{-- V1 uses Cell(...,'L') = left-aligned from SetXY. Use direction:ltr --}} {{-- so global direction:rtl doesn't shift these values off their boxes. --}} {{-- topStrip 'stool' mirrors GetStoolanalysisPDF (7146-7185): the stool --}} {{-- background has no printed labels, so label+value strings are drawn --}} {{-- as text, and there are no Date / Collection / Result time rows. --}} {{-- =================================================================== --}} @if (($topStrip ?? 'generic') === 'stool')
Gender: {{ $header['gender_label'] }}
Age: {{ !empty($Order->eNDUSER->DATE_OF_BIRTH) ? \Carbon\Carbon::parse($Order->eNDUSER->DATE_OF_BIRTH)->diff(\Carbon\Carbon::now())->format('%y') : '' }}
Patient ID: {{ $header['identification'] }}
Medical center: {{ $header['hospital_name'] }}
Order ID: {{ $header['order_id'] }}
@else {{-- =================================================================== --}} {{-- Figma redesign: LTR icon-label info strip. --}} {{-- Each field = a small teal outline icon, a light-grey label under it, --}} {{-- and the black value below. Fields are laid out as evenly-spaced --}} {{-- columns left-to-right, wrapping to a 2nd row (all fields kept). --}} {{-- Icons are inline SVG (teal #019CA7, 1.6px stroke) so no raster assets --}} {{-- are needed. --}} {{-- =================================================================== --}} @php $iconTeal = 'rgb(1,156,167)'; // Inline-SVG line icons keyed by field, sized ~4mm. $hdrIcons = [ 'gender' => '', 'age' => '', 'id' => '', 'order' => '', 'date' => '', 'lab' => '', 'clock' => '', 'check' => '', ]; // Make every icon fill its box and render as a block so wkhtmltopdf gives // it no inline-baseline descender (which would drop the glyph below the // label line). foreach ($hdrIcons as $k => $svg) { $hdrIcons[$k] = str_replace(' @foreach ($hdrRows as $r => $row) @php // Drop empties, then place the SURVIVORS into consecutive slots // (row 1: cols 0,1,2… — row 2: cols 0,2,3 under Gender/Patient // ID/Order ID) so a missing field never leaves a mid-row gap. $rowFields = array_values(array_filter($row, fn ($f) => (string) $f[2] !== '')); $slots = array_fill(0, 5, null); foreach ($rowFields as $i => $f) { $col = ($r === 0) ? $i : ($hdrRow2Cols[$i] ?? $i); $slots[$col] = $f; } @endphp
@foreach ($slots as $col => $f)
@if ($f) @php [$ik, $label, $value] = $f; @endphp
{!! $hdrIcons[$ik] !!}
{{ $label }}
{{ $value }}
@endif
@endforeach
@endforeach @endif {{-- =================================================================== --}} {{-- Description (right-aligned; generic mm 12,65 10pt / stool 12,66 11pt). --}} {{-- Light weight to match v1, which draws SMART_DESC_AR in the DIN Next --}} {{-- Arabic LIGHT font (SmartReportService line 280). --}} {{-- =================================================================== --}}
{{-- Latin/English runs (test-name abbreviations, "Screening: Total Abs", --}} {{-- "Anti-Treponema – Syphilis", …) are LTR-isolated so the RTL paragraph --}} {{-- keeps them intact instead of scrambling them into the Arabic. --}} {!! nl2br($service->isolateLtrRuns($header['description'] ?? '')) !!}
{{-- =================================================================== --}} {{-- Advice strip — a BOTTOM-anchored flow column ending just above the --}} {{-- footer hairline (260.4mm). Items stack with their real heights (a --}} {{-- 3-line advice pushes the ones above it up), so long advices can no --}} {{-- longer overlap each other or spill into the footer the way the old --}} {{-- fixed 15mm slots did. --}} {{-- =================================================================== --}} @if (count($header['advices']))
@foreach ($header['advices'] as $advice)
@if (!empty($advice['icon'])) @endif
{{ $advice['name'] }}
@endforeach
@endif {{-- =================================================================== --}} {{-- Patient name (Figma redesign): large black, single line, spanning the --}} {{-- full width to the right of the avatar, sitting ABOVE the header --}} {{-- divider and the field row. Long names shrink one step instead of --}} {{-- wrapping so the divider position stays fixed. --}} {{-- =================================================================== --}} @php // Figma name: x=36.8 y=34.1, 13.9pt, weight 600, colour #04090D, single // line spanning to the side band. Long names shrink one step so the divider // (frame.blade.php, y=43.8) stays put instead of the name wrapping into it. $nameLen = mb_strlen($header['name'] ?? '', 'UTF-8'); $nameSize = $nameLen > 40 ? 11 : ($nameLen > 30 ? 12.5 : 13.9); @endphp
{{ $header['name'] }}
{{-- Hairline ABOVE the category title — separates the patient-info field grid --}} {{-- from the report-content (category) section. Both edges match the header --}} {{-- name divider (36.8 .. 197.8mm) so the two lines align left and right. --}}
{{-- Category title — v1 position: SetXY(12, 54), Cell(150,10,'R'), 24pt. --}} {{-- (v2 recolours it teal.) --}}
{{ $header['category'] }}