@php if (!function_exists('getBase64OrUrlContent')) { function getBase64OrUrlContent($imagePath) { if (filter_var($imagePath, FILTER_VALIDATE_URL)) return $imagePath; $fullPath = public_path($imagePath); if ($fullPath && file_exists($fullPath)) { $ext = pathinfo($fullPath, PATHINFO_EXTENSION); $data = @file_get_contents($fullPath); if ($data !== false) return 'data:image/' . $ext . ';base64,' . base64_encode($data); } return ''; } } // SAR icon helper - guarded against missing file (prevents PDF break) $sarIconBase64 = ''; $sarPath = public_path('img/sar.svg'); if (file_exists($sarPath)) { $sarData = @file_get_contents($sarPath); if ($sarData !== false) $sarIconBase64 = base64_encode($sarData); } @endphp
{{-- First-page header only (not repeated) --}}
@if (!empty($hospital->REPORT_HEADER))
Report Header
@elseif (!empty($profile->REPORT_HEADER))
Report Header
@else
@php $leftLogo = $hospital->REPORT_LEFT_LOGO ?? $profile->LEFT_LOGO ?? null; @endphp @if($leftLogo)
@endif @php $midLogo = $hospital->REPORT_MID_LOGO ?? $profile->LOGO ?? null; @endphp @if($midLogo)
@endif @php $rightLogo = $hospital->REPORT_RIGHT_LOGO ?? $profile->RIGHT_LOGO ?? null; @endphp @if($rightLogo)
@endif
@endif
Lab:
{{ $hospital->NAME_EN ?? 'Hospital Name' }}
Price List:
{{ $priceList->NAME_EN ?? '-' }}
Branch:
{{ $branchHospital->NAME_EN ?? $hospital->NAME_EN ?? 'Branch Name' }}
Price List Type:
{{ $priceList->TYPE ?? ($packages->first()->TYPE_TITLE ?? 'Standard') }}
Tests Count:
{{ $packages_count }} Test(s)
Date:
{{ $date }}
PRICE LIST
@if(!empty($priceList->NAME_EN))
{{ $priceList->NAME_EN }}
@endif @if(!empty($branchHospital->NAME_EN))
{{ $branchHospital->NAME_EN }}
@endif
@foreach($packages as $pkg) @endforeach
Code Test Type Sample Type Sample Condition TAT STAT Price
{{ $pkg->test_code }}
{{ $pkg->NAME_EN }}
{{ $pkg->TYPE_TITLE ?? '-' }}
{{ \Illuminate\Support\Str::limit($pkg->sample_type ?? '-', 100) }}
{{ \Illuminate\Support\Str::limit($pkg->sample_conditions ?? '-', 140) }}
{{ $pkg->formatted_tat !== '' ? $pkg->formatted_tat : '-' }}
{{ $pkg->STAT ?? '-' }}
{{ number_format($pkg->PRICE, 2) }} @if($currency === 'SAR') @if($sarIconBase64 !== '') SAR @else SAR @endif @else {{ $currency }} @endif
Total ({{ $packages_count }} tests): {{ number_format($total, 2) }} @if($currency === 'SAR') @if($sarIconBase64 !== '') SAR @else SAR @endif @else {{ $currency }} @endif