Teren-app/resources/views/reports/pdf/table.blade.php
Simon Pocrnjič 63e0958b66 Dev branch
2025-11-02 12:31:01 +01:00

39 lines
966 B
PHP

<!DOCTYPE html>
<html lang="sl">
<head>
<meta charset="UTF-8">
<title>{{ $name ?? 'Report' }}</title>
<style>
body { font-family: DejaVu Sans, sans-serif; font-size: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid #ddd; padding: 6px; text-align: left; }
th { background: #f3f4f6; }
h1 { font-size: 18px; margin-bottom: 12px; }
</style>
</head>
<body>
<h1>{{ $name ?? 'Report' }}</h1>
<table>
<thead>
<tr>
@foreach(($columns ?? []) as $col)
<th>{{ $col['label'] ?? $col['key'] }}</th>
@endforeach
</tr>
</thead>
<tbody>
@php $keys = array_map(fn($c) => $c['key'], ($columns ?? [])); @endphp
@foreach(($rows ?? []) as $row)
<tr>
@foreach($keys as $k)
<td>{{ data_get($row, $k) }}</td>
@endforeach
</tr>
@endforeach
</tbody>
</table>
</body>
</html>