MIF_HomsinNIME31231582/resources/views/pdf/report.blade.php

66 lines
2.0 KiB
PHP

{{-- resources/views/pdf/report.blade.php --}}
<!DOCTYPE html>
<html>
<head>
<title>{{ $title }}</title>
<style>
body { font-family: Arial, sans-serif; }
table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
th { background-color: #f2f2f2; }
.header { text-align: center; margin-bottom: 30px; }
.stats { margin-bottom: 20px; }
.positive { color: green; }
.negative { color: red; }
</style>
</head>
<body>
<div class="header">
<h1>{{ $title }}</h1>
<p>Tanggal: {{ $date }}</p>
<p>Diekspor oleh: {{ auth()->user()->name ?? 'Admin' }}</p>
</div>
<div class="stats">
<h3>Statistik Sentimen</h3>
<table>
<tr>
<th>Total Data</th>
<td>{{ $totalData }}</td>
</tr>
<tr>
<th>Positif</th>
<td class="positive">{{ $positif }} ({{ number_format(($positif / $totalSafe) * 100, 1) }}%)</td>
</tr>
<tr>
<th>Negatif</th>
<td class="negative">{{ $negatif }} ({{ number_format(($negatif / $totalSafe) * 100, 1) }}%)</td>
</tr>
</table>
</div>
<h3>Data Review</h3>
<table>
<thead>
<tr>
<th>No</th>
<th>Review</th>
<th>Score</th>
<th>Sentimen</th>
<th>Tanggal</th>
</tr>
</thead>
<tbody>
@foreach($dataset as $index => $review)
<tr>
<td>{{ $index + 1 }}</td>
<td>{{ $review->review }}</td>
<td>{{ $review->score }}</td>
<td>{{ ucfirst($review->sentiment) }}</td>
<td>{{ $review->created_at->format('d/m/Y') }}</td>
</tr>
@endforeach
</tbody>
</table>
</body>
</html>