<?php
include '../config/koneksi.php';
?>

<!DOCTYPE html>
<html>
<head>
    <title>Status Pengajuan Surat</title>
    <link rel="stylesheet" href="../assets/css/status.css">
</head>

<body>

<div class="container">

    <div class="card">

        <!-- Tombol Kembali -->
        <a href="../profil.php" class="btn-kembali">
            ← Kembali ke Profil Desa
        </a>

        <h2>Status Pengajuan Surat</h2>

        <table class="table-status">

            <tr>
                <th>No</th>
                <th>Nama</th>
                <th>Jenis Surat</th>
                <th>Tanggal</th>
                <th>Status</th>
            </tr>

            <?php
            $no = 1;
            $query = mysqli_query($conn,"SELECT * FROM surat");

            while($d = mysqli_fetch_array($query))
            {
            ?>
            <tr>
                <td><?= $no++; ?></td>
                <td><?= $d['nama']; ?></td>
                <td><?= $d['jenis_surat']; ?></td>
                <td><?= $d['tanggal']; ?></td>
                
                <td>
                    <?php
                    if($d['status']=="Diproses"){
                        echo "<span class='status-diproses'>Diproses</span>";
                        }elseif($d['status']=="Selesai"){
                            echo "<span class='status-selesai'>Selesai</span>";
                            }else{
                                echo "<span class='status-ditolak'>Ditolak</span>";
                                }
                                ?>
                </td>
            <?php } ?>

        </table>

    </div>

</div>

</body>
</html>