praakreditasi/resources/views/pitstop/monitoring_pdf.blade.php

233 lines
6.0 KiB
PHP

<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>{{ $title ?? 'Monitoring Pra Akreditasi' }}</title>
<style>
/* ===== GLOBAL ===== */
* { box-sizing: border-box; }
body {
margin: 0;
font-family: DejaVu Sans, Arial, sans-serif;
font-size: 12px;
line-height: 1.35;
color: #111827;
font-weight: 400;
}
/* ===== HEADER ===== */
.h1 {
font-size: 16px;
font-weight: 700;
margin: 0;
}
.meta {
margin-top: 4px;
color: #6b7280;
font-size: 10.5px;
}
/* ===== UNIT ===== */
.unit {
margin-top: 16px;
page-break-inside: auto;
}
.unit-head {
padding: 10px 12px;
border: 1px solid #e5e7eb;
background: #f3f4f6;
}
.unit-title {
font-size: 13px;
font-weight: 700;
}
.unit-meta {
margin-top: 4px;
font-size: 11px;
color: #6b7280;
}
/* ===== TABLE ===== */
.table {
width: 100%;
table-layout: fixed;
border-collapse: collapse;
margin-top: 10px;
}
.table th,
.table td {
border: 1px solid #e5e7eb;
padding: 7px 9px;
vertical-align: top;
word-wrap: break-word;
overflow-wrap: break-word;
}
.col-no {
font-size: 9px;
padding: 3px 4px;
width: 18px !important;
min-width: 18px !important;
max-width: 18px !important;
}
.table th {
background: #f9fafb;
font-weight: 700;
font-size: 12px;
}
.table td {
font-size: 12px;
font-weight: 400;
}
/* Keep header repeated on page-break (PDF renderers) */
thead { display: table-header-group; }
tfoot { display: table-footer-group; }
/* Avoid making tables "unbreakable" (can push content to next page) */
tr { page-break-inside: auto; }
td, th { page-break-inside: auto; }
.unit-head { page-break-inside: avoid; }
/* Zebra biar enak dibaca */
.table tr:nth-child(even) {
background: #fafafa;
}
/* ===== ALIGN ===== */
.text-right {
text-align: right;
}
.nowrap {
white-space: nowrap;
}
/* ===== BADGE ===== */
.badge {
display: inline-block;
padding: 3px 8px;
border-radius: 12px;
font-size: 10.5px;
font-weight: 600;
}
.badge-ok {
background: #dcfce7;
color: #166534;
}
.badge-warn {
background: #fff7ed;
color: #9a3412;
}
.muted {
color: #6b7280;
}
/* ===== PRINT FIX ===== */
@page {
margin: 20px;
}
</style>
</head>
<body>
<div>
<div class="h1">{{ $title ?? 'Monitoring Pra Akreditasi' }}</div>
<div class="meta">
Dicetak: {{ optional($generatedAt)->format('Y-m-d H:i') }}
</div>
</div>
@if (($isSummaryOnly ?? false) === true)
<table class="table" style="margin-top: 14px;">
<colgroup>
<col style="width: 18px">
<col>
<col style="width: 110px">
</colgroup>
<thead>
<tr>
<th style="width: 5px;" class="nowrap col-no">No</th>
<th style="width: 70%;">Unit</th>
<th class="text-right nowrap" style="width: 25%;">Karyawan Selesai / Total</th>
</tr>
</thead>
<tbody>
@forelse ($units ?? [] as $i => $u)
<tr>
<td class="">{{ $i + 1 }}</td>
<td>
{{ $u->unit_name }}
</td>
<td class="text-right nowrap">{{ number_format((int) $u->pegawai_selesai) }}/{{ number_format((int) $u->total_pegawai) }}</td>
</tr>
@empty
<tr>
<td colspan="3" class="muted">Tidak ada data.</td>
</tr>
@endforelse
</tbody>
</table>
@else
@forelse ($units ?? [] as $u)
<div class="unit">
<div class="unit-head">
<div class="unit-title">{{ $u->unit_name }}</div>
<div class="unit-meta">
Total Karyawan: <b>{{ number_format((int) $u->total_pegawai) }}</b>
&nbsp;|&nbsp; Karyawan Selesai: <b>{{ number_format((int) $u->pegawai_selesai) }}</b>
</div>
</div>
<table class="table">
<colgroup>
<col style="width: 18px">
<col style="width: 210px">
<col style="width: 120px">
<col style="width: 120px">
<col>
</colgroup>
<thead>
<tr>
<th style="width: 5%;" class="nowrap col-no">No</th>
<th style="width: 25%;">Nama</th>
<th style="width: 15%;" class="nowrap">NIP</th>
<th class="text-right nowrap" style="width: 15%;">Lulus / Total PitStop</th>
<th style="width: 40%;">PitStop Belum Selesai</th>
</tr>
</thead>
<tbody>
@forelse ($u->pegawai ?? [] as $i => $p)
@php
$selesai = ((int) ($p->total_steps ?? 0)) > 0 && ((int) ($p->lulus_steps ?? 0)) >= ((int) ($p->total_steps ?? 0));
@endphp
<tr>
<td class="text-right nowrap col-no">{{ $i + 1 }}</td>
<td>{{ $p->nama }}</td>
<td class="nowrap">{{ $p->nip_pns }}</td>
<td class="text-right nowrap">{{ number_format((int) $p->lulus_steps) }}/{{ number_format((int) $p->total_steps) }}</td>
<td>{{ $selesai ? '-' : ($p->belum_selesai_steps !== '' ? $p->belum_selesai_steps : '-') }}</td>
</tr>
@empty
<tr>
<td colspan="5" class="muted">Tidak ada data pegawai.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
@empty
<div class="muted" style="margin-top: 14px;">Tidak ada data.</div>
@endforelse
@endif
</body>
</html>