Files
ilycats/resources/views/pages/reports/pdf_template.blade.php
T
2026-02-08 15:16:35 +07:00

140 lines
6.8 KiB
PHP

<!DOCTYPE html>
<html>
<head>
<title>{{ $title }}</title>
<style>
body { font-family: 'Helvetica', sans-serif; font-size: 10px; color: #333; margin: 0; }
.header { text-align: center; margin-bottom: 30px; border-bottom: 2px solid #4f46e5; padding-bottom: 10px; }
.header h1 { margin: 0; color: #1e293b; font-size: 18px; text-transform: uppercase; }
.header p { margin: 5px 0; color: #64748b; font-size: 8px; letter-spacing: 2px; }
.meta-info { margin-bottom: 20px; width: 100%; }
.meta-info td { vertical-align: top; }
table { width: 100%; border-collapse: collapse; margin-bottom: 20px; table-layout: fixed; }
th { background-color: #f8fafc; border: 1px solid #e2e8f0; padding: 8px; text-align: left; text-transform: uppercase; color: #475569; font-size: 8px; }
td { border: 1px solid #e2e8f0; padding: 8px; vertical-align: top; word-wrap: break-word; }
/* Status Colors */
.badge { padding: 3px 6px; border-radius: 4px; font-weight: bold; font-size: 7px; text-transform: uppercase; }
.bg-red { background-color: #fee2e2; color: #991b1b; }
.bg-amber { background-color: #fef3c7; color: #92400e; }
.bg-green { background-color: #d1fae5; color: #065f46; }
.bg-slate { background-color: #f1f5f9; color: #475569; }
.footer { position: fixed; bottom: 0; width: 100%; text-align: center; font-size: 8px; color: #94a3b8; border-top: 1px solid #e2e8f0; padding-top: 5px; }
</style>
</head>
<body>
<div class="header">
<h1>ILY CATTERY - INTELLIGENCE REPORT</h1>
<p>MODUL: {{ strtoupper($module) }} | UNIT ANALYTICS SYSTEM</p>
</div>
<table class="meta-info">
<tr>
<td width="50%">
<strong>Dicetak Oleh:</strong> {{ Auth::user()->name }}<br>
<strong>Tanggal Cetak:</strong> {{ now()->translatedFormat('d F Y H:i') }}
</td>
<td width="50%" style="text-align: right;">
<strong>Total Data:</strong> {{ count($data) }} Records<br>
<strong>Status Laporan:</strong> {{ strtoupper($title) }}
</td>
</tr>
</table>
<table>
<thead>
<tr>
<th width="30px">No</th>
{{-- JUDUL KOLOM DINAMIS --}}
@if($module == 'cats')
<th>Nama Kucing</th><th>Ras</th><th>Kelamin</th><th>Tgl Lahir</th><th>Status</th>
@elseif(in_array($module, ['vaccine', 'deworming', 'flea', 'grooming']))
<th>Nama Kucing</th><th>Tindakan</th><th>PIC Staf</th><th>Jadwal</th><th>Status Analitik</th>
@elseif(in_array($module, ['medicine', 'food', 'supplies']))
<th>Nama Produk</th><th>Stok</th><th>Unit</th><th>Tgl Expired</th><th>Kondisi</th>
@else
<th>Informasi Utama</th><th>Detail</th><th>PIC</th><th>Tanggal</th><th>Status</th>
@endif
</tr>
</thead>
<tbody>
@forelse($data as $index => $item)
@php
// Deteksi Kolom Tanggal
$dateCol = match($module) {
'cats' => 'tanggal_lahir',
'vaccine' => 'jadwal_vaksin',
'deworming' => 'jadwal_obat_cacing',
'flea' => 'jadwal_obat_kutu',
'grooming' => 'jadwal_grooming',
'medicine', 'food' => 'expired_date',
default => 'created_at'
};
$dateVal = $item->{$dateCol};
@endphp
<tr>
<td style="text-align: center;">{{ $index + 1 }}</td>
{{-- ISI DATA DINAMIS --}}
@if($module == 'cats')
<td><strong>{{ $item->nama_kucing }}</strong></td>
<td>{{ $item->ras }}</td>
<td>{{ $item->jenis_kelamin }}</td>
<td>{{ $item->tanggal_lahir ? \Carbon\Carbon::parse($item->tanggal_lahir)->format('d/m/Y') : '-' }}</td>
<td>
<span class="badge {{ $item->riwayat_sakit_terakhir ? 'bg-amber' : 'bg-green' }}">
{{ $item->riwayat_sakit_terakhir ? 'In Treatment' : 'Healthy' }}
</span>
</td>
@elseif(in_array($module, ['vaccine', 'deworming', 'flea', 'grooming']))
<td><strong>{{ $item->nama_kucing }}</strong></td>
<td>{{ strtoupper($module) }}</td>
<td>{{ $item->pic->name ?? '-' }}</td>
<td>{{ $dateVal ? \Carbon\Carbon::parse($dateVal)->format('d/m/Y') : 'NOT SET' }}</td>
<td>
@if(empty($dateVal))
<span class="badge bg-slate">Date Not Set</span>
@elseif(\Carbon\Carbon::parse($dateVal)->isPast())
<span class="badge bg-red">Overdue</span>
@elseif(\Carbon\Carbon::parse($dateVal)->diffInDays(now()) <= 7)
<span class="badge bg-amber">Soon</span>
@else
<span class="badge bg-green">Safe</span>
@endif
</td>
@elseif(in_array($module, ['medicine', 'food', 'supplies']))
<td><strong>{{ $item->nama_obat ?? $item->nama_makanan ?? $item->nama_perlengkapan }}</strong></td>
<td>{{ $item->qty }}</td>
<td>{{ $item->unit }}</td>
<td>{{ $item->expired_date ? \Carbon\Carbon::parse($item->expired_date)->format('d/m/Y') : '-' }}</td>
<td>
@if($item->qty < 5)
<span class="badge bg-red">Low Stock</span>
@elseif($item->expired_date && \Carbon\Carbon::parse($item->expired_date)->isPast())
<span class="badge bg-red">Expired</span>
@else
<span class="badge bg-green">Ready</span>
@endif
</td>
@endif
</tr>
@empty
<tr>
<td colspan="6" style="text-align: center; padding: 20px;">Data Tidak Ditemukan</td>
</tr>
@endforelse
</tbody>
</table>
<div class="footer">
Ily Cattery Intelligence System - Dokumen Sah Dihasilkan Secara Otomatis
</div>
</body>
</html>