<?php

session_start();

include '../config/koneksi.php';

$data = mysqli_query(
    $conn,
    "SELECT * FROM berkas
     WHERE status='diterima'
     OR status='revisi'
     ORDER BY id DESC"
);

?>

<!DOCTYPE html>
<html>

<head>

<title>History Berkas</title>

<link rel="stylesheet"
href="../assets/style.css">

<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">

</head>

<body>

<div class="wrapper">



<!-- SIDEBAR -->

<div class="sidebar">

<h2>BPKAD</h2>

<a href="dashboard.php">

<i class="fa-solid fa-house"></i>

Dashboard

</a>

<a href="history.php">

<i class="fa-solid fa-clock-rotate-left"></i>

History

</a>

<a href="../logout.php"
onclick="return konfirmasiLogout()">

<i class="fa-solid fa-right-from-bracket"></i>

Logout

</a>

</div>





<!-- CONTENT -->

<div class="content">

<div class="topbar">

<div class="header-flex">

<div>

<h1>History Verifikasi</h1>

<p>Riwayat Verifikasi Berkas</p>

</div>

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

</div>

<br>

<a href="#"
onclick="window.print()"
class="download-link">

🖨 Cetak Laporan


</a>

<a href="export.php"
class="download-link">

📥 Export Excel

</a>

<br><br>

</div>


<div class="header-flex">

<div>
<h1>Riwayat Verifikasi Berkas</h1>
</div>

</div>





<!-- TABLE -->

<div class="table-container">

<table>

<tr>

<th>No</th>
<th>Nama Berkas</th>
<th>Asal Kantor</th>
<th>File</th>
<th>Status</th>
<th>Tanggal Upload</th>
<th>Keterangan</th>
<th>QR Verifikasi</th>

</tr>

<?php

$no = 1;

while($d = mysqli_fetch_assoc($data)){

?>

<tr>

<td><?= $no++; ?></td>



<td>

<?= $d['nama_berkas']; ?>

</td>



<td>

<?= $d['asal_kantor']; ?>

</td>



<td>

<a href="../uploads/<?php echo $d['file']; ?>"
target="_blank">

Lihat File

</a>

</td>



<td class="<?= $d['status']; ?>">

<?= $d['status']; ?>

</td>



<td>

<?= date(
'd-m-Y H:i',
strtotime($d['tanggal_upload'])
); ?>

</td>



<td>

<?php

if($d['keterangan'] != ''){

    echo "
    <div class='keterangan-box'>
    ".$d['keterangan']."
    </div>
    ";

}else{

    echo "
    <div class='pending-box'>
    Tidak ada keterangan
    </div>
    ";
}

?>

<td>

<img
src="https://api.qrserver.com/v1/create-qr-code/?size=80x80&data=<?= $d['nomor_surat']; ?>">

</td>

</td>

</tr>

<?php } ?>

</table>

</div>

</div>

</div>

<script src="../assets/script.js"></script>

</body>
</html>