<?php
/*
File ini hanya TEMPLATE kartu.
Variabel yang harus sudah tersedia:

$data
$foto
$qr
$namaSekolah
$alamat
*/
?>

<div class="kartu">

    <!-- HEADER -->

    <div class="header">

        <div class="header-content">

            <img
                src="../../assets/logo/logo.png"
                class="logo"
                alt="Logo">

            <div class="judul">

                <h2><?= $namaSekolah ?></h2>

                <p>KARTU IDENTITAS SISWA</p>

            </div>

            <img
                src="../../assets/logo/tutwuri.png"
                class="logo"
                alt="Tut Wuri">

        </div>

    </div>

    <!-- KONTEN -->

    <div class="konten">
        <!-- ================= FOTO ================= -->

<div class="foto-panel">

    <img
        src="<?= $foto ?>"
        class="foto"
        onerror="this.src='../../uploads/foto/default.png'">

</div>

<!-- ================= IDENTITAS ================= -->

<div class="info-panel">

    <div class="nama">
        <?= strtoupper(htmlspecialchars($data['nama_siswa'] ?? $data['nama'] ?? 'NAMA SISWA')) ?>
    </div>

    <div class="badge-kelas">
        <?= htmlspecialchars($data['nama_kelas']) ?>
    </div>

    <table class="identitas">

        <tr>

            <td class="label">

                <i class="fas fa-id-card"></i>

                NIS

            </td>

            <td class="titik">:</td>

            <td>

                <?= htmlspecialchars($data['nis']) ?>

            </td>

        </tr>

        <?php if(!empty($data['nisn'])){ ?>

        <tr>

            <td class="label">

                <i class="fas fa-user-graduate"></i>

                NISN

            </td>

            <td class="titik">:</td>

            <td>

                <?= htmlspecialchars($data['nisn']) ?>

            </td>

        </tr>

        <?php } ?>

    </table>

</div>

<!-- ================= QR CODE ================= -->

<div class="qr-panel">

    <?php if(file_exists($qr)){ ?>

        <div class="qr-box">

            <img
                src="<?= $qr ?>"
                class="qr"
                alt="QR Code">

        </div>

    <?php }else{ ?>

        <div class="qr-box">

            <span style="font-size:6pt;color:red">

                QR BELUM ADA

            </span>

        </div>

    <?php } ?>

    <div class="scan">

        SCAN ABSENSI

    </div>

</div>

</div>
<!-- ================= FOOTER ================= -->

<div class="footer">

    <h4>SIMPAS</h4>

    <p>
        Sistem Informasi Manajemen Presensi Siswa
    </p>

    <p>
        <?= $alamat ?>
    </p>

</div>

</div>