MIF_E31212322/resources/views/pages/print4.blade.php

108 lines
3.9 KiB
PHP

<!DOCTYPE html>
<html>
<head>
<title>{{ $judul }}</title>
<!-- Fonts and icons -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700" rel="stylesheet" />
<!-- Nucleo Icons -->
<link href="../css/nucleo-icons.css" rel="stylesheet" />
<link href="../css/nucleo-svg.css" rel="stylesheet" />
<!-- Font Awesome Icons -->
<script src="https://kit.fontawesome.com/42d5adcbca.js" crossorigin="anonymous"></script>
<link href="../css/nucleo-svg.css" rel="stylesheet" />
<!-- CSS Files -->
<link id="pagestyle" href="../css/argon-dashboard.css?v=2.0.4" rel="stylesheet" />
<style>
/* Gaya CSS untuk tampilan cetak */
@media print {
body {
font-family: Arial, sans-serif;
font-size: 12px;
display: flex;
flex-direction: column;
height: 100vh;
}
h1 {
font-size: 18px;
margin-bottom: 10px;
text-align: center;
}
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 10px;
}
th, td {
padding: 5px;
border: 1px solid #000;
}
/* Gaya CSS untuk tampilan cetak */
@media print {
#printButton {
display: none;
}
}
}
</style>
</head>
<body>
<h1 >{{ $judul }}</h1>
<table>
<div class="table-responsive p-0">
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Rangking</th>
<th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Kode</th>
<th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Nama</th>
<th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Nilai Bobot</th>
<th class="text-center text-uppercase text-secondary text-xxs font-weight-bolder opacity-7">Keterangan</th>
</tr>
</thead>
<tbody>
@php
// Urutkan rangking berdasarkan total secara descending
$sortedRangkings = $rangkings->sortByDesc('total');
@endphp
@foreach ($sortedRangkings as $item)
<tr>
<!-- Gunakan $loop->iteration untuk nomor peringkat -->
<td class="text-center">{{ $loop->iteration }}</td>
<td class="text-center">{{ $item->kode }}</td>
<td class="text-center">{{ $item->penduduk->nama ?? 'N/A' }}</td>
<td class="text-center">{{ $item->total }}</td>
<td class="text-center">
@php
// Tentukan kelas tombol berdasarkan status
$buttonClass = $item->keterangan == 'Layak' ? 'btn-success' : 'btn-danger';
@endphp
<button class="btn btn-sm {{ $buttonClass }}" disabled>{{ $item->keterangan }}</button>
</td>
</tr>
@endforeach
</tbody>
</table>
<button id="printButton" class="btn btn-primary btn-sm print-button" style="margin-left: 20px;" onclick="printPage()">
<i class="fa fa-print"></i> Print
</button>
<script>
function printPage() {
window.print();
}
</script>
</body>
</html>