@php $navDark = '#1a2035'; $tealAccent = '#2dd4bf'; $primary = '#008060'; $appName = config('app.name', 'TaskCo'); $company = $company ?? []; $companyName = $company['name'] ?? $appName; $companyEmail = $company['email'] ?? null; $companyPhone = $company['phone'] ?? null; $companyAddr = $company['address'] ?? null; $companyCity = trim(implode(', ', array_filter([$company['city'] ?? null, $company['state'] ?? null]))); $companyCountry = trim(implode(', ', array_filter([$company['country'] ?? null, $company['zip'] ?? null]))); $logoDataUri = $logoDataUri ?? null; $reportLabel = $reportLabel ?? 'Report'; $reportUid = $reportUid ?? ('RPT-' . strtoupper(substr(md5(uniqid()), 0, 8))); $filterSummary = $filterSummary ?? ''; $generatedBy = $generatedBy ?? (auth()->user()?->name ?? 'System'); $generatedAt = now()->format('d M Y, H:i'); $columns = $columns ?? []; $columnLabels = $columnLabels ?? []; $rows = $rows ?? []; $rowCount = $rowCount ?? count($rows); $fieldCount = $fieldCount ?? count($columns); // Build filter pills from "Label: Value | Label: Value" string $filterPills = []; if ($filterSummary && $filterSummary !== 'All records') { foreach (explode(' | ', $filterSummary) as $part) { if (trim($part) !== '') $filterPills[] = trim($part); } } $colCount = count($columns) + 1; $condensed = count($columns) > 8; $cellPad = $condensed ? '4px 7px' : '6px 9px'; $fontSize = $condensed ? '7.5px' : '8.5px'; $thSize = $condensed ? '7px' : '8px'; // Detect numeric columns and compute column totals $numericKw = ['total', 'amount', 'price', 'value', 'subtotal', 'paid', 'due', 'balance', 'cost', 'revenue', 'tax', 'discount', 'charge', 'fee']; $columnTotals = []; foreach ($columns as $col) { $colLow = strtolower($col); foreach ($numericKw as $kw) { if (str_contains($colLow, $kw)) { $sum = 0; foreach ($rows as $row) { $v = str_replace([',', ' '], '', (string)($row[$col] ?? '0')); if (is_numeric($v)) $sum += (float)$v; } if ($sum > 0) $columnTotals[$col] = number_format($sum, 2); break; } } } $hasTotal = !empty($columnTotals) && count($rows) > 0; // Find last numeric col key (for TOTAL label placement) $firstNumericCol = array_key_first($columnTotals); @endphp {{ $reportLabel }} {{-- Fixed dark footer – repeats on every PDF page --}} {{-- ══ Repeating page header ════════════════════════════════════════ --}} {{-- Column header row --}} @foreach($columns as $col) @endforeach {{-- ══ Data rows ════════════════════════════════════════════════════ --}} @forelse($rows as $ri => $row) @foreach($columns as $col) @endforeach @empty @endforelse {{-- Total row (only when numeric columns found) --}} @if($hasTotal) @foreach($columns as $ci => $col) @endforeach @endif
{{-- Dark header block --}}
{{-- LEFT: Logo + company --}} {{-- RIGHT: Report info --}}
@if($logoDataUri) @else
{{ strtoupper(substr($companyName, 0, 1)) }}
@endif
{{ $companyName }}
@if($companyEmail)
{{ $companyEmail }}
@endif @if($companyPhone)
{{ $companyPhone }}
@endif @if($companyAddr || $companyCity || $companyCountry)
{{ implode(', ', array_filter([$companyAddr, $companyCity, $companyCountry])) }}
@endif
Generated Report
{{ $reportLabel }}
UID: {{ $reportUid }}
Generated: {{ $generatedAt }}
Generated By: {{ $generatedBy }}
{{-- Filter pills bar --}}
◈ Filters Applied @if(count($filterPills)) @foreach($filterPills as $pill) {{ $pill }} @endforeach @else No filters applied — all records @endif
{{-- Info bar --}}
Records: {{ number_format($rowCount) }} | Fields: {{ $fieldCount }} | Export Type: Data ⚠ Confidential
#{{ $columnLabels[$col] ?? ucwords(str_replace('_', ' ', $col)) }}
{{ $ri + 1 }} @php $val = $row[$col] ?? ''; @endphp @if(is_null($val) || $val === '') @elseif(is_bool($val)) {{ $val ? 'Yes' : 'No' }} @elseif(is_array($val)) {{ json_encode($val, JSON_UNESCAPED_UNICODE) }} @else {{ $val }} @endif
No data available for the selected parameters.
@if(isset($columnTotals[$col])) {{ $columnTotals[$col] }} @elseif($ci === 0) Total @endif
{{-- Notes box --}}
📋
Notes
This report contains {{ strtolower($reportLabel) }} transactions for the selected period. All amounts are displayed in the configured currency. @if($filterSummary && $filterSummary !== 'All records') Applied filters: {{ $filterSummary }}. @else No filters were applied — report shows all records. @endif