MIF_E31222756/resources/views/complaints/all-pdf.blade.php

158 lines
4.9 KiB
PHP

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Daftar Keluhan</title>
<style>
body {
font-family: Arial, sans-serif;
line-height: 1.6;
color: #333;
}
.header {
text-align: center;
margin-bottom: 20px;
border-bottom: 1px solid #ddd;
padding-bottom: 10px;
}
.logo {
max-width: 150px;
margin-bottom: 10px;
}
h1 {
font-size: 20px;
margin-bottom: 5px;
}
.info-section {
margin-bottom: 20px;
}
.info-section h2 {
font-size: 16px;
margin-bottom: 10px;
border-bottom: 1px solid #eee;
padding-bottom: 5px;
}
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
font-size: 12px;
}
table th, table td {
padding: 8px;
border: 1px solid #ddd;
text-align: left;
}
table th {
background-color: #f5f5f5;
font-weight: bold;
}
tr:nth-child(even) {
background-color: #f9f9f9;
}
.footer {
margin-top: 30px;
text-align: center;
font-size: 12px;
color: #777;
border-top: 1px solid #ddd;
padding-top: 10px;
}
.filter-info {
margin-bottom: 15px;
font-size: 14px;
font-style: italic;
}
</style>
</head>
<body>
<div class="header">
<h1>DAFTAR KELUHAN PELANGGAN</h1>
<p>Dicetak pada: {{ date('d-m-Y H:i:s') }}</p>
</div>
@if(isset($filters) && count($filters) > 0)
<div class="filter-info">
<p><strong>Filter yang digunakan:</strong></p>
<ul>
@foreach($filters as $key => $value)
@if($value)
<li>{{ ucfirst(str_replace('_', ' ', $key)) }}: {{ $value }}</li>
@endif
@endforeach
</ul>
</div>
@endif
<div class="info-section">
<h2>Daftar Keluhan</h2>
<table>
<thead>
<tr>
<th>No</th>
<th>Nama</th>
<th>Jenis Layanan</th>
<th>Tanggal Keluhan</th>
<th>Tanggal Dibuat</th>
<th>Uraian Keluhan</th>
<th>Saran</th>
</tr>
</thead>
<tbody>
@forelse($complaints as $key => $complaint)
<tr>
<td>{{ $key + 1 }}</td>
<td>{{ $complaint->user->name }}</td>
<td>{{ $complaint->jenis_layanan }}</td>
<td>{{ \Carbon\Carbon::parse($complaint->tanggal_keluhan)->format('d M Y') }}</td>
<td>{{ $complaint->created_at->format('d M Y') }}</td>
<td>{{ Str::limit($complaint->uraian_keluhan, 100) }}</td>
<td>{{ Str::limit($complaint->saran, 100) }}</td>
</tr>
@empty
<tr>
<td colspan="7" style="text-align: center;">Tidak ada data keluhan</td>
</tr>
@endforelse
</tbody>
</table>
</div>
<div class="info-section">
<h2>Ringkasan</h2>
<table>
<tr>
<td style="width: 60%;"><strong>Total Keluhan</strong></td>
<td>{{ $complaints->count() }}</td>
</tr>
<tr>
<td><strong>Keluhan Bulan Ini</strong></td>
<td>{{ $complaints->filter(function($item) { return $item->created_at->isCurrentMonth(); })->count() }}</td>
</tr>
<tr>
<td><strong>Jenis Layanan Terbanyak</strong></td>
<td>
@php
$serviceCounts = [];
foreach ($complaints as $complaint) {
if (!isset($serviceCounts[$complaint->jenis_layanan])) {
$serviceCounts[$complaint->jenis_layanan] = 0;
}
$serviceCounts[$complaint->jenis_layanan]++;
}
arsort($serviceCounts);
$topService = key($serviceCounts);
$topCount = reset($serviceCounts);
@endphp
{{ $complaints->count() > 0 ? $topService . ' (' . $topCount . ')' : '-' }}
</td>
</tr>
</table>
</div>
<div class="footer">
<p>Dokumen ini diterbitkan secara elektronik dan tidak memerlukan tanda tangan.</p>
<p>© {{ date('Y') }} SYEBA Air - Laporan Keluhan Pelanggan</p>
</div>
</body>
</html>