Files
webgis_poverty/warga/status.php
T
2026-06-11 23:48:02 +07:00

224 lines
5.2 KiB
PHP

<?php
session_start();
if(!isset($_SESSION['role'])){
header("Location: ../index.php");
exit;
}
if($_SESSION['role'] != 'warga'){
header("Location: ../index.php");
exit;
}
include '../config/koneksi.php';
$id = $_SESSION['id'];
$data = mysqli_query($conn,
"SELECT * FROM laporan
WHERE pelapor_id='$id'
ORDER BY id DESC"
);
?>
<!DOCTYPE html>
<html>
<head>
<title>Status Laporan</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
body {
font-family: Arial;
background: #f4f4f4;
padding: 20px;
}
table {
width: 100%;
background: white;
border-collapse: collapse;
}
th,
td {
padding: 12px;
border: 1px solid #ddd;
}
th {
background: #3498db;
color: white;
}
</style>
</head>
<body class="bg-slate-100 min-h-screen">
<div class="max-w-7xl mx-auto p-6">
<a href="dashboard.php"
class="inline-flex items-center gap-2 bg-slate-800 hover:bg-slate-900 text-white px-5 py-3 rounded-xl shadow transition">
← Kembali ke Dashboard
</a>
<div class="bg-white rounded-3xl shadow-lg p-6 md:p-8 mt-6">
<div class="mb-6">
<h1 class="text-3xl font-bold text-slate-800">
Status Laporan Saya
</h1>
<p class="text-slate-500 mt-2">
Pantau perkembangan laporan yang telah Anda kirim.
</p>
</div>
<div class="overflow-x-auto">
<table class="min-w-full">
<thead>
<tr class="bg-blue-600 text-white">
<th class="px-4 py-3 text-left">No</th>
<th class="px-4 py-3 text-left">Nama Warga</th>
<th class="px-4 py-3 text-left">Foto</th>
<th class="px-4 py-3 text-left">Tanggal</th>
<th class="px-4 py-3 text-left">Status</th>
</tr>
</thead>
<tbody>
<?php
$no = 1;
if(mysqli_num_rows($data) == 0){
?>
<tr>
<td colspan="5" class="text-center py-8 text-slate-500">
Belum ada laporan
</td>
</tr>
<?php
} else {
while($row = mysqli_fetch_assoc($data)){
?>
<tr class="border-b hover:bg-slate-50">
<td class="px-4 py-4">
<?= $no++ ?>
</td>
<td class="px-4 py-4 font-medium">
<?= htmlspecialchars($row['nama_warga']) ?>
</td>
<td class="px-4 py-4">
<?php if($row['foto']!=''){ ?>
<img src="../assets/uploads/<?= htmlspecialchars($row['foto']) ?>"
class="w-20 h-20 object-cover rounded-xl shadow">
<?php } else { ?>
<span class="text-slate-400">
Tidak ada foto
</span>
<?php } ?>
</td>
<td class="px-4 py-4 text-slate-600">
<?= date('d-m-Y H:i', strtotime($row['created_at'])) ?>
</td>
<td class="px-4 py-4">
<?php
if($row['status']=='pending'){
echo "<span class='bg-amber-500 text-white px-3 py-1 rounded-full text-sm'>Pending</span>";
}
elseif($row['status']=='disetujui'){
echo "<span class='bg-green-600 text-white px-3 py-1 rounded-full text-sm'>Disetujui</span>";
}
elseif($row['status']=='ditolak'){
echo "<span class='bg-red-600 text-white px-3 py-1 rounded-full text-sm'>Ditolak</span>";
}
elseif($row['status']=='diproses'){
echo "<span class='bg-blue-600 text-white px-3 py-1 rounded-full text-sm'>Diproses</span>";
}
elseif($row['status']=='selesai'){
echo "<span class='bg-purple-600 text-white px-3 py-1 rounded-full text-sm'>Selesai</span>";
}
?>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>