<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">

    <style>
        body {
            font-family: DejaVu Sans;
            font-size: 11px;
        }

        .judul {
            text-align: center;
            margin-bottom: 15px;
        }

        .judul h2 {
            margin: 0;
            font-size: 18px;
        }

        .judul h3 {
            margin: 4px 0 0 0;
            font-size: 14px;
            font-weight: normal;
        }

        .info {
            width: 100%;
            margin-bottom: 15px;
            border-collapse: collapse;
        }

        .info td {
            border: none;
            padding: 2px;
        }

        .tabel {
            width: 100%;
            border-collapse: collapse;
        }

        .tabel th,
        .tabel td {
            border: 1px solid #000;
            padding: 5px;
        }

        .tabel th {
            text-align: center;
            background: #d9d9d9;
            font-weight: bold;
        }

        .center {
            text-align: center;
        }

        .ttd {
            width: 100%;
            margin-top: 45px;
            border: none;
        }

        .ttd td {
            border: none;
            text-align: center;
            width: 50%;
        }

        .nama {
            margin-top: 65px;
            font-weight: bold;
            text-decoration: underline;
        }
    </style>

</head>

<body>

    <div class="judul">
        <h2>REKAP PELANGGARAN MURID</h2>
        <h2>KELAS <?= strtoupper($kelas['nama_kelas']); ?></h2>
    </div>

    <table class="info">

        <tr>
            <td width="18%">Kelas</td>
            <td width="2%">:</td>
            <td><?= $kelas['nama_kelas']; ?></td>

            <td width="20%">Tanggal Cetak</td>
            <td width="2%">:</td>
            <td><?= $tanggal; ?></td>
        </tr>

        <tr>
            <td>Wali Kelas</td>
            <td>:</td>
            <td><?= $walikelas['nama'] ?? '-'; ?></td>

            <td>Jam Cetak</td>
            <td>:</td>
            <td><?= $jam; ?></td>
        </tr>

        <tr>

            <td></td>
            <td></td>
            <td></td>
        </tr>

    </table>

    <table class="tabel">

        <thead>

            <tr>
                <th width="5%">No</th>
                <th width="12%">NIS</th>
                <th width="23%">Nama Murid</th>
                <th>Jenis Pelanggaran</th>
                <th width="18%">Keterangan</th>
                <th width="15%">Guru Pencatat</th>
                <th width="15%">Tanggal</th>
                <th width="10%">Skor</th>
            </tr>

        </thead>

        <tbody>

            <?php $no = 1; ?>

            <?php if (!empty($pelanggaran)): ?>

                <?php foreach ($pelanggaran as $p): ?>

                    <tr>
                        <td class="center"><?= $no++; ?></td>

                        <td class="center"><?= $p['nis']; ?></td>

                        <td><?= $p['nama_siswa']; ?></td>

                        <td><?= $p['nama_pelanggaran']; ?></td>

                        <td><?= $p['keterangan_tambahan']; ?></td>

                        <td><?= $p['nama_guru']; ?></td>

                        <td class="center">
                            <?= date('d-m-Y H:i:s', strtotime($p['tanggal'])); ?>
                        </td>

                        <td class="center"><?= $p['skor']; ?></td>
                    </tr>

                <?php endforeach; ?>

            <?php else: ?>

                <tr>
                    <td colspan="8" class="center">
                        Belum ada pelanggaran tercatat
                    </td>
                </tr>

            <?php endif; ?>

        </tbody>

    </table>

    <table class="ttd" width="100%">
        <tr>

            <td style="padding-top:40px;">
                Guru BK
                <div class="nama">
                    <?= $gurubk['nama'] ?? '(...................................)'; ?>
                </div>
            </td>

            <td style="padding-top:40px;">
                Bandung, <?= $tanggal; ?><br>
                Wali Kelas
                <div class="nama">
                    <?= $gurubk['nama'] ?? '(...................................)'; ?>
                </div>
            </td>

        </tr>
        <tr></tr>
        <tr></tr>
        <tr>

            <td>
                Mengetahui,<br>
                Plt. Kepala SMP Negeri 5 Bandung
                <div class="nama">
                    Trismawati, S.S., M.Pd.
                </div>
            </td>

            <td>

                Wakasek Kesiswaan
                <div class="nama">
                    <?= $kesiswaan['nama'] ?? '(...................................)'; ?>
                </div>
            </td>

        </tr>



    </table>

</body>

</html>