<!DOCTYPE html>
<html lang="en">

<head>
    <title>Data Prestasi Santri</title>
    <style>
        table,
        th,
        td {
            border: 1px solid black;
            border-collapse: collapse;
        }

        th,
        td {
            padding: 6px;
        }
    </style>
</head>

<body>
    <table>
        <tr>
            <th>No</th>
            <th>NIS</th>
            <th>Nama Santri</th>
            <th>Kelas Diniyah</th>
            <th>Prestasi</th>
            <th>Perlombaan</th>
            <th>Agenda</th>
            <th>Tanggal</th>
        </tr>
        <?php $no = 1;
        foreach ($prestasisantri as $ptistr) :
            $kelas_diniyah = [
                1 => 'Al-Wadhih Banin',
                2 => 'Al-Wadhih Banat',
                3 => 'Al-Jurūmiyyah Banin',
                4 => 'Al-Jurūmiyyah Banat',
                5 => 'Al-Imriti Banin',
                6 => 'Al-Imriti Banat',
                7 => 'Alfiyah Ula Banin',
                8 => 'Alfiyah Ula Banat',
                9 => 'Alfiyah Tsani Banin',
                10 => 'Alfiyah Tsani Banat',
                11 => 'Alfiyah Tsalits Banin',
                12 => 'Alfiyah Tsalits Banat'
            ]; ?>
            <tr>
                <td><?= $no++ ?></td>
                <td><?= $ptistr->NIS ?></td>
                <td><?= $ptistr->nama_santri ?></td>
                <td><?= $kelas_diniyah[$ptistr->kelas_diniyah] ?? 'Kelas Diniyah Tidak Valid' ?></td>
                <td><?= $ptistr->prestasi ?></td>
                <td><?= $ptistr->perlombaan ?></td>
                <td><?= $ptistr->agenda ?></td>
                <td><?= date('d/m/Y', strtotime($ptistr->tanggal)) ?></td>
            </tr>
        <?php endforeach ?>
    </table>
</body>

</html>