Add WebGIS source code
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['role'])){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['role'] != 'admin'){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
include '../config/koneksi.php';
|
||||
|
||||
$id = intval($_GET['id']);
|
||||
|
||||
$cek = mysqli_query(
|
||||
$conn,
|
||||
"SELECT * FROM laporan
|
||||
WHERE id='$id'"
|
||||
);
|
||||
|
||||
if(mysqli_num_rows($cek)==0){
|
||||
die("Data laporan tidak ditemukan");
|
||||
}
|
||||
|
||||
mysqli_query($conn,
|
||||
"UPDATE laporan
|
||||
SET status='disetujui'
|
||||
WHERE id='$id'");
|
||||
|
||||
header("Location: validasi.php");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,344 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['role'])){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['role'] != 'admin'){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
include '../config/koneksi.php';
|
||||
|
||||
$id = intval($_GET['id']);
|
||||
|
||||
$laporan = mysqli_fetch_assoc(
|
||||
mysqli_query($conn,
|
||||
"SELECT * FROM laporan
|
||||
WHERE id='$id'")
|
||||
);
|
||||
|
||||
if(!$laporan){
|
||||
die("Data laporan tidak ditemukan");
|
||||
}
|
||||
|
||||
$rumah_ibadah = mysqli_query($conn,
|
||||
"SELECT * FROM rumah_ibadah");
|
||||
|
||||
$cs = mysqli_query($conn,
|
||||
"SELECT * FROM cs_rumah_ibadah");
|
||||
|
||||
$cek_bantuan = mysqli_query(
|
||||
$conn,
|
||||
"SELECT * FROM bantuan
|
||||
WHERE laporan_id='$id'"
|
||||
);
|
||||
|
||||
if(mysqli_num_rows($cek_bantuan)>0){
|
||||
|
||||
echo "
|
||||
<script>
|
||||
alert('Laporan sudah pernah diassign');
|
||||
window.location='validasi.php';
|
||||
</script>
|
||||
";
|
||||
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<title>Assign Bantuan</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" />
|
||||
|
||||
<?php include 'layout/style.php'; ?>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<?php include 'layout/navbar.php'; ?>
|
||||
|
||||
<?php include 'layout/sidebar.php'; ?>
|
||||
|
||||
<div class="content">
|
||||
|
||||
|
||||
<div class="mb-6">
|
||||
|
||||
<h1 class="text-3xl font-bold text-gray-800">
|
||||
Assign Bantuan
|
||||
</h1>
|
||||
|
||||
<p class="text-gray-500 mt-2">
|
||||
Tentukan rumah ibadah, CS penyalur, dan jenis bantuan untuk laporan yang telah disetujui.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="grid lg:grid-cols-3 gap-6">
|
||||
|
||||
<!-- Informasi Warga -->
|
||||
|
||||
<div class="lg:col-span-1">
|
||||
|
||||
<div class="bg-white rounded-2xl shadow-lg overflow-hidden">
|
||||
|
||||
<div class="p-5 border-b bg-blue-50">
|
||||
|
||||
<h2 class="font-semibold text-lg flex items-center gap-2">
|
||||
|
||||
<i class="fas fa-user text-blue-600"></i>
|
||||
|
||||
Data Warga
|
||||
|
||||
</h2>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="p-5">
|
||||
|
||||
<div class="mb-4">
|
||||
|
||||
<label class="text-gray-500 text-sm">
|
||||
Nama Warga
|
||||
</label>
|
||||
|
||||
<p class="font-semibold text-lg">
|
||||
<?= htmlspecialchars($laporan['nama_warga']) ?>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
|
||||
<label class="text-gray-500 text-sm">
|
||||
Alamat
|
||||
</label>
|
||||
|
||||
<p>
|
||||
<?= htmlspecialchars($laporan['alamat']) ?>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
|
||||
<label class="text-gray-500 text-sm">
|
||||
Kondisi
|
||||
</label>
|
||||
|
||||
<p>
|
||||
<?= htmlspecialchars($laporan['kondisi']) ?>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<?php if(!empty($laporan['foto'])){ ?>
|
||||
|
||||
<img src="../assets/uploads/<?= htmlspecialchars($laporan['foto']) ?>"
|
||||
class="w-full h-56 object-cover rounded-xl shadow">
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Form Assign -->
|
||||
|
||||
<div class="lg:col-span-2">
|
||||
|
||||
<div class="bg-white rounded-2xl shadow-lg overflow-hidden">
|
||||
|
||||
<div class="p-5 border-b bg-gray-50">
|
||||
|
||||
<h2 class="font-semibold text-lg flex items-center gap-2">
|
||||
|
||||
<i class="fas fa-hand-holding-heart text-green-600"></i>
|
||||
|
||||
Form Penugasan Bantuan
|
||||
|
||||
</h2>
|
||||
|
||||
</div>
|
||||
|
||||
<form action="proses_assign.php" method="POST" class="p-6 space-y-5">
|
||||
|
||||
<input type="hidden" name="laporan_id" value="<?= $laporan['id'] ?>">
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Nama Warga
|
||||
</label>
|
||||
|
||||
<input type="text" readonly value="<?= htmlspecialchars($laporan['nama_warga']) ?>"
|
||||
class="w-full border rounded-xl p-3 bg-gray-100">
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Rumah Ibadah
|
||||
</label>
|
||||
|
||||
<select name="rumah_ibadah_id" required
|
||||
class="w-full border rounded-xl p-3 focus:ring-2 focus:ring-blue-500 focus:outline-none">
|
||||
|
||||
<option value="">
|
||||
-- Pilih Rumah Ibadah --
|
||||
</option>
|
||||
|
||||
<?php while($r = mysqli_fetch_assoc($rumah_ibadah)){ ?>
|
||||
|
||||
<option value="<?= $r['id'] ?>">
|
||||
|
||||
<?= htmlspecialchars($r['nama']) ?>
|
||||
|
||||
</option>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
CS Penyalur
|
||||
</label>
|
||||
|
||||
<select name="cs_id" required
|
||||
class="w-full border rounded-xl p-3 focus:ring-2 focus:ring-blue-500 focus:outline-none">
|
||||
|
||||
<option value="">
|
||||
-- Pilih CS --
|
||||
</option>
|
||||
|
||||
<?php while($c = mysqli_fetch_assoc($cs)){ ?>
|
||||
|
||||
<option value="<?= $c['id'] ?>">
|
||||
|
||||
<?= htmlspecialchars($c['nama']) ?>
|
||||
|
||||
</option>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Jenis Bantuan
|
||||
</label>
|
||||
|
||||
<select name="jenis_bantuan" required
|
||||
class="w-full border rounded-xl p-3 focus:ring-2 focus:ring-blue-500 focus:outline-none">
|
||||
|
||||
<option value="">
|
||||
-- Pilih Jenis Bantuan --
|
||||
</option>
|
||||
|
||||
<option value="Sembako">
|
||||
🍚 Sembako
|
||||
</option>
|
||||
|
||||
<option value="Uang Tunai">
|
||||
💵 Uang Tunai
|
||||
</option>
|
||||
|
||||
<option value="Pendidikan">
|
||||
🎓 Pendidikan
|
||||
</option>
|
||||
|
||||
<option value="Kesehatan">
|
||||
🏥 Kesehatan
|
||||
</option>
|
||||
|
||||
<option value="Peralatan Sekolah">
|
||||
🎒 Peralatan Sekolah
|
||||
</option>
|
||||
|
||||
<option value="Perbaikan Rumah">
|
||||
🏠 Perbaikan Rumah
|
||||
</option>
|
||||
|
||||
<option value="Pakaian Layak">
|
||||
👕 Pakaian Layak
|
||||
</option>
|
||||
|
||||
<option value="Makanan Bergizi">
|
||||
🍱 Makanan Bergizi
|
||||
</option>
|
||||
|
||||
<option value="Modal Usaha">
|
||||
💼 Modal Usaha
|
||||
</option>
|
||||
|
||||
<option value="Lainnya">
|
||||
📦 Lainnya
|
||||
</option>
|
||||
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="flex flex-wrap gap-3 pt-3">
|
||||
|
||||
<button type="submit"
|
||||
class="px-6 py-3 bg-green-600 hover:bg-green-700 text-white rounded-xl shadow transition">
|
||||
|
||||
<i class="fas fa-check-circle mr-2"></i>
|
||||
|
||||
Assign Bantuan
|
||||
|
||||
</button>
|
||||
|
||||
<a href="validasi.php"
|
||||
class="px-6 py-3 bg-gray-500 hover:bg-gray-600 text-white rounded-xl shadow transition">
|
||||
|
||||
<i class="fas fa-arrow-left mr-2"></i>
|
||||
|
||||
Kembali
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,391 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['role'])){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['role'] != 'admin'){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
include '../config/koneksi.php';
|
||||
|
||||
/* TOTAL LAPORAN */
|
||||
|
||||
$total_laporan = mysqli_num_rows(
|
||||
mysqli_query($conn,
|
||||
"SELECT * FROM laporan")
|
||||
);
|
||||
|
||||
/* PENDING */
|
||||
|
||||
$pending = mysqli_num_rows(
|
||||
mysqli_query($conn,
|
||||
"SELECT * FROM laporan
|
||||
WHERE status='pending'")
|
||||
);
|
||||
|
||||
/* DISETUJUI */
|
||||
|
||||
$disetujui = mysqli_num_rows(
|
||||
mysqli_query($conn,
|
||||
"SELECT * FROM laporan
|
||||
WHERE status='disetujui'")
|
||||
);
|
||||
|
||||
/* DITOLAK */
|
||||
|
||||
$ditolak = mysqli_num_rows(
|
||||
mysqli_query($conn,
|
||||
"SELECT * FROM laporan
|
||||
WHERE status='ditolak'")
|
||||
);
|
||||
|
||||
$total_bantuan = mysqli_num_rows(
|
||||
mysqli_query($conn,
|
||||
"SELECT * FROM bantuan")
|
||||
);
|
||||
|
||||
$diproses = mysqli_num_rows(
|
||||
mysqli_query($conn,
|
||||
"SELECT * FROM laporan
|
||||
WHERE status='diproses'")
|
||||
);
|
||||
|
||||
$selesai = mysqli_num_rows(
|
||||
mysqli_query($conn,
|
||||
"SELECT * FROM laporan
|
||||
WHERE status='selesai'")
|
||||
);
|
||||
|
||||
$persentase = 0;
|
||||
|
||||
if($total_laporan > 0){
|
||||
|
||||
$persentase = round(
|
||||
($selesai / $total_laporan) * 100
|
||||
);
|
||||
}
|
||||
|
||||
$cs_total = mysqli_num_rows(
|
||||
mysqli_query(
|
||||
$conn,
|
||||
"SELECT * FROM cs_rumah_ibadah"
|
||||
)
|
||||
);
|
||||
|
||||
$rumah_ibadah_total = mysqli_num_rows(
|
||||
mysqli_query(
|
||||
$conn,
|
||||
"SELECT * FROM rumah_ibadah"
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<title>Dashboard Admin</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" />
|
||||
|
||||
<?php include 'layout/style.php'; ?>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<?php include 'layout/navbar.php'; ?>
|
||||
|
||||
<?php include 'layout/sidebar.php'; ?>
|
||||
|
||||
<div class="content">
|
||||
|
||||
<div class="hero">
|
||||
|
||||
<h1 style="
|
||||
font-size:32px;
|
||||
margin-bottom:10px;
|
||||
">
|
||||
|
||||
Dashboard Administrator
|
||||
|
||||
</h1>
|
||||
|
||||
<p>
|
||||
|
||||
Selamat datang,
|
||||
<b><?= htmlspecialchars($_SESSION['nama']) ?></b>
|
||||
|
||||
</p>
|
||||
|
||||
<p style="
|
||||
margin-top:10px;
|
||||
opacity:.9;
|
||||
">
|
||||
|
||||
Monitoring laporan kemiskinan,
|
||||
validasi bantuan sosial,
|
||||
dan distribusi bantuan.
|
||||
|
||||
</p>
|
||||
|
||||
<p style="
|
||||
margin-top:15px;
|
||||
font-size:14px;
|
||||
">
|
||||
|
||||
<?= $total_laporan ?> laporan •
|
||||
<?= $total_bantuan ?> bantuan •
|
||||
<?= $persentase ?>% selesai
|
||||
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="cards">
|
||||
|
||||
<div class="card">
|
||||
|
||||
<i class="fa-solid fa-file"></i>
|
||||
|
||||
<h3>Total Laporan</h3>
|
||||
|
||||
<h1><?= $total_laporan ?></h1>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
|
||||
<i class="fa-solid fa-clock"></i>
|
||||
|
||||
<h3>Pending</h3>
|
||||
|
||||
<h1><?= $pending ?></h1>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
|
||||
<i class="fa-solid fa-thumbs-up"></i>
|
||||
|
||||
<h3>Disetujui</h3>
|
||||
|
||||
<h1><?= $disetujui ?></h1>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card">
|
||||
|
||||
<i class="fa-solid fa-hand-holding-heart"></i>
|
||||
|
||||
<h3>Total Bantuan</h3>
|
||||
|
||||
<h1><?= $total_bantuan ?></h1>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
|
||||
<i class="fa-solid fa-users"></i>
|
||||
|
||||
<h3>Total CS</h3>
|
||||
|
||||
<h1><?= $cs_total ?></h1>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
|
||||
<i class="fa-solid fa-building"></i>
|
||||
|
||||
<h3>Rumah Ibadah</h3>
|
||||
|
||||
<h1><?= $rumah_ibadah_total ?></h1>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
|
||||
<i class="fa-solid fa-spinner"></i>
|
||||
|
||||
<h3> Diproses</h3>
|
||||
|
||||
<h1><?= $diproses ?></h1>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
|
||||
<i class="fa-solid fa-hand-holding-heart"></i>
|
||||
|
||||
<h3>Selesai</h3>
|
||||
|
||||
<h1><?= $selesai ?></h1>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
|
||||
<i class="fa-solid fa-ban"></i>
|
||||
|
||||
<h3>Ditolak</h3>
|
||||
|
||||
<h1><?= $ditolak ?></h1>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="box" style="margin-top:25px;">
|
||||
|
||||
<h3>
|
||||
|
||||
Progress Penyelesaian Bantuan
|
||||
|
||||
</h3>
|
||||
|
||||
<br>
|
||||
|
||||
<div style="
|
||||
width:100%;
|
||||
height:20px;
|
||||
background:#e2e8f0;
|
||||
border-radius:20px;
|
||||
overflow:hidden;
|
||||
">
|
||||
|
||||
<div style="
|
||||
width:<?= $persentase ?>%;
|
||||
height:100%;
|
||||
background:#16a34a;
|
||||
">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<p style="
|
||||
margin-top:10px;
|
||||
color:#64748b;
|
||||
">
|
||||
|
||||
<?= $persentase ?>%
|
||||
laporan telah selesai ditangani
|
||||
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="box" style="margin-top:25px;">
|
||||
|
||||
<h3>Statistik Laporan</h3>
|
||||
|
||||
<br>
|
||||
|
||||
<div style="max-width:500px;margin:auto;">
|
||||
<canvas id="myChart"></canvas>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="box" style="margin-top:25px;">
|
||||
|
||||
<h3>Ringkasan Sistem</h3>
|
||||
|
||||
<br>
|
||||
|
||||
<p>
|
||||
Total laporan masuk:
|
||||
<b><?= $total_laporan ?></b>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Bantuan yang telah dibuat:
|
||||
<b><?= $total_bantuan ?></b>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
CS aktif:
|
||||
<b><?= $cs_total ?></b>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Rumah ibadah terdaftar:
|
||||
<b><?= $rumah_ibadah_total ?></b>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
|
||||
<script>
|
||||
const ctx = document.getElementById('myChart');
|
||||
|
||||
new Chart(ctx, {
|
||||
|
||||
type: 'doughnut',
|
||||
|
||||
data: {
|
||||
|
||||
labels: [
|
||||
'Pending',
|
||||
'Disetujui',
|
||||
'Ditolak',
|
||||
'Diproses',
|
||||
'Selesai'
|
||||
],
|
||||
|
||||
datasets: [{
|
||||
|
||||
label: 'Jumlah Laporan',
|
||||
|
||||
data: [
|
||||
<?= $pending ?>,
|
||||
<?= $disetujui ?>,
|
||||
<?= $ditolak ?>,
|
||||
<?= $diproses ?>,
|
||||
<?= $selesai ?>
|
||||
],
|
||||
|
||||
backgroundColor: [
|
||||
'#f59e0b',
|
||||
'#16a34a',
|
||||
'#dc2626',
|
||||
'#2563eb',
|
||||
'#7c3aed'
|
||||
]
|
||||
|
||||
}]
|
||||
},
|
||||
|
||||
options: {
|
||||
|
||||
responsive: true,
|
||||
|
||||
plugins: {
|
||||
legend: {
|
||||
position: 'bottom'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,300 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['role'])){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['role'] != 'admin'){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
include '../config/koneksi.php';
|
||||
|
||||
$data = mysqli_query($conn,
|
||||
|
||||
"SELECT bantuan.*,
|
||||
|
||||
laporan.nama_warga,
|
||||
|
||||
rumah_ibadah.nama AS rumah_ibadah,
|
||||
|
||||
cs_rumah_ibadah.nama AS cs_nama
|
||||
|
||||
FROM bantuan
|
||||
|
||||
JOIN laporan
|
||||
ON bantuan.laporan_id = laporan.id
|
||||
|
||||
JOIN rumah_ibadah
|
||||
ON bantuan.rumah_ibadah_id = rumah_ibadah.id
|
||||
|
||||
JOIN cs_rumah_ibadah
|
||||
ON bantuan.cs_id = cs_rumah_ibadah.id
|
||||
|
||||
ORDER BY bantuan.id DESC"
|
||||
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<title>Data Bantuan</title>
|
||||
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" />
|
||||
|
||||
<?php include 'layout/style.php'; ?>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<?php include 'layout/navbar.php'; ?>
|
||||
|
||||
<?php include 'layout/sidebar.php'; ?>
|
||||
|
||||
<div class="content">
|
||||
|
||||
|
||||
<div class="mb-6">
|
||||
|
||||
<h1 class="text-3xl font-bold text-gray-800">
|
||||
Data Bantuan
|
||||
</h1>
|
||||
|
||||
<p class="text-gray-500 mt-2">
|
||||
Monitoring bantuan sosial yang sedang diproses dan telah selesai disalurkan.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
$total = mysqli_num_rows($data);
|
||||
|
||||
mysqli_data_seek($data,0);
|
||||
|
||||
$proses = 0;
|
||||
$selesai = 0;
|
||||
|
||||
while($r = mysqli_fetch_assoc($data)){
|
||||
|
||||
if($r['status']=='proses'){
|
||||
$proses++;
|
||||
}
|
||||
|
||||
if($r['status']=='selesai'){
|
||||
$selesai++;
|
||||
}
|
||||
}
|
||||
|
||||
mysqli_data_seek($data,0);
|
||||
|
||||
?>
|
||||
|
||||
<div class="grid md:grid-cols-3 gap-5 mb-6">
|
||||
|
||||
<div class="bg-white rounded-2xl shadow p-5">
|
||||
|
||||
<div class="flex items-center justify-between">
|
||||
|
||||
<div>
|
||||
<p class="text-gray-500 text-sm">
|
||||
Total Bantuan
|
||||
</p>
|
||||
|
||||
<h2 class="text-3xl font-bold text-blue-600">
|
||||
<?= $total ?>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<i class="fas fa-hand-holding-heart text-4xl text-blue-500"></i>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-2xl shadow p-5">
|
||||
|
||||
<div class="flex items-center justify-between">
|
||||
|
||||
<div>
|
||||
<p class="text-gray-500 text-sm">
|
||||
Diproses
|
||||
</p>
|
||||
|
||||
<h2 class="text-3xl font-bold text-orange-500">
|
||||
<?= $proses ?>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<i class="fas fa-spinner text-4xl text-orange-500"></i>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-2xl shadow p-5">
|
||||
|
||||
<div class="flex items-center justify-between">
|
||||
|
||||
<div>
|
||||
<p class="text-gray-500 text-sm">
|
||||
Selesai
|
||||
</p>
|
||||
|
||||
<h2 class="text-3xl font-bold text-green-600">
|
||||
<?= $selesai ?>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<i class="fas fa-check-circle text-4xl text-green-600"></i>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-2xl shadow overflow-hidden">
|
||||
|
||||
<div class="p-5 border-b">
|
||||
|
||||
<h2 class="font-semibold text-lg">
|
||||
Daftar Bantuan
|
||||
</h2>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="overflow-x-auto">
|
||||
|
||||
<table class="min-w-full">
|
||||
|
||||
<thead class="bg-gray-100">
|
||||
|
||||
<tr>
|
||||
|
||||
<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">Rumah Ibadah</th>
|
||||
<th class="px-4 py-3 text-left">CS Penyalur</th>
|
||||
<th class="px-4 py-3 text-left">Jenis Bantuan</th>
|
||||
<th class="px-4 py-3 text-center">Status</th>
|
||||
<th class="px-4 py-3 text-center">Bukti</th>
|
||||
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
|
||||
$no = 1;
|
||||
|
||||
if(mysqli_num_rows($data) > 0){
|
||||
|
||||
while($row = mysqli_fetch_assoc($data)){
|
||||
|
||||
?>
|
||||
|
||||
<tr class="border-b hover:bg-gray-50 transition">
|
||||
|
||||
<td class="px-4 py-3">
|
||||
<?= $no++ ?>
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-3 font-medium">
|
||||
<?= htmlspecialchars($row['nama_warga']) ?>
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-3">
|
||||
<?= htmlspecialchars($row['rumah_ibadah']) ?>
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-3">
|
||||
<?= htmlspecialchars($row['cs_nama']) ?>
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-3">
|
||||
<?= htmlspecialchars($row['jenis_bantuan']) ?>
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-3 text-center">
|
||||
|
||||
<?php if($row['status']=='proses'){ ?>
|
||||
|
||||
<span
|
||||
class="px-3 py-1 rounded-full text-xs font-semibold bg-orange-100 text-orange-700">
|
||||
Diproses
|
||||
</span>
|
||||
|
||||
<?php } elseif($row['status']=='selesai'){ ?>
|
||||
|
||||
<span class="px-3 py-1 rounded-full text-xs font-semibold bg-green-100 text-green-700">
|
||||
Selesai
|
||||
</span>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-3 text-center">
|
||||
|
||||
<?php if(!empty($row['bukti_foto'])){ ?>
|
||||
|
||||
<img src="../assets/uploads/<?= htmlspecialchars($row['bukti_foto']) ?>"
|
||||
class="w-24 h-24 object-cover rounded-xl shadow mx-auto hover:scale-105 transition cursor-pointer">
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<span class="text-gray-400 italic">
|
||||
Belum Ada
|
||||
</span>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php } } else { ?>
|
||||
|
||||
<tr>
|
||||
|
||||
<td colspan="7" class="py-10 text-center text-gray-500">
|
||||
|
||||
<i class="fas fa-box-open text-4xl mb-3 block"></i>
|
||||
|
||||
Belum ada data bantuan
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['role'])){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['role'] != 'admin'){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
include '../config/koneksi.php';
|
||||
|
||||
$id = intval($_GET['id']);
|
||||
|
||||
mysqli_query($conn,
|
||||
"DELETE FROM laporan
|
||||
WHERE id='$id'");
|
||||
|
||||
header("Location: validasi.php");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['role'])){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['role'] != 'admin'){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
include '../config/koneksi.php';
|
||||
|
||||
$id = intval($_GET['id']);
|
||||
|
||||
mysqli_query($conn,
|
||||
"DELETE FROM rumah_ibadah
|
||||
WHERE id='$id'");
|
||||
|
||||
header("Location: rumah_ibadah.php");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,29 @@
|
||||
<div class="navbar">
|
||||
|
||||
<div class="logo-area">
|
||||
|
||||
<i class="fa-solid fa-map-location-dot"></i>
|
||||
|
||||
<div>
|
||||
<h2>WEBGIS KEMISKINAN</h2>
|
||||
<small>Sistem Pengentasan Kemiskinan</small>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="admin-profile">
|
||||
|
||||
<div class="avatar">
|
||||
<i class="fa-solid fa-user"></i>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<strong><?= htmlspecialchars($_SESSION['nama']); ?></strong>
|
||||
<br>
|
||||
<small>Administrator</small>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,45 @@
|
||||
<div class="sidebar">
|
||||
|
||||
|
||||
<div class="sidebar-title">
|
||||
MENU ADMIN
|
||||
</div>
|
||||
|
||||
<a class="<?php if(basename($_SERVER['PHP_SELF'])=='dashboard.php') echo 'active'; ?>" href="dashboard.php">
|
||||
<i class="fa-solid fa-house"></i>
|
||||
Dashboard
|
||||
</a>
|
||||
|
||||
<a class="<?php if(basename($_SERVER['PHP_SELF'])=='peta.php') echo 'active'; ?>" href="peta.php">
|
||||
<i class="fa-solid fa-map-location-dot"></i>
|
||||
Peta GIS
|
||||
</a>
|
||||
|
||||
<a class="<?php if(basename($_SERVER['PHP_SELF'])=='validasi.php') echo 'active'; ?>" href="validasi.php">
|
||||
<i class="fa-solid fa-circle-check"></i>
|
||||
Validasi Laporan
|
||||
</a>
|
||||
|
||||
<a class="<?php if(basename($_SERVER['PHP_SELF'])=='data_bantuan.php') echo 'active'; ?>" href="data_bantuan.php">
|
||||
<i class="fa-solid fa-hand-holding-heart"></i>
|
||||
Data Bantuan
|
||||
</a>
|
||||
|
||||
<a class="<?php if(basename($_SERVER['PHP_SELF'])=='rumah_ibadah.php') echo 'active'; ?>" href="rumah_ibadah.php">
|
||||
<i class="fa-solid fa-building"></i>
|
||||
Rumah Ibadah
|
||||
</a>
|
||||
|
||||
<div class="sidebar-footer">
|
||||
|
||||
<a href="../logout.php" onclick="return confirm('Logout sekarang?')">
|
||||
|
||||
<i class="fa-solid fa-right-from-bracket"></i>
|
||||
Logout
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,379 @@
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #f8fafc;
|
||||
font-family: 'Segoe UI', sans-serif;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
/* NAVBAR */
|
||||
|
||||
.navbar {
|
||||
|
||||
position: fixed;
|
||||
|
||||
top: 0;
|
||||
left: 260px;
|
||||
right: 0;
|
||||
|
||||
height: 70px;
|
||||
|
||||
background: white;
|
||||
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
padding: 0 30px;
|
||||
|
||||
box-shadow:
|
||||
0 2px 15px rgba(0, 0, 0, .08);
|
||||
|
||||
z-index: 1000;
|
||||
|
||||
}
|
||||
|
||||
.logo-area {
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
|
||||
}
|
||||
|
||||
.logo-area i {
|
||||
|
||||
font-size: 28px;
|
||||
color: #2563eb;
|
||||
|
||||
}
|
||||
|
||||
.logo-area h2 {
|
||||
|
||||
font-size: 18px;
|
||||
margin: 0;
|
||||
|
||||
}
|
||||
|
||||
.logo-area small {
|
||||
|
||||
color: #64748b;
|
||||
|
||||
}
|
||||
|
||||
.admin-profile {
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
|
||||
}
|
||||
|
||||
.avatar {
|
||||
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
|
||||
border-radius: 50%;
|
||||
|
||||
background: #2563eb;
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
color: white;
|
||||
|
||||
}
|
||||
|
||||
/* SIDEBAR */
|
||||
|
||||
.sidebar {
|
||||
|
||||
position: fixed;
|
||||
|
||||
left: 0;
|
||||
top: 0;
|
||||
|
||||
width: 260px;
|
||||
height: 100vh;
|
||||
|
||||
background: #1e293b;
|
||||
|
||||
padding-top: 20px;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
}
|
||||
|
||||
.sidebar-title {
|
||||
|
||||
color: #94a3b8;
|
||||
|
||||
font-size: 12px;
|
||||
|
||||
padding: 15px 25px;
|
||||
|
||||
}
|
||||
|
||||
.sidebar a {
|
||||
|
||||
color: #e2e8f0;
|
||||
|
||||
text-decoration: none;
|
||||
|
||||
padding: 15px 25px;
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
|
||||
transition: .3s;
|
||||
|
||||
}
|
||||
|
||||
.sidebar a:hover {
|
||||
|
||||
background: #334155;
|
||||
|
||||
}
|
||||
|
||||
.sidebar a.active {
|
||||
|
||||
background: #2563eb;
|
||||
|
||||
border-left: 4px solid white;
|
||||
|
||||
}
|
||||
|
||||
.sidebar-footer {
|
||||
|
||||
margin-top: auto;
|
||||
|
||||
border-top: 1px solid #334155;
|
||||
|
||||
padding-top: 10px;
|
||||
|
||||
}
|
||||
|
||||
/* CONTENT */
|
||||
|
||||
.content {
|
||||
|
||||
margin-left: 260px;
|
||||
|
||||
margin-top: 70px;
|
||||
|
||||
padding: 30px;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* CARD */
|
||||
|
||||
.card {
|
||||
background: white;
|
||||
border-radius: 16px;
|
||||
padding: 25px;
|
||||
box-shadow:
|
||||
0 4px 20px rgba(0, 0, 0, .08);
|
||||
transition: .3s;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
transform: translateY(-5px);
|
||||
}
|
||||
|
||||
/* TABLE */
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
background: white;
|
||||
border-radius: 15px;
|
||||
overflow: hidden;
|
||||
box-shadow:
|
||||
0 4px 20px rgba(0, 0, 0, .08);
|
||||
}
|
||||
|
||||
th {
|
||||
background: #2563eb;
|
||||
color: white;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: 14px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
/* BUTTON */
|
||||
|
||||
.btn {
|
||||
padding: 10px 16px;
|
||||
border-radius: 10px;
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.approve {
|
||||
background: #16a34a;
|
||||
}
|
||||
|
||||
.reject {
|
||||
background: #dc2626;
|
||||
}
|
||||
|
||||
.delete {
|
||||
background: #64748b;
|
||||
}
|
||||
|
||||
.warning {
|
||||
background: #f59e0b;
|
||||
}
|
||||
|
||||
/* INPUT */
|
||||
|
||||
input,
|
||||
select,
|
||||
textarea {
|
||||
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
|
||||
border: 1px solid #ddd;
|
||||
|
||||
border-radius: 10px;
|
||||
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
/* BOX */
|
||||
|
||||
.box {
|
||||
background: white;
|
||||
padding: 25px;
|
||||
border-radius: 20px;
|
||||
box-shadow:
|
||||
0 4px 20px rgba(0, 0, 0, .08);
|
||||
}
|
||||
|
||||
.cards {
|
||||
display: grid;
|
||||
|
||||
grid-template-columns:
|
||||
repeat(auto-fit, minmax(220px, 1fr));
|
||||
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.card i {
|
||||
|
||||
font-size: 40px;
|
||||
|
||||
color: #2563eb;
|
||||
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.card h3 {
|
||||
|
||||
color: #64748b;
|
||||
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.card h1 {
|
||||
|
||||
font-size: 35px;
|
||||
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.badge {
|
||||
padding: 6px 12px;
|
||||
border-radius: 30px;
|
||||
color: white;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.pending {
|
||||
background: #f59e0b;
|
||||
}
|
||||
|
||||
.approved {
|
||||
background: #16a34a;
|
||||
}
|
||||
|
||||
.rejected {
|
||||
background: #dc2626;
|
||||
}
|
||||
|
||||
.process {
|
||||
background: #2563eb;
|
||||
}
|
||||
|
||||
.done {
|
||||
background: #7c3aed;
|
||||
}
|
||||
|
||||
#legend {
|
||||
|
||||
position: absolute;
|
||||
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
|
||||
z-index: 1000;
|
||||
|
||||
background: white;
|
||||
|
||||
padding: 15px;
|
||||
|
||||
border-radius: 10px;
|
||||
|
||||
box-shadow:
|
||||
0 2px 10px rgba(0, 0, 0, .2);
|
||||
}
|
||||
|
||||
.photo {
|
||||
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
|
||||
object-fit: cover;
|
||||
|
||||
border-radius: 12px;
|
||||
|
||||
border: 3px solid white;
|
||||
|
||||
box-shadow:
|
||||
0 2px 10px rgba(0, 0, 0, .2);
|
||||
}
|
||||
|
||||
.hero {
|
||||
|
||||
background:
|
||||
linear-gradient(135deg,
|
||||
#2563eb,
|
||||
#06b6d4);
|
||||
|
||||
color: white;
|
||||
|
||||
padding: 30px;
|
||||
|
||||
border-radius: 20px;
|
||||
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
</style>
|
||||
+380
@@ -0,0 +1,380 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['role'])){
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['role'] != 'admin'){
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
include '../config/koneksi.php';
|
||||
|
||||
$status = isset($_GET['status'])
|
||||
? mysqli_real_escape_string($conn,$_GET['status'])
|
||||
: '';
|
||||
|
||||
$query = "SELECT * FROM laporan";
|
||||
|
||||
if($status != ''){
|
||||
$query .= " WHERE status='$status'";
|
||||
}
|
||||
|
||||
$query .= " ORDER BY id DESC";
|
||||
|
||||
$data = mysqli_query($conn,$query);
|
||||
|
||||
if(!$data){
|
||||
die("Query Error: " . mysqli_error($conn));
|
||||
}
|
||||
|
||||
$total_data = mysqli_num_rows($data);
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
|
||||
<title>Peta Kemiskinan</title>
|
||||
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
|
||||
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster/dist/MarkerCluster.css" />
|
||||
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster/dist/MarkerCluster.Default.css" />
|
||||
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" />
|
||||
|
||||
<?php include 'layout/style.php'; ?>
|
||||
|
||||
<style>
|
||||
#map {
|
||||
height: 80vh;
|
||||
width: 100%;
|
||||
border-radius: 20px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, .1);
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<?php include 'layout/navbar.php'; ?>
|
||||
|
||||
<?php include 'layout/sidebar.php'; ?>
|
||||
|
||||
<div class="content">
|
||||
|
||||
|
||||
<div class="hero">
|
||||
|
||||
<h1>Peta Kemiskinan</h1>
|
||||
|
||||
<p style="margin-top:10px;">
|
||||
Visualisasi lokasi laporan kemiskinan berdasarkan status laporan.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="box">
|
||||
|
||||
<div style="
|
||||
display:flex;
|
||||
justify-content:space-between;
|
||||
align-items:center;
|
||||
flex-wrap:wrap;
|
||||
gap:15px;
|
||||
">
|
||||
|
||||
<div>
|
||||
|
||||
<h3>Total Data Ditampilkan</h3>
|
||||
|
||||
<h1 style="
|
||||
color:#2563eb;
|
||||
margin-top:5px;
|
||||
">
|
||||
<?= $total_data ?>
|
||||
</h1>
|
||||
|
||||
</div>
|
||||
|
||||
<form method="GET">
|
||||
|
||||
<select name="status" style="
|
||||
width:auto;
|
||||
display:inline-block;
|
||||
">
|
||||
|
||||
<option value="">
|
||||
Semua Status
|
||||
</option>
|
||||
|
||||
<option value="pending" <?= $status=='pending' ? 'selected' : '' ?>>
|
||||
Pending
|
||||
</option>
|
||||
|
||||
<option value="disetujui" <?= $status=='disetujui' ? 'selected' : '' ?>>
|
||||
Disetujui
|
||||
</option>
|
||||
|
||||
<option value="ditolak" <?= $status=='ditolak' ? 'selected' : '' ?>>
|
||||
Ditolak
|
||||
</option>
|
||||
|
||||
<option value="diproses" <?= $status=='diproses' ? 'selected' : '' ?>>
|
||||
Diproses
|
||||
</option>
|
||||
|
||||
<option value="selesai" <?= $status=='selesai' ? 'selected' : '' ?>>
|
||||
Selesai
|
||||
</option>
|
||||
|
||||
</select>
|
||||
|
||||
<button type="submit" class="btn approve">
|
||||
|
||||
Filter
|
||||
|
||||
</button>
|
||||
|
||||
<a href="peta.php" class="btn delete">
|
||||
|
||||
Reset
|
||||
|
||||
</a>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div id="legend">
|
||||
|
||||
<b>Status Marker</b>
|
||||
|
||||
<hr style="margin:10px 0;">
|
||||
|
||||
🟡 Pending <br>
|
||||
🟢 Disetujui <br>
|
||||
🔴 Ditolak <br>
|
||||
🔵 Diproses <br>
|
||||
🟣 Selesai
|
||||
|
||||
</div>
|
||||
|
||||
<div id="map"></div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
|
||||
|
||||
<script src="https://unpkg.com/leaflet.markercluster/dist/leaflet.markercluster.js"></script>
|
||||
|
||||
<script>
|
||||
var map = L.map('map').setView(
|
||||
[-0.0263, 109.3425],
|
||||
11
|
||||
);
|
||||
|
||||
L.tileLayer(
|
||||
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© OpenStreetMap'
|
||||
}
|
||||
).addTo(map);
|
||||
|
||||
var markers = L.markerClusterGroup();
|
||||
|
||||
<?php
|
||||
|
||||
mysqli_data_seek($data,0);
|
||||
|
||||
while($row = mysqli_fetch_assoc($data)){
|
||||
|
||||
if(
|
||||
empty($row['latitude']) ||
|
||||
empty($row['longitude'])
|
||||
){
|
||||
continue;
|
||||
}
|
||||
|
||||
$warna = "orange";
|
||||
|
||||
if($row['status']=="disetujui"){
|
||||
$warna = "green";
|
||||
}
|
||||
elseif($row['status']=="ditolak"){
|
||||
$warna = "red";
|
||||
}
|
||||
elseif($row['status']=="diproses"){
|
||||
$warna = "blue";
|
||||
}
|
||||
elseif($row['status']=="selesai"){
|
||||
$warna = "purple";
|
||||
}
|
||||
|
||||
$nama =
|
||||
addslashes(
|
||||
htmlspecialchars(
|
||||
$row['nama_warga']
|
||||
));
|
||||
|
||||
$alamat =
|
||||
addslashes(
|
||||
htmlspecialchars(
|
||||
$row['alamat']
|
||||
));
|
||||
|
||||
$kondisi =
|
||||
addslashes(
|
||||
htmlspecialchars(
|
||||
$row['kondisi']
|
||||
));
|
||||
|
||||
$foto =
|
||||
addslashes(
|
||||
htmlspecialchars(
|
||||
$row['foto']
|
||||
));
|
||||
|
||||
if(empty($row['foto'])){
|
||||
|
||||
$foto = 'no-image.png';
|
||||
}
|
||||
|
||||
$statusBadge = '';
|
||||
|
||||
if($row['status']=='pending'){
|
||||
$statusBadge = '🟡 Pending';
|
||||
}
|
||||
elseif($row['status']=='disetujui'){
|
||||
$statusBadge = '🟢 Disetujui';
|
||||
}
|
||||
elseif($row['status']=='ditolak'){
|
||||
$statusBadge = '🔴 Ditolak';
|
||||
}
|
||||
elseif($row['status']=='diproses'){
|
||||
$statusBadge = '🔵 Diproses';
|
||||
}
|
||||
elseif($row['status']=='selesai'){
|
||||
$statusBadge = '🟣 Selesai';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
L.circleMarker(
|
||||
[
|
||||
<?= $row['latitude'] ?>,
|
||||
<?= $row['longitude'] ?>
|
||||
], {
|
||||
radius: 12,
|
||||
weight: 2,
|
||||
color: '<?= $warna ?>',
|
||||
fillColor: '<?= $warna ?>',
|
||||
fillOpacity: 0.8
|
||||
}
|
||||
)
|
||||
|
||||
.bindPopup(`
|
||||
|
||||
<div style="width:250px;">
|
||||
|
||||
<img
|
||||
src="../assets/uploads/<?= $foto ?>"
|
||||
onerror="this.src='../assets/uploads/no-image.png'"
|
||||
style="
|
||||
width:100%;
|
||||
height:150px;
|
||||
object-fit:cover;
|
||||
border-radius:10px;
|
||||
margin-bottom:10px;
|
||||
">
|
||||
|
||||
<b style="
|
||||
font-size:16px;
|
||||
">
|
||||
<?= $nama ?>
|
||||
</b>
|
||||
|
||||
<hr style="margin:8px 0;">
|
||||
|
||||
<b>Alamat</b>
|
||||
<br>
|
||||
<?= $alamat ?>
|
||||
|
||||
<br><br>
|
||||
|
||||
<b>Kondisi</b>
|
||||
<br>
|
||||
<?= $kondisi ?>
|
||||
|
||||
<br><br>
|
||||
|
||||
<b>Status</b>
|
||||
<br>
|
||||
<?= $statusBadge ?>
|
||||
|
||||
<br><br>
|
||||
|
||||
<b>Tanggal</b>
|
||||
<br>
|
||||
<?= !empty($row['created_at'])
|
||||
? date('d-m-Y H:i', strtotime($row['created_at']))
|
||||
: '-' ?>
|
||||
|
||||
<br><br>
|
||||
|
||||
<a
|
||||
href="https://www.google.com/maps?q=<?= $row['latitude'] ?>,<?= $row['longitude'] ?>"
|
||||
target="_blank"
|
||||
style="
|
||||
display:inline-block;
|
||||
background:#2563eb;
|
||||
color:white;
|
||||
padding:8px 12px;
|
||||
border-radius:8px;
|
||||
text-decoration:none;
|
||||
">
|
||||
|
||||
📍 Buka Google Maps
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
`)
|
||||
.addTo(markers);
|
||||
|
||||
<?php } ?>
|
||||
|
||||
map.addLayer(markers);
|
||||
|
||||
if (markers.getLayers().length > 0) {
|
||||
|
||||
map.fitBounds(
|
||||
markers.getBounds()
|
||||
);
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['role'])){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['role'] != 'admin'){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
include '../config/koneksi.php';
|
||||
|
||||
$laporan_id = intval($_POST['laporan_id']);
|
||||
$rumah_ibadah_id = intval($_POST['rumah_ibadah_id']);
|
||||
$cs_id = intval($_POST['cs_id']);
|
||||
|
||||
$jenis_bantuan =
|
||||
mysqli_real_escape_string(
|
||||
$conn,
|
||||
$_POST['jenis_bantuan']
|
||||
);
|
||||
|
||||
$cek = mysqli_query(
|
||||
$conn,
|
||||
"SELECT * FROM bantuan
|
||||
WHERE laporan_id='$laporan_id'"
|
||||
);
|
||||
|
||||
if(mysqli_num_rows($cek) > 0){
|
||||
|
||||
echo "
|
||||
<script>
|
||||
alert('Bantuan sudah pernah diassign');
|
||||
window.location='validasi.php';
|
||||
</script>
|
||||
";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
mysqli_query($conn,
|
||||
|
||||
"INSERT INTO bantuan
|
||||
(laporan_id,rumah_ibadah_id,cs_id,jenis_bantuan,status)
|
||||
|
||||
VALUES
|
||||
|
||||
(
|
||||
'$laporan_id',
|
||||
'$rumah_ibadah_id',
|
||||
'$cs_id',
|
||||
'$jenis_bantuan',
|
||||
'proses'
|
||||
)"
|
||||
|
||||
);
|
||||
|
||||
$cek_laporan = mysqli_query(
|
||||
$conn,
|
||||
"SELECT * FROM laporan
|
||||
WHERE id='$laporan_id'"
|
||||
);
|
||||
|
||||
if(mysqli_num_rows($cek_laporan)==0){
|
||||
die("Laporan tidak ditemukan");
|
||||
}
|
||||
|
||||
/* UPDATE STATUS */
|
||||
|
||||
mysqli_query($conn,
|
||||
|
||||
"UPDATE laporan
|
||||
SET status='diproses'
|
||||
WHERE id='$laporan_id'"
|
||||
|
||||
);
|
||||
|
||||
header("Location: validasi.php");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['role'])){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['role'] != 'admin'){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
include '../config/koneksi.php';
|
||||
|
||||
$id = intval($_GET['id']);
|
||||
|
||||
$cek = mysqli_query(
|
||||
$conn,
|
||||
"SELECT * FROM laporan
|
||||
WHERE id='$id'"
|
||||
);
|
||||
|
||||
if(mysqli_num_rows($cek)==0){
|
||||
die("Data laporan tidak ditemukan");
|
||||
}
|
||||
|
||||
mysqli_query($conn,
|
||||
"UPDATE laporan
|
||||
SET status='ditolak'
|
||||
WHERE id='$id'");
|
||||
|
||||
header("Location: validasi.php");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['role'])){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['role'] != 'admin'){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
include '../config/koneksi.php';
|
||||
|
||||
$data = mysqli_query($conn,
|
||||
"SELECT * FROM rumah_ibadah");
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<title>Rumah Ibadah</title>
|
||||
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" />
|
||||
|
||||
<?php include 'layout/style.php'; ?>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<?php include 'layout/navbar.php'; ?>
|
||||
|
||||
<?php include 'layout/sidebar.php'; ?>
|
||||
|
||||
<div class="content">
|
||||
|
||||
|
||||
<div class="flex flex-col md:flex-row md:items-center md:justify-between gap-4 mb-6">
|
||||
|
||||
<div>
|
||||
|
||||
<h1 class="text-3xl font-bold text-gray-800">
|
||||
Data Rumah Ibadah
|
||||
</h1>
|
||||
|
||||
<p class="text-gray-500 mt-2">
|
||||
Kelola data rumah ibadah yang berpartisipasi dalam program bantuan sosial.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<a href="tambah_rumah_ibadah.php"
|
||||
class="inline-flex items-center gap-2 px-5 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-xl shadow transition">
|
||||
|
||||
<i class="fas fa-plus"></i>
|
||||
|
||||
Tambah Rumah Ibadah
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
$total_rumah_ibadah = mysqli_num_rows($data);
|
||||
|
||||
mysqli_data_seek($data,0);
|
||||
|
||||
?>
|
||||
|
||||
<div class="grid md:grid-cols-3 gap-5 mb-6">
|
||||
|
||||
<div class="bg-white rounded-2xl shadow p-5">
|
||||
|
||||
<div class="flex items-center justify-between">
|
||||
|
||||
<div>
|
||||
|
||||
<p class="text-gray-500 text-sm">
|
||||
Total Rumah Ibadah
|
||||
</p>
|
||||
|
||||
<h2 class="text-3xl font-bold text-blue-600">
|
||||
<?= $total_rumah_ibadah ?>
|
||||
</h2>
|
||||
|
||||
</div>
|
||||
|
||||
<i class="fas fa-place-of-worship text-4xl text-blue-500"></i>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-2xl shadow overflow-hidden">
|
||||
|
||||
<div class="p-5 border-b">
|
||||
|
||||
<h2 class="font-semibold text-lg">
|
||||
Daftar Rumah Ibadah
|
||||
</h2>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="overflow-x-auto">
|
||||
|
||||
<table class="min-w-full">
|
||||
|
||||
<thead class="bg-gray-100">
|
||||
|
||||
<tr>
|
||||
|
||||
<th class="px-4 py-3 text-left">No</th>
|
||||
<th class="px-4 py-3 text-left">Nama</th>
|
||||
<th class="px-4 py-3 text-left">Alamat</th>
|
||||
<th class="px-4 py-3 text-left">Latitude</th>
|
||||
<th class="px-4 py-3 text-left">Longitude</th>
|
||||
<th class="px-4 py-3 text-center">Aksi</th>
|
||||
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
|
||||
$no = 1;
|
||||
|
||||
mysqli_data_seek($data,0);
|
||||
|
||||
if(mysqli_num_rows($data) > 0){
|
||||
|
||||
while($row = mysqli_fetch_assoc($data)){
|
||||
|
||||
?>
|
||||
|
||||
<tr class="border-b hover:bg-gray-50 transition">
|
||||
|
||||
<td class="px-4 py-3">
|
||||
<?= $no++ ?>
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-3 font-medium">
|
||||
<?= htmlspecialchars($row['nama']) ?>
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-3">
|
||||
<?= htmlspecialchars($row['alamat']) ?>
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-3">
|
||||
<?= htmlspecialchars($row['latitude']) ?>
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-3">
|
||||
<?= htmlspecialchars($row['longitude']) ?>
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-3 text-center">
|
||||
|
||||
<div class="flex flex-wrap justify-center gap-2">
|
||||
|
||||
<a href="https://www.google.com/maps?q=<?= $row['latitude'] ?>,<?= $row['longitude'] ?>"
|
||||
target="_blank"
|
||||
class="px-3 py-2 bg-green-600 hover:bg-green-700 text-white rounded-lg transition">
|
||||
|
||||
<i class="fas fa-map-marker-alt"></i>
|
||||
|
||||
</a>
|
||||
|
||||
<a href="hapus_rumah_ibadah.php?id=<?= $row['id'] ?>"
|
||||
onclick="return confirm('Yakin hapus data?')"
|
||||
class="px-3 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition">
|
||||
|
||||
<i class="fas fa-trash"></i>
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php } } else { ?>
|
||||
|
||||
<tr>
|
||||
|
||||
<td colspan="6" class="py-10 text-center text-gray-500">
|
||||
|
||||
<i class="fas fa-place-of-worship text-4xl mb-3 block"></i>
|
||||
|
||||
Belum ada data rumah ibadah
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['role'])){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['role'] != 'admin'){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
include '../config/koneksi.php';
|
||||
|
||||
$nama =
|
||||
mysqli_real_escape_string(
|
||||
$conn,
|
||||
$_POST['nama']
|
||||
);
|
||||
|
||||
$alamat =
|
||||
mysqli_real_escape_string(
|
||||
$conn,
|
||||
$_POST['alamat']
|
||||
);
|
||||
|
||||
$latitude = $_POST['latitude'];
|
||||
$longitude = $_POST['longitude'];
|
||||
|
||||
mysqli_query($conn,
|
||||
|
||||
"INSERT INTO rumah_ibadah
|
||||
(nama,alamat,latitude,longitude)
|
||||
|
||||
VALUES
|
||||
|
||||
('$nama','$alamat','$latitude','$longitude')"
|
||||
|
||||
);
|
||||
|
||||
header("Location: rumah_ibadah.php");
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,345 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['role'])){
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['role'] != 'admin'){
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['role'])){
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['role'] != 'admin'){
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
|
||||
<title>Tambah Rumah Ibadah</title>
|
||||
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" />
|
||||
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
|
||||
|
||||
<?php include 'layout/style.php'; ?>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
<?php include 'layout/navbar.php'; ?>
|
||||
<?php include 'layout/sidebar.php'; ?>
|
||||
|
||||
<div class="content">
|
||||
|
||||
<div class="mb-6">
|
||||
|
||||
<h1 class="text-3xl font-bold text-gray-800">
|
||||
Tambah Rumah Ibadah
|
||||
</h1>
|
||||
|
||||
<p class="text-gray-500 mt-2">
|
||||
Tambahkan data rumah ibadah yang akan menjadi mitra penyaluran bantuan sosial.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-2xl shadow-lg overflow-hidden max-w-5xl">
|
||||
|
||||
<div class="p-5 border-b bg-gray-50">
|
||||
|
||||
<h2 class="font-semibold text-lg flex items-center gap-2">
|
||||
|
||||
<i class="fas fa-place-of-worship text-blue-600"></i>
|
||||
|
||||
Form Rumah Ibadah
|
||||
|
||||
</h2>
|
||||
|
||||
</div>
|
||||
|
||||
<form action="simpan_rumah_ibadah.php" method="POST" class="p-6 space-y-5">
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Nama Rumah Ibadah
|
||||
</label>
|
||||
|
||||
<div class="relative">
|
||||
|
||||
<i class="fas fa-building absolute left-4 top-4 text-gray-400"></i>
|
||||
|
||||
<input type="text" name="nama" required placeholder="Masukkan nama rumah ibadah"
|
||||
class="w-full border rounded-xl pl-11 pr-4 py-3 focus:ring-2 focus:ring-blue-500 focus:outline-none">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Alamat
|
||||
</label>
|
||||
|
||||
<textarea id="alamat" name="alamat" required rows="4"
|
||||
placeholder="Alamat akan terisi otomatis saat memilih lokasi"
|
||||
class="w-full border rounded-xl p-3 focus:ring-2 focus:ring-blue-500 focus:outline-none"></textarea>
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Cari Lokasi
|
||||
</label>
|
||||
|
||||
<input type="text" id="searchLocation" placeholder="Contoh: Masjid Raya Mujahidin Pontianak"
|
||||
class="w-full border rounded-xl p-3">
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Pilih Lokasi di Peta
|
||||
</label>
|
||||
|
||||
<div id="map" class="rounded-xl border" style="height:450px;">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="grid md:grid-cols-2 gap-5">
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Latitude
|
||||
</label>
|
||||
|
||||
<input type="text" id="latitude" name="latitude" readonly required
|
||||
class="w-full border rounded-xl p-3 bg-gray-100">
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Longitude
|
||||
</label>
|
||||
|
||||
<input type="text" id="longitude" name="longitude" readonly required
|
||||
class="w-full border rounded-xl p-3 bg-gray-100">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap gap-3 pt-4">
|
||||
|
||||
<button type="submit"
|
||||
class="px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-xl shadow transition">
|
||||
|
||||
<i class="fas fa-save mr-2"></i>
|
||||
|
||||
Simpan Data
|
||||
|
||||
</button>
|
||||
|
||||
<a href="rumah_ibadah.php"
|
||||
class="px-6 py-3 bg-gray-500 hover:bg-gray-600 text-white rounded-xl shadow transition">
|
||||
|
||||
<i class="fas fa-arrow-left mr-2"></i>
|
||||
|
||||
Kembali
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
|
||||
|
||||
<script>
|
||||
var map = L.map('map').setView(
|
||||
[-0.0263, 109.3425],
|
||||
11
|
||||
);
|
||||
|
||||
L.tileLayer(
|
||||
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© OpenStreetMap'
|
||||
}
|
||||
).addTo(map);
|
||||
|
||||
var marker = L.marker(
|
||||
[-0.0263, 109.3425], {
|
||||
draggable: true
|
||||
}
|
||||
).addTo(map);
|
||||
|
||||
function updateLatLng(lat, lng) {
|
||||
|
||||
document.getElementById('latitude').value =
|
||||
lat.toFixed(6);
|
||||
|
||||
document.getElementById('longitude').value =
|
||||
lng.toFixed(6);
|
||||
}
|
||||
|
||||
updateLatLng(
|
||||
marker.getLatLng().lat,
|
||||
marker.getLatLng().lng
|
||||
);
|
||||
|
||||
function updateAddress(lat, lng) {
|
||||
|
||||
fetch(
|
||||
'https://nominatim.openstreetmap.org/reverse?format=json&lat=' +
|
||||
lat +
|
||||
'&lon=' +
|
||||
lng
|
||||
)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
|
||||
if (data.display_name) {
|
||||
|
||||
document.getElementById('alamat').value =
|
||||
data.display_name;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
map.on('click', function(e) {
|
||||
|
||||
marker.setLatLng(e.latlng);
|
||||
|
||||
updateLatLng(
|
||||
e.latlng.lat,
|
||||
e.latlng.lng
|
||||
);
|
||||
|
||||
updateAddress(
|
||||
e.latlng.lat,
|
||||
e.latlng.lng
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
marker.on('dragend', function() {
|
||||
|
||||
var pos = marker.getLatLng();
|
||||
|
||||
updateLatLng(
|
||||
pos.lat,
|
||||
pos.lng
|
||||
);
|
||||
|
||||
updateAddress(
|
||||
pos.lat,
|
||||
pos.lng
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
document
|
||||
.getElementById('searchLocation')
|
||||
.addEventListener('keypress', async function(e) {
|
||||
|
||||
if (e.key !== 'Enter') {
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
let keyword = this.value;
|
||||
|
||||
let response = await fetch(
|
||||
'https://nominatim.openstreetmap.org/search?format=json&q=' +
|
||||
encodeURIComponent(keyword)
|
||||
);
|
||||
|
||||
let data = await response.json();
|
||||
|
||||
if (data.length > 0) {
|
||||
|
||||
let lat = parseFloat(data[0].lat);
|
||||
let lng = parseFloat(data[0].lon);
|
||||
|
||||
map.setView(
|
||||
[lat, lng],
|
||||
15
|
||||
);
|
||||
|
||||
marker.setLatLng(
|
||||
[lat, lng]
|
||||
);
|
||||
|
||||
updateLatLng(
|
||||
lat,
|
||||
lng
|
||||
);
|
||||
|
||||
updateAddress(
|
||||
lat,
|
||||
lng
|
||||
);
|
||||
|
||||
} else {
|
||||
|
||||
alert('Lokasi tidak ditemukan');
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
|
||||
map.invalidateSize();
|
||||
|
||||
}, 500);
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,230 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['role'])){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['role'] != 'admin'){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
include '../config/koneksi.php';
|
||||
|
||||
$data = mysqli_query($conn,
|
||||
"SELECT * FROM laporan");
|
||||
|
||||
if(!$data){
|
||||
die(mysqli_error($conn));
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<title>Validasi</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" />
|
||||
|
||||
<?php include 'layout/style.php'; ?>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<?php include 'layout/navbar.php'; ?>
|
||||
|
||||
<?php include 'layout/sidebar.php'; ?>
|
||||
|
||||
<div class="content">
|
||||
|
||||
|
||||
<div class="mb-6">
|
||||
<h1 class="text-3xl font-bold text-gray-800">
|
||||
Validasi Laporan
|
||||
</h1>
|
||||
<p class="text-gray-500 mt-1">
|
||||
Kelola laporan kemiskinan yang masuk dari masyarakat.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-2xl shadow-lg overflow-hidden">
|
||||
|
||||
<div class="p-5 border-b bg-gray-50">
|
||||
<h2 class="font-semibold text-lg">
|
||||
Data Laporan
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div class="overflow-x-auto">
|
||||
|
||||
<table class="min-w-full">
|
||||
|
||||
<thead class="bg-gray-100">
|
||||
|
||||
<tr>
|
||||
|
||||
<th class="px-4 py-3 text-left">No</th>
|
||||
<th class="px-4 py-3 text-left">Nama</th>
|
||||
<th class="px-4 py-3 text-left">Alamat</th>
|
||||
<th class="px-4 py-3 text-left">Foto</th>
|
||||
<th class="px-4 py-3 text-left">Status</th>
|
||||
<th class="px-4 py-3 text-center">Aksi</th>
|
||||
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
|
||||
$no = 1;
|
||||
|
||||
while($row = mysqli_fetch_assoc($data)){
|
||||
|
||||
?>
|
||||
|
||||
<tr class="border-b hover:bg-gray-50 transition">
|
||||
|
||||
<td class="px-4 py-3">
|
||||
<?= $no++ ?>
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-3 font-medium">
|
||||
<?= $row['nama_warga'] ?>
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-3">
|
||||
<?= $row['alamat'] ?>
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-3">
|
||||
|
||||
<?php if(!empty($row['foto'])){ ?>
|
||||
|
||||
<img src="../assets/uploads/<?= htmlspecialchars($row['foto']) ?>"
|
||||
onerror="this.src='../assets/uploads/no-image.png'"
|
||||
class="w-20 h-20 object-cover rounded-xl shadow">
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<span class="text-gray-400 italic">
|
||||
Tidak ada foto
|
||||
</span>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-3">
|
||||
|
||||
<?php
|
||||
|
||||
if($row['status']=='pending'){
|
||||
|
||||
echo '<span class="px-3 py-1 rounded-full text-xs font-semibold bg-yellow-100 text-yellow-700">
|
||||
Pending
|
||||
</span>';
|
||||
}
|
||||
|
||||
elseif($row['status']=='disetujui'){
|
||||
|
||||
echo '<span class="px-3 py-1 rounded-full text-xs font-semibold bg-green-100 text-green-700">
|
||||
Disetujui
|
||||
</span>';
|
||||
}
|
||||
|
||||
elseif($row['status']=='ditolak'){
|
||||
|
||||
echo '<span class="px-3 py-1 rounded-full text-xs font-semibold bg-red-100 text-red-700">
|
||||
Ditolak
|
||||
</span>';
|
||||
}
|
||||
|
||||
elseif($row['status']=='diproses'){
|
||||
|
||||
echo '<span class="px-3 py-1 rounded-full text-xs font-semibold bg-blue-100 text-blue-700">
|
||||
Diproses
|
||||
</span>';
|
||||
}
|
||||
|
||||
elseif($row['status']=='selesai'){
|
||||
|
||||
echo '<span class="px-3 py-1 rounded-full text-xs font-semibold bg-purple-100 text-purple-700">
|
||||
Selesai
|
||||
</span>';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-3">
|
||||
|
||||
<div class="flex flex-wrap gap-2 justify-center">
|
||||
|
||||
<?php if($row['status']=='pending'){ ?>
|
||||
|
||||
<a href="approve.php?id=<?= $row['id'] ?>"
|
||||
onclick="return confirm('Setujui laporan ini?')"
|
||||
class="px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-lg text-sm transition">
|
||||
|
||||
<i class="fas fa-check mr-1"></i>
|
||||
Approve
|
||||
|
||||
</a>
|
||||
|
||||
<a href="reject.php?id=<?= $row['id'] ?>"
|
||||
onclick="return confirm('Tolak laporan ini?')"
|
||||
class="px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg text-sm transition">
|
||||
|
||||
<i class="fas fa-times mr-1"></i>
|
||||
Reject
|
||||
|
||||
</a>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php if($row['status']=='disetujui'){ ?>
|
||||
|
||||
<a href="assign_bantuan.php?id=<?= $row['id'] ?>"
|
||||
class="px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg text-sm transition">
|
||||
|
||||
<i class="fas fa-hand-holding-heart mr-1"></i>
|
||||
Assign Bantuan
|
||||
|
||||
</a>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 81 KiB |
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
$host = getenv('DB_HOST') ?: 'localhost';
|
||||
$user = getenv('DB_USER') ?: 'root';
|
||||
$pass = getenv('DB_PASS') ?: '';
|
||||
$db = getenv('DB_NAME') ?: 'webgis_poverty';
|
||||
|
||||
$conn = mysqli_connect(
|
||||
$host,
|
||||
$user,
|
||||
$pass,
|
||||
$db
|
||||
);
|
||||
|
||||
if (!$conn) {
|
||||
die("Koneksi database gagal: " . mysqli_connect_error());
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,223 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['role'])){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['role'] != 'cs'){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
include '../config/koneksi.php';
|
||||
|
||||
$user_id = $_SESSION['id'];
|
||||
|
||||
$cs = mysqli_fetch_assoc(
|
||||
mysqli_query(
|
||||
$conn,
|
||||
"SELECT * FROM cs_rumah_ibadah
|
||||
WHERE user_id='$user_id'"
|
||||
)
|
||||
);
|
||||
|
||||
$cs_id = $cs['id'];
|
||||
|
||||
/* TOTAL */
|
||||
|
||||
$total = mysqli_num_rows(
|
||||
|
||||
mysqli_query($conn,
|
||||
|
||||
"SELECT * FROM bantuan
|
||||
WHERE cs_id='$cs_id'")
|
||||
|
||||
);
|
||||
|
||||
/* PROSES */
|
||||
|
||||
$proses = mysqli_num_rows(
|
||||
|
||||
mysqli_query($conn,
|
||||
|
||||
"SELECT * FROM bantuan
|
||||
|
||||
WHERE cs_id='$cs_id'
|
||||
AND status='proses'")
|
||||
|
||||
);
|
||||
|
||||
/* SELESAI */
|
||||
|
||||
$selesai = mysqli_num_rows(
|
||||
|
||||
mysqli_query($conn,
|
||||
|
||||
"SELECT * FROM bantuan
|
||||
|
||||
WHERE cs_id='$cs_id'
|
||||
AND status='selesai'")
|
||||
|
||||
);
|
||||
|
||||
$persentase = 0;
|
||||
|
||||
if($total > 0){
|
||||
$persentase = round(($selesai / $total) * 100);
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<title>Dashboard CS</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" />
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body class="bg-slate-100 min-h-screen">
|
||||
|
||||
<!-- NAVBAR -->
|
||||
<nav class="bg-slate-800 text-white shadow">
|
||||
|
||||
<div class="max-w-7xl mx-auto px-4 py-4 flex flex-col md:flex-row justify-between items-center gap-3">
|
||||
|
||||
<h2 class="font-bold text-xl">
|
||||
Dashboard CS
|
||||
</h2>
|
||||
|
||||
<div class="flex flex-col sm:flex-row items-center gap-3">
|
||||
|
||||
<span>
|
||||
Halo,
|
||||
<?= htmlspecialchars($_SESSION['nama']) ?>
|
||||
</span>
|
||||
|
||||
<a href="../logout.php" onclick="return confirm('Logout sekarang?')"
|
||||
class="bg-red-500 hover:bg-red-600 px-4 py-2 rounded-lg transition">
|
||||
|
||||
Logout
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
|
||||
<!-- CONTENT -->
|
||||
<div class="max-w-7xl mx-auto p-6">
|
||||
|
||||
<!-- HERO -->
|
||||
<div class="bg-gradient-to-r from-emerald-600 to-teal-600 text-white rounded-3xl p-8 shadow-lg">
|
||||
|
||||
<h1 class="text-3xl font-bold">
|
||||
Selamat Datang 👋
|
||||
<?= htmlspecialchars($_SESSION['nama']) ?>
|
||||
</h1>
|
||||
|
||||
<p class="mt-3 text-emerald-100">
|
||||
Kelola tugas bantuan sosial yang telah diberikan oleh admin.
|
||||
</p>
|
||||
|
||||
<div class="flex flex-col sm:flex-row gap-3 mt-6">
|
||||
|
||||
<a href="tugas.php"
|
||||
class="bg-white text-emerald-600 font-semibold px-6 py-3 rounded-xl shadow hover:shadow-lg transition">
|
||||
|
||||
<i class="fa-solid fa-list-check mr-2"></i>
|
||||
Lihat Tugas
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- CARDS -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-6 mt-8">
|
||||
|
||||
<!-- Total -->
|
||||
<div class="bg-white rounded-2xl shadow p-6">
|
||||
|
||||
<i class="fa-solid fa-list text-4xl text-emerald-600"></i>
|
||||
|
||||
<p class="text-slate-500 mt-3">
|
||||
Total Tugas
|
||||
</p>
|
||||
|
||||
<h2 class="text-4xl font-bold">
|
||||
<?= $total ?>
|
||||
</h2>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Diproses -->
|
||||
<div class="bg-white rounded-2xl shadow p-6">
|
||||
|
||||
<i class="fa-solid fa-spinner animate-spin text-4xl text-blue-500"></i>
|
||||
|
||||
<p class="text-slate-500 mt-3">
|
||||
Diproses
|
||||
</p>
|
||||
|
||||
<h2 class="text-4xl font-bold">
|
||||
<?= $proses ?>
|
||||
</h2>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Selesai -->
|
||||
<div class="bg-white rounded-2xl shadow p-6">
|
||||
|
||||
<i class="fa-solid fa-circle-check text-4xl text-green-500"></i>
|
||||
|
||||
<p class="text-slate-500 mt-3">
|
||||
Selesai
|
||||
</p>
|
||||
|
||||
<h2 class="text-4xl font-bold">
|
||||
<?= $selesai ?>
|
||||
</h2>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-2xl shadow p-6 mt-8">
|
||||
|
||||
<h3 class="font-semibold text-slate-700">
|
||||
Progress Penyelesaian Bantuan
|
||||
</h3>
|
||||
|
||||
<div class="w-full bg-slate-200 rounded-full h-4 mt-4">
|
||||
|
||||
<div class="bg-green-500 h-4 rounded-full" style="width: <?= $persentase ?>%">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<p class="mt-3 text-slate-500">
|
||||
|
||||
<?= $persentase ?>% tugas bantuan telah selesai disalurkan
|
||||
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,106 @@
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #f8fafc;
|
||||
font-family: 'Segoe UI', sans-serif;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
/* CARD */
|
||||
|
||||
.card {
|
||||
background: white;
|
||||
border-radius: 16px;
|
||||
padding: 25px;
|
||||
box-shadow:
|
||||
0 4px 20px rgba(0, 0, 0, .08);
|
||||
transition: .3s;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
transform: translateY(-5px);
|
||||
}
|
||||
|
||||
/* TABLE */
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
background: white;
|
||||
border-radius: 15px;
|
||||
overflow: hidden;
|
||||
box-shadow:
|
||||
0 4px 20px rgba(0, 0, 0, .08);
|
||||
}
|
||||
|
||||
th {
|
||||
background: #2563eb;
|
||||
color: white;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: 14px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
/* BUTTON */
|
||||
|
||||
.btn {
|
||||
padding: 10px 16px;
|
||||
border-radius: 10px;
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.approve {
|
||||
background: #16a34a;
|
||||
}
|
||||
|
||||
.reject {
|
||||
background: #dc2626;
|
||||
}
|
||||
|
||||
.delete {
|
||||
background: #64748b;
|
||||
}
|
||||
|
||||
.warning {
|
||||
background: #f59e0b;
|
||||
}
|
||||
|
||||
/* INPUT */
|
||||
|
||||
input,
|
||||
select,
|
||||
textarea {
|
||||
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
|
||||
border: 1px solid #ddd;
|
||||
|
||||
border-radius: 10px;
|
||||
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
/* BOX */
|
||||
|
||||
.box {
|
||||
background: white;
|
||||
padding: 25px;
|
||||
border-radius: 20px;
|
||||
box-shadow:
|
||||
0 4px 20px rgba(0, 0, 0, .08);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
include '../config/koneksi.php';
|
||||
|
||||
if(!isset($_SESSION['role'])){
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['role'] != 'cs'){
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$user_id = $_SESSION['id'];
|
||||
|
||||
$cs_query = mysqli_query(
|
||||
$conn,
|
||||
"SELECT * FROM cs_rumah_ibadah
|
||||
WHERE user_id='$user_id'"
|
||||
);
|
||||
|
||||
if(!$cs_query){
|
||||
die(mysqli_error($conn));
|
||||
}
|
||||
|
||||
$cs = mysqli_fetch_assoc($cs_query);
|
||||
|
||||
if(!$cs){
|
||||
die("Data CS tidak ditemukan");
|
||||
}
|
||||
|
||||
$cs_id = $cs['id'];
|
||||
|
||||
if(!isset($_POST['id'])){
|
||||
die("ID bantuan tidak ditemukan");
|
||||
}
|
||||
|
||||
$id = intval($_POST['id']);
|
||||
|
||||
if(
|
||||
!isset($_FILES['foto']) ||
|
||||
$_FILES['foto']['error'] != 0
|
||||
){
|
||||
die("Silakan pilih foto");
|
||||
}
|
||||
|
||||
$tmp = $_FILES['foto']['tmp_name'];
|
||||
$nama_asli = $_FILES['foto']['name'];
|
||||
|
||||
$ext = strtolower(
|
||||
pathinfo(
|
||||
$nama_asli,
|
||||
PATHINFO_EXTENSION
|
||||
)
|
||||
);
|
||||
|
||||
$allowed = [
|
||||
'jpg',
|
||||
'jpeg',
|
||||
'png',
|
||||
'webp'
|
||||
];
|
||||
|
||||
if(!in_array($ext,$allowed)){
|
||||
die("Format file tidak didukung");
|
||||
}
|
||||
|
||||
if(getimagesize($tmp) === false){
|
||||
die("File harus berupa gambar");
|
||||
}
|
||||
|
||||
$foto =
|
||||
time() . '_' .
|
||||
preg_replace(
|
||||
'/[^a-zA-Z0-9._-]/',
|
||||
'',
|
||||
basename($nama_asli)
|
||||
);
|
||||
|
||||
$cek_query = mysqli_query(
|
||||
$conn,
|
||||
"SELECT *
|
||||
FROM bantuan
|
||||
WHERE id='$id'
|
||||
AND cs_id='$cs_id'"
|
||||
);
|
||||
|
||||
if(!$cek_query){
|
||||
die(mysqli_error($conn));
|
||||
}
|
||||
|
||||
$cek = mysqli_fetch_assoc($cek_query);
|
||||
|
||||
if(!$cek){
|
||||
die("Akses ditolak");
|
||||
}
|
||||
|
||||
if(!is_dir("../assets/uploads")){
|
||||
mkdir("../assets/uploads",0777,true);
|
||||
}
|
||||
|
||||
if(
|
||||
!move_uploaded_file(
|
||||
$tmp,
|
||||
"../assets/uploads/".$foto
|
||||
)
|
||||
){
|
||||
die("Upload foto gagal");
|
||||
}
|
||||
|
||||
$update = mysqli_query(
|
||||
$conn,
|
||||
"UPDATE bantuan
|
||||
SET
|
||||
bukti_foto='$foto',
|
||||
status='selesai'
|
||||
WHERE id='$id'"
|
||||
);
|
||||
|
||||
if(!$update){
|
||||
die(mysqli_error($conn));
|
||||
}
|
||||
|
||||
$data_query = mysqli_query(
|
||||
$conn,
|
||||
"SELECT laporan_id
|
||||
FROM bantuan
|
||||
WHERE id='$id'"
|
||||
);
|
||||
|
||||
if(!$data_query){
|
||||
die(mysqli_error($conn));
|
||||
}
|
||||
|
||||
$data = mysqli_fetch_assoc($data_query);
|
||||
|
||||
if(!$data){
|
||||
die("Data bantuan tidak ditemukan");
|
||||
}
|
||||
|
||||
$laporan_id = $data['laporan_id'];
|
||||
|
||||
mysqli_query(
|
||||
$conn,
|
||||
"UPDATE laporan
|
||||
SET status='selesai'
|
||||
WHERE id='$laporan_id'"
|
||||
);
|
||||
|
||||
header("Location: tugas.php");
|
||||
exit;
|
||||
?>
|
||||
+249
@@ -0,0 +1,249 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['role'])){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['role'] != 'cs'){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
include '../config/koneksi.php';
|
||||
|
||||
$user_id = $_SESSION['id'];
|
||||
|
||||
$cs = mysqli_fetch_assoc(
|
||||
|
||||
mysqli_query($conn,
|
||||
|
||||
"SELECT * FROM cs_rumah_ibadah
|
||||
WHERE user_id='$user_id'")
|
||||
|
||||
);
|
||||
|
||||
$cs_id = $cs['id'];
|
||||
|
||||
$data = mysqli_query($conn,
|
||||
|
||||
"SELECT bantuan.*,
|
||||
|
||||
laporan.nama_warga,
|
||||
laporan.alamat,
|
||||
laporan.latitude,
|
||||
laporan.longitude
|
||||
|
||||
FROM bantuan
|
||||
|
||||
JOIN laporan
|
||||
ON bantuan.laporan_id = laporan.id
|
||||
|
||||
WHERE bantuan.cs_id='$cs_id'
|
||||
|
||||
ORDER BY bantuan.id DESC"
|
||||
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<title>Tugas Bantuan</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="bg-slate-100 min-h-screen">
|
||||
|
||||
<div class="max-w-7xl mx-auto p-6">
|
||||
|
||||
<!-- HEADER -->
|
||||
<div class="flex flex-col md:flex-row justify-between items-start md:items-center gap-4 mb-6">
|
||||
|
||||
<div>
|
||||
|
||||
<h1 class="text-3xl font-bold text-slate-800">
|
||||
Tugas Bantuan Saya
|
||||
</h1>
|
||||
|
||||
<p class="text-slate-500 mt-2">
|
||||
Daftar bantuan sosial yang harus disalurkan.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<a href="dashboard.php"
|
||||
class="bg-slate-800 hover:bg-slate-900 text-white px-5 py-3 rounded-xl shadow transition">
|
||||
|
||||
← Dashboard
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- CARD -->
|
||||
<div class="bg-white rounded-3xl shadow-lg overflow-hidden">
|
||||
|
||||
<div class="overflow-x-auto">
|
||||
|
||||
<table class="min-w-full">
|
||||
|
||||
<thead>
|
||||
|
||||
<tr class="bg-emerald-600 text-white">
|
||||
|
||||
<th class="px-4 py-4 text-left">No</th>
|
||||
<th class="px-4 py-4 text-left">Nama Warga</th>
|
||||
<th class="px-4 py-4 text-left">Alamat</th>
|
||||
<th class="px-4 py-4 text-left">Lokasi</th>
|
||||
<th class="px-4 py-4 text-left">Jenis Bantuan</th>
|
||||
<th class="px-4 py-4 text-left">Status</th>
|
||||
<th class="px-4 py-4 text-left">Aksi</th>
|
||||
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
<?php
|
||||
|
||||
$no = 1;
|
||||
|
||||
if(mysqli_num_rows($data) == 0){
|
||||
?>
|
||||
|
||||
<tr>
|
||||
|
||||
<td colspan="7" class="text-center py-10 text-slate-500">
|
||||
|
||||
Belum ada tugas bantuan
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
while($row = mysqli_fetch_assoc($data)){
|
||||
?>
|
||||
|
||||
<tr class="border-b hover:bg-slate-50 transition">
|
||||
|
||||
<td class="px-4 py-4">
|
||||
<?= $no++ ?>
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-4 font-medium text-slate-800">
|
||||
<?= htmlspecialchars($row['nama_warga']) ?>
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-4 text-slate-600">
|
||||
<?= htmlspecialchars($row['alamat']) ?>
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-4">
|
||||
|
||||
<a target="_blank"
|
||||
href="https://www.google.com/maps?q=<?= $row['latitude'] ?>,<?= $row['longitude'] ?>"
|
||||
class="text-blue-600 hover:underline font-medium">
|
||||
|
||||
Lihat Lokasi
|
||||
|
||||
</a>
|
||||
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-4">
|
||||
<?= htmlspecialchars($row['jenis_bantuan']) ?>
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-4">
|
||||
|
||||
<?php if($row['status']=='proses'){ ?>
|
||||
|
||||
<span class="
|
||||
bg-amber-500
|
||||
text-white
|
||||
px-3 py-1
|
||||
rounded-full
|
||||
text-sm">
|
||||
|
||||
Diproses
|
||||
|
||||
</span>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php if($row['status']=='selesai'){ ?>
|
||||
|
||||
<span class="
|
||||
bg-green-600
|
||||
text-white
|
||||
px-3 py-1
|
||||
rounded-full
|
||||
text-sm">
|
||||
|
||||
Selesai
|
||||
|
||||
</span>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td class="px-4 py-4">
|
||||
|
||||
<?php if($row['status']=='proses'){ ?>
|
||||
|
||||
<a href="upload_bukti.php?id=<?= $row['id'] ?>" class="
|
||||
bg-emerald-600
|
||||
hover:bg-emerald-700
|
||||
text-white
|
||||
px-4 py-2
|
||||
rounded-lg
|
||||
shadow
|
||||
transition">
|
||||
|
||||
Upload Bukti
|
||||
|
||||
</a>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<span class="text-green-600 font-semibold">
|
||||
|
||||
✓ Selesai
|
||||
|
||||
</span>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,209 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['role'])){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['role'] != 'cs'){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
include '../config/koneksi.php';
|
||||
|
||||
$user_id = $_SESSION['id'];
|
||||
|
||||
$cs = mysqli_fetch_assoc(
|
||||
mysqli_query(
|
||||
$conn,
|
||||
"SELECT * FROM cs_rumah_ibadah
|
||||
WHERE user_id='$user_id'"
|
||||
)
|
||||
);
|
||||
|
||||
if(!$cs){
|
||||
die("Data CS tidak ditemukan");
|
||||
}
|
||||
|
||||
$cs_id = $cs['id'];
|
||||
|
||||
$id = intval($_GET['id']);
|
||||
|
||||
$data = mysqli_fetch_assoc(
|
||||
|
||||
mysqli_query($conn,
|
||||
|
||||
"SELECT bantuan.*,
|
||||
|
||||
laporan.nama_warga,
|
||||
laporan.alamat
|
||||
|
||||
FROM bantuan
|
||||
|
||||
JOIN laporan
|
||||
ON bantuan.laporan_id = laporan.id
|
||||
|
||||
WHERE bantuan.id='$id'
|
||||
AND bantuan.cs_id='$cs_id'")
|
||||
);
|
||||
|
||||
if(!$data){
|
||||
die("Tugas tidak ditemukan");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
|
||||
<title>Upload Bukti Bantuan</title>
|
||||
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body class="bg-gray-100 min-h-screen">
|
||||
|
||||
|
||||
<div class="max-w-4xl mx-auto p-6">
|
||||
|
||||
<a href="tugas.php"
|
||||
class="inline-flex items-center gap-2 px-4 py-2 bg-gray-700 hover:bg-gray-800 text-white rounded-xl mb-6 transition">
|
||||
|
||||
<i class="fas fa-arrow-left"></i>
|
||||
|
||||
Kembali
|
||||
|
||||
</a>
|
||||
|
||||
<div class="bg-white rounded-2xl shadow-lg overflow-hidden">
|
||||
|
||||
<div class="bg-green-600 text-white p-6">
|
||||
|
||||
<h1 class="text-2xl font-bold flex items-center gap-3">
|
||||
|
||||
<i class="fas fa-camera"></i>
|
||||
|
||||
Upload Bukti Bantuan
|
||||
|
||||
</h1>
|
||||
|
||||
<p class="mt-2 text-green-100">
|
||||
Upload dokumentasi penyaluran bantuan kepada warga.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="p-6">
|
||||
|
||||
<div class="grid md:grid-cols-2 gap-5 mb-6">
|
||||
|
||||
<div class="bg-gray-50 rounded-xl p-4">
|
||||
|
||||
<p class="text-gray-500 text-sm">
|
||||
Nama Warga
|
||||
</p>
|
||||
|
||||
<h3 class="font-semibold text-lg mt-1">
|
||||
<?= htmlspecialchars($data['nama_warga']) ?>
|
||||
</h3>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="bg-gray-50 rounded-xl p-4">
|
||||
|
||||
<p class="text-gray-500 text-sm">
|
||||
Alamat
|
||||
</p>
|
||||
|
||||
<h3 class="font-medium mt-1">
|
||||
<?= htmlspecialchars($data['alamat']) ?>
|
||||
</h3>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<form action="proses_upload.php" method="POST" enctype="multipart/form-data">
|
||||
|
||||
<input type="hidden" name="id" value="<?= $data['id'] ?>">
|
||||
|
||||
<div class="mb-5">
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
|
||||
Foto Bukti Bantuan
|
||||
|
||||
</label>
|
||||
|
||||
<input type="file" id="foto" name="foto" accept="image/*" required
|
||||
class="w-full border rounded-xl p-3">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mb-6">
|
||||
|
||||
<img id="preview" class="hidden w-full max-w-md h-64 object-cover rounded-xl border shadow">
|
||||
|
||||
</div>
|
||||
|
||||
<button type="submit"
|
||||
class="px-6 py-3 bg-green-600 hover:bg-green-700 text-white rounded-xl shadow transition">
|
||||
|
||||
<i class="fas fa-upload mr-2"></i>
|
||||
|
||||
Upload Bukti
|
||||
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document
|
||||
.getElementById('foto')
|
||||
.addEventListener('change', function(e) {
|
||||
|
||||
const file = e.target.files[0];
|
||||
|
||||
if (!file) return;
|
||||
|
||||
const reader = new FileReader();
|
||||
|
||||
reader.onload = function(ev) {
|
||||
|
||||
const preview =
|
||||
document.getElementById('preview');
|
||||
|
||||
preview.src = ev.target.result;
|
||||
|
||||
preview.classList.remove('hidden');
|
||||
};
|
||||
|
||||
reader.readAsDataURL(file);
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
CREATE DATABASE IF NOT EXISTS webgis_poverty
|
||||
CHARACTER SET utf8mb4
|
||||
COLLATE utf8mb4_0900_ai_ci;
|
||||
|
||||
USE webgis_poverty;
|
||||
|
||||
DROP TABLE IF EXISTS bantuan;
|
||||
DROP TABLE IF EXISTS cs_rumah_ibadah;
|
||||
DROP TABLE IF EXISTS laporan;
|
||||
DROP TABLE IF EXISTS rumah_ibadah;
|
||||
DROP TABLE IF EXISTS users;
|
||||
|
||||
CREATE TABLE users (
|
||||
id INT NOT NULL AUTO_INCREMENT,
|
||||
nama VARCHAR(100),
|
||||
username VARCHAR(50),
|
||||
password VARCHAR(255),
|
||||
role ENUM('admin','warga','cs'),
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE laporan (
|
||||
id INT NOT NULL AUTO_INCREMENT,
|
||||
pelapor_id INT,
|
||||
nama_warga VARCHAR(100),
|
||||
alamat TEXT,
|
||||
latitude DOUBLE,
|
||||
longitude DOUBLE,
|
||||
kondisi TEXT,
|
||||
foto VARCHAR(255),
|
||||
status ENUM(
|
||||
'pending',
|
||||
'disetujui',
|
||||
'ditolak',
|
||||
'diproses',
|
||||
'selesai'
|
||||
) DEFAULT 'pending',
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE rumah_ibadah (
|
||||
id INT NOT NULL AUTO_INCREMENT,
|
||||
nama VARCHAR(100),
|
||||
alamat TEXT,
|
||||
latitude DOUBLE,
|
||||
longitude DOUBLE,
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE cs_rumah_ibadah (
|
||||
id INT NOT NULL AUTO_INCREMENT,
|
||||
nama VARCHAR(100),
|
||||
rumah_ibadah_id INT,
|
||||
no_hp VARCHAR(20),
|
||||
user_id INT,
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
CREATE TABLE bantuan (
|
||||
id INT NOT NULL AUTO_INCREMENT,
|
||||
laporan_id INT,
|
||||
cs_id INT,
|
||||
jenis_bantuan VARCHAR(100),
|
||||
status ENUM(
|
||||
'belum',
|
||||
'proses',
|
||||
'selesai'
|
||||
) DEFAULT 'belum',
|
||||
bukti_foto VARCHAR(255),
|
||||
tanggal TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
rumah_ibadah_id INT,
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
INSERT INTO users
|
||||
(nama, username, password, role)
|
||||
VALUES
|
||||
('Administrator','admin','0192023a7bbd73250516f069df18b500','admin'),
|
||||
('Andi Saputra','andi','e10adc3949ba59abbe56e057f20f883e','warga'),
|
||||
('Siti Nurhaliza','siti','e10adc3949ba59abbe56e057f20f883e','warga'),
|
||||
('Rahmat Hidayat','rahmat','e10adc3949ba59abbe56e057f20f883e','warga'),
|
||||
('Budi Santoso','cs01','8551e0027ff3a8de9662eb3b8a16c23e','cs'),
|
||||
('Santoso','cs02','8551e0027ff3a8de9662eb3b8a16c23e','cs');
|
||||
|
||||
INSERT INTO rumah_ibadah
|
||||
(nama, alamat, latitude, longitude)
|
||||
VALUES
|
||||
(
|
||||
'Gereja Katolik Paroki Bunda Maria',
|
||||
'Pontianak Barat, Kalimantan Barat',
|
||||
-0.005640,
|
||||
109.295179
|
||||
),
|
||||
(
|
||||
'Masjid Nurul Hamid',
|
||||
'Pontianak Barat, Kalimantan Barat',
|
||||
-0.008226,
|
||||
109.296014
|
||||
),
|
||||
(
|
||||
'Masjid Jannatun Naim',
|
||||
'Kendari, Sulawesi Tenggara',
|
||||
-3.997242,
|
||||
122.521983
|
||||
),
|
||||
(
|
||||
'GPIB Siloam Pontianak',
|
||||
'Pontianak Kota, Kalimantan Barat',
|
||||
-0.025091,
|
||||
109.337375
|
||||
);
|
||||
|
||||
INSERT INTO cs_rumah_ibadah
|
||||
(nama, rumah_ibadah_id, no_hp, user_id)
|
||||
VALUES
|
||||
(
|
||||
'Santoso',
|
||||
1,
|
||||
'081234567890',
|
||||
6
|
||||
);
|
||||
@@ -0,0 +1,116 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<title>Login WebGIS</title>
|
||||
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
|
||||
<style>
|
||||
body {
|
||||
|
||||
font-family: Arial;
|
||||
background: #f4f4f4;
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.login-box {
|
||||
|
||||
background: white;
|
||||
padding: 30px;
|
||||
|
||||
border-radius: 10px;
|
||||
|
||||
width: 300px;
|
||||
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
input {
|
||||
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
button {
|
||||
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
|
||||
margin-top: 15px;
|
||||
|
||||
background: #3498db;
|
||||
color: white;
|
||||
|
||||
border: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body class="bg-gray-100 flex items-center justify-center min-h-screen">
|
||||
|
||||
<div class="bg-white p-8 rounded-2xl shadow-xl w-full max-w-md">
|
||||
|
||||
<div class="text-center mb-6">
|
||||
|
||||
<h1 class="text-3xl font-bold text-blue-600">
|
||||
|
||||
WebGIS Kemiskinan
|
||||
|
||||
</h1>
|
||||
|
||||
<p class="text-gray-500 mt-2">
|
||||
|
||||
Sistem Pengentasan Kemiskinan Kalimantan Barat
|
||||
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<form action="login.php" method="POST" class="space-y-4">
|
||||
|
||||
<input type="text" name="username" placeholder="Username"
|
||||
class="w-full border rounded-xl px-4 py-3 focus:outline-none focus:ring-2 focus:ring-blue-500" required>
|
||||
|
||||
<input type="password" name="password" placeholder="Password"
|
||||
class="w-full border rounded-xl px-4 py-3 focus:outline-none focus:ring-2 focus:ring-blue-500" required>
|
||||
|
||||
<button type="submit"
|
||||
class="w-full bg-blue-600 hover:bg-blue-700 text-white py-3 rounded-xl font-semibold transition">
|
||||
|
||||
Login
|
||||
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
||||
<div class="mt-6 text-center space-y-2">
|
||||
|
||||
<a href="register.php" class="block text-blue-600 hover:underline">
|
||||
|
||||
Daftar sebagai Warga
|
||||
|
||||
</a>
|
||||
|
||||
<a href="register_cs.php" class="block text-green-600 hover:underline">
|
||||
|
||||
Daftar sebagai CS Rumah Ibadah
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
include 'config/koneksi.php';
|
||||
|
||||
$username =
|
||||
mysqli_real_escape_string(
|
||||
$conn,
|
||||
$_POST['username']
|
||||
);
|
||||
|
||||
$password = md5($_POST['password']);
|
||||
|
||||
$query = mysqli_query($conn,
|
||||
|
||||
"SELECT * FROM users
|
||||
|
||||
WHERE username='$username'
|
||||
AND password='$password'"
|
||||
|
||||
);
|
||||
|
||||
$data = mysqli_fetch_assoc($query);
|
||||
|
||||
if($data){
|
||||
|
||||
$_SESSION['id'] = $data['id'];
|
||||
|
||||
$_SESSION['nama'] = $data['nama'];
|
||||
|
||||
$_SESSION['role'] = $data['role'];
|
||||
|
||||
/* ADMIN */
|
||||
|
||||
if($data['role']=='admin'){
|
||||
|
||||
header("Location: admin/dashboard.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
/* WARGA */
|
||||
|
||||
elseif($data['role']=='warga'){
|
||||
|
||||
header("Location: warga/dashboard.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
/* CS */
|
||||
|
||||
elseif($data['role']=='cs'){
|
||||
|
||||
header("Location: cs/dashboard.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
echo "
|
||||
|
||||
<script>
|
||||
|
||||
alert('Login gagal');
|
||||
|
||||
window.location='index.php';
|
||||
|
||||
</script>
|
||||
|
||||
";
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
session_destroy();
|
||||
|
||||
header("Location: index.php");
|
||||
|
||||
?>
|
||||
+280
@@ -0,0 +1,280 @@
|
||||
<?php
|
||||
|
||||
include 'config/koneksi.php';
|
||||
|
||||
if(isset($_POST['register'])){
|
||||
|
||||
$nama =
|
||||
mysqli_real_escape_string(
|
||||
$conn,
|
||||
$_POST['nama']
|
||||
);
|
||||
|
||||
$username =
|
||||
mysqli_real_escape_string(
|
||||
$conn,
|
||||
$_POST['username']
|
||||
);
|
||||
$password = md5($_POST['password']);
|
||||
|
||||
$cek = mysqli_query($conn,
|
||||
"SELECT * FROM users WHERE username='$username'");
|
||||
|
||||
if(mysqli_num_rows($cek) > 0){
|
||||
|
||||
echo "<script>
|
||||
alert('Username sudah digunakan');
|
||||
window.location='register.php';
|
||||
</script>";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
mysqli_query($conn,
|
||||
|
||||
"INSERT INTO users
|
||||
(nama,username,password,role)
|
||||
|
||||
VALUES
|
||||
|
||||
(
|
||||
'$nama',
|
||||
'$username',
|
||||
'$password',
|
||||
'warga'
|
||||
)"
|
||||
|
||||
);
|
||||
|
||||
header("Location: index.php");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<title>Register Warga</title>
|
||||
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
|
||||
</head>
|
||||
|
||||
<?php
|
||||
|
||||
include 'config/koneksi.php';
|
||||
|
||||
if(isset($_POST['register'])){
|
||||
|
||||
$nama = mysqli_real_escape_string(
|
||||
$conn,
|
||||
trim($_POST['nama'])
|
||||
);
|
||||
|
||||
$username = mysqli_real_escape_string(
|
||||
$conn,
|
||||
trim($_POST['username'])
|
||||
);
|
||||
|
||||
$password = $_POST['password'];
|
||||
$konfirmasi = $_POST['konfirmasi_password'];
|
||||
|
||||
if(strlen($password) < 6){
|
||||
|
||||
echo "
|
||||
<script>
|
||||
alert('Password minimal 6 karakter');
|
||||
window.location='register.php';
|
||||
</script>
|
||||
";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
if($password != $konfirmasi){
|
||||
|
||||
echo "
|
||||
<script>
|
||||
alert('Konfirmasi password tidak sesuai');
|
||||
window.location='register.php';
|
||||
</script>
|
||||
";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
$cek = mysqli_query(
|
||||
$conn,
|
||||
"SELECT * FROM users WHERE username='$username'"
|
||||
);
|
||||
|
||||
if(mysqli_num_rows($cek) > 0){
|
||||
|
||||
echo "
|
||||
<script>
|
||||
alert('Username sudah digunakan');
|
||||
window.location='register.php';
|
||||
</script>
|
||||
";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
$password_hash = password_hash(
|
||||
$password,
|
||||
PASSWORD_DEFAULT
|
||||
);
|
||||
|
||||
mysqli_query(
|
||||
$conn,
|
||||
"INSERT INTO users
|
||||
(
|
||||
nama,
|
||||
username,
|
||||
password,
|
||||
role
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
'$nama',
|
||||
'$username',
|
||||
'$password_hash',
|
||||
'warga'
|
||||
)"
|
||||
);
|
||||
|
||||
echo "
|
||||
<script>
|
||||
alert('Registrasi berhasil');
|
||||
window.location='index.php';
|
||||
</script>
|
||||
";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
|
||||
<title>Register Warga</title>
|
||||
|
||||
<meta charset="utf-8">
|
||||
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body
|
||||
class="min-h-screen bg-gradient-to-br from-blue-600 via-blue-500 to-cyan-500 flex items-center justify-center p-5">
|
||||
|
||||
|
||||
<div class="w-full max-w-md">
|
||||
|
||||
<div class="bg-white rounded-3xl shadow-2xl overflow-hidden">
|
||||
|
||||
<div class="bg-blue-600 text-white p-8 text-center">
|
||||
|
||||
<i class="fas fa-user-plus text-5xl mb-4"></i>
|
||||
|
||||
<h1 class="text-3xl font-bold">
|
||||
Register Warga
|
||||
</h1>
|
||||
|
||||
<p class="mt-2 text-blue-100">
|
||||
Buat akun untuk mengirim laporan kemiskinan
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<form method="POST" class="p-8 space-y-5">
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Nama Lengkap
|
||||
</label>
|
||||
|
||||
<input type="text" name="nama" required placeholder="Masukkan nama lengkap"
|
||||
class="w-full border rounded-xl p-3 focus:ring-2 focus:ring-blue-500 focus:outline-none">
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Username
|
||||
</label>
|
||||
|
||||
<input type="text" name="username" required placeholder="Masukkan username"
|
||||
class="w-full border rounded-xl p-3 focus:ring-2 focus:ring-blue-500 focus:outline-none">
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Password
|
||||
</label>
|
||||
|
||||
<input type="password" id="password" name="password" required placeholder="Minimal 6 karakter"
|
||||
class="w-full border rounded-xl p-3 focus:ring-2 focus:ring-blue-500 focus:outline-none">
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Konfirmasi Password
|
||||
</label>
|
||||
|
||||
<input type="password" id="konfirmasi" name="konfirmasi_password" required
|
||||
placeholder="Ulangi password"
|
||||
class="w-full border rounded-xl p-3 focus:ring-2 focus:ring-blue-500 focus:outline-none">
|
||||
|
||||
</div>
|
||||
|
||||
<button type="submit" name="register"
|
||||
class="w-full bg-blue-600 hover:bg-blue-700 text-white py-3 rounded-xl font-semibold transition">
|
||||
|
||||
<i class="fas fa-user-plus mr-2"></i>
|
||||
|
||||
Register
|
||||
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
||||
<div class="px-8 pb-8 text-center">
|
||||
|
||||
<a href="index.php" class="text-blue-600 hover:text-blue-800 font-medium">
|
||||
|
||||
<i class="fas fa-arrow-left mr-1"></i>
|
||||
|
||||
Sudah punya akun? Login di sini
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
|
||||
?>
|
||||
+390
@@ -0,0 +1,390 @@
|
||||
<?php
|
||||
|
||||
include 'config/koneksi.php';
|
||||
|
||||
/* AMBIL RUMAH IBADAH */
|
||||
|
||||
$rumah_ibadah = mysqli_query($conn,
|
||||
"SELECT * FROM rumah_ibadah");
|
||||
|
||||
if(isset($_POST['register'])){
|
||||
|
||||
$nama =
|
||||
mysqli_real_escape_string(
|
||||
$conn,
|
||||
$_POST['nama']
|
||||
);
|
||||
|
||||
$username =
|
||||
mysqli_real_escape_string(
|
||||
$conn,
|
||||
$_POST['username']
|
||||
);
|
||||
|
||||
$no_hp =
|
||||
mysqli_real_escape_string(
|
||||
$conn,
|
||||
$_POST['no_hp']
|
||||
);
|
||||
|
||||
$rumah_ibadah_id =
|
||||
$_POST['rumah_ibadah_id'];
|
||||
|
||||
$password = md5($_POST['password']);
|
||||
|
||||
$cek = mysqli_query($conn,
|
||||
"SELECT * FROM users WHERE username='$username'");
|
||||
|
||||
if(mysqli_num_rows($cek) > 0){
|
||||
|
||||
echo "<script>
|
||||
alert('Username sudah digunakan');
|
||||
window.location='register_cs.php';
|
||||
</script>";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
/* INSERT USERS */
|
||||
|
||||
mysqli_query($conn,
|
||||
|
||||
"INSERT INTO users
|
||||
|
||||
(
|
||||
nama,
|
||||
username,
|
||||
password,
|
||||
role
|
||||
)
|
||||
|
||||
VALUES
|
||||
|
||||
(
|
||||
'$nama',
|
||||
'$username',
|
||||
'$password',
|
||||
'cs'
|
||||
)"
|
||||
|
||||
);
|
||||
|
||||
/* AMBIL USER ID */
|
||||
|
||||
$user_id = mysqli_insert_id($conn);
|
||||
|
||||
/* INSERT CS */
|
||||
|
||||
mysqli_query($conn,
|
||||
|
||||
"INSERT INTO cs_rumah_ibadah
|
||||
|
||||
(
|
||||
nama,
|
||||
rumah_ibadah_id,
|
||||
no_hp,
|
||||
user_id
|
||||
)
|
||||
|
||||
VALUES
|
||||
|
||||
(
|
||||
'$nama',
|
||||
'$rumah_ibadah_id',
|
||||
'$no_hp',
|
||||
'$user_id'
|
||||
)"
|
||||
|
||||
);
|
||||
|
||||
header("Location: index.php");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<?php
|
||||
|
||||
include 'config/koneksi.php';
|
||||
|
||||
$rumah_ibadah = mysqli_query(
|
||||
$conn,
|
||||
"SELECT * FROM rumah_ibadah ORDER BY nama ASC"
|
||||
);
|
||||
|
||||
if(isset($_POST['register'])){
|
||||
|
||||
$nama = mysqli_real_escape_string(
|
||||
$conn,
|
||||
trim($_POST['nama'])
|
||||
);
|
||||
|
||||
$username = mysqli_real_escape_string(
|
||||
$conn,
|
||||
trim($_POST['username'])
|
||||
);
|
||||
|
||||
$no_hp = mysqli_real_escape_string(
|
||||
$conn,
|
||||
trim($_POST['no_hp'])
|
||||
);
|
||||
|
||||
$rumah_ibadah_id = intval(
|
||||
$_POST['rumah_ibadah_id']
|
||||
);
|
||||
|
||||
$password = $_POST['password'];
|
||||
$konfirmasi = $_POST['konfirmasi_password'];
|
||||
|
||||
if(strlen($password) < 6){
|
||||
|
||||
echo "
|
||||
<script>
|
||||
alert('Password minimal 6 karakter');
|
||||
window.location='register_cs.php';
|
||||
</script>
|
||||
";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
if($password != $konfirmasi){
|
||||
|
||||
echo "
|
||||
<script>
|
||||
alert('Konfirmasi password tidak sesuai');
|
||||
window.location='register_cs.php';
|
||||
</script>
|
||||
";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
$cek = mysqli_query(
|
||||
$conn,
|
||||
"SELECT * FROM users
|
||||
WHERE username='$username'"
|
||||
);
|
||||
|
||||
if(mysqli_num_rows($cek) > 0){
|
||||
|
||||
echo "
|
||||
<script>
|
||||
alert('Username sudah digunakan');
|
||||
window.location='register_cs.php';
|
||||
</script>
|
||||
";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
$password_hash = password_hash(
|
||||
$password,
|
||||
PASSWORD_DEFAULT
|
||||
);
|
||||
|
||||
mysqli_query(
|
||||
$conn,
|
||||
"INSERT INTO users
|
||||
(
|
||||
nama,
|
||||
username,
|
||||
password,
|
||||
role
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
'$nama',
|
||||
'$username',
|
||||
'$password_hash',
|
||||
'cs'
|
||||
)"
|
||||
);
|
||||
|
||||
$user_id = mysqli_insert_id($conn);
|
||||
|
||||
mysqli_query(
|
||||
$conn,
|
||||
"INSERT INTO cs_rumah_ibadah
|
||||
(
|
||||
nama,
|
||||
rumah_ibadah_id,
|
||||
no_hp,
|
||||
user_id
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
'$nama',
|
||||
'$rumah_ibadah_id',
|
||||
'$no_hp',
|
||||
'$user_id'
|
||||
)"
|
||||
);
|
||||
|
||||
echo "
|
||||
<script>
|
||||
alert('Registrasi CS berhasil');
|
||||
window.location='index.php';
|
||||
</script>
|
||||
";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
|
||||
<title>Register CS Rumah Ibadah</title>
|
||||
|
||||
<meta charset="utf-8">
|
||||
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body
|
||||
class="min-h-screen bg-gradient-to-br from-green-600 via-emerald-500 to-teal-500 flex items-center justify-center p-5">
|
||||
|
||||
|
||||
<div class="w-full max-w-lg">
|
||||
|
||||
<div class="bg-white rounded-3xl shadow-2xl overflow-hidden">
|
||||
|
||||
<div class="bg-green-600 text-white p-8 text-center">
|
||||
|
||||
<i class="fas fa-hand-holding-heart text-5xl mb-4"></i>
|
||||
|
||||
<h1 class="text-3xl font-bold">
|
||||
Register CS
|
||||
</h1>
|
||||
|
||||
<p class="mt-2 text-green-100">
|
||||
Daftarkan Customer Service Rumah Ibadah
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<form method="POST" class="p-8 space-y-5">
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Nama Lengkap
|
||||
</label>
|
||||
|
||||
<input type="text" name="nama" required placeholder="Masukkan nama lengkap"
|
||||
class="w-full border rounded-xl p-3 focus:ring-2 focus:ring-green-500 focus:outline-none">
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Rumah Ibadah
|
||||
</label>
|
||||
|
||||
<select name="rumah_ibadah_id" required
|
||||
class="w-full border rounded-xl p-3 focus:ring-2 focus:ring-green-500 focus:outline-none">
|
||||
|
||||
<option value="">
|
||||
-- Pilih Rumah Ibadah --
|
||||
</option>
|
||||
|
||||
<?php while($r = mysqli_fetch_assoc($rumah_ibadah)){ ?>
|
||||
|
||||
<option value="<?= $r['id'] ?>">
|
||||
|
||||
<?= htmlspecialchars($r['nama']) ?>
|
||||
|
||||
</option>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Nomor HP
|
||||
</label>
|
||||
|
||||
<input type="text" name="no_hp" required placeholder="08xxxxxxxxxx"
|
||||
class="w-full border rounded-xl p-3 focus:ring-2 focus:ring-green-500 focus:outline-none">
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Username
|
||||
</label>
|
||||
|
||||
<input type="text" name="username" required placeholder="Masukkan username"
|
||||
class="w-full border rounded-xl p-3 focus:ring-2 focus:ring-green-500 focus:outline-none">
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Password
|
||||
</label>
|
||||
|
||||
<input type="password" name="password" required placeholder="Minimal 6 karakter"
|
||||
class="w-full border rounded-xl p-3 focus:ring-2 focus:ring-green-500 focus:outline-none">
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block text-sm font-medium text-gray-700 mb-2">
|
||||
Konfirmasi Password
|
||||
</label>
|
||||
|
||||
<input type="password" name="konfirmasi_password" required placeholder="Ulangi password"
|
||||
class="w-full border rounded-xl p-3 focus:ring-2 focus:ring-green-500 focus:outline-none">
|
||||
|
||||
</div>
|
||||
|
||||
<button type="submit" name="register"
|
||||
class="w-full bg-green-600 hover:bg-green-700 text-white py-3 rounded-xl font-semibold transition">
|
||||
|
||||
<i class="fas fa-user-plus mr-2"></i>
|
||||
|
||||
Daftar CS
|
||||
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
||||
<div class="px-8 pb-8 text-center">
|
||||
|
||||
<a href="index.php" class="text-green-600 hover:text-green-800 font-medium">
|
||||
|
||||
<i class="fas fa-arrow-left mr-1"></i>
|
||||
|
||||
Kembali ke Login
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,242 @@
|
||||
<?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 = intval($_SESSION['id']);
|
||||
|
||||
$total = mysqli_num_rows(
|
||||
|
||||
mysqli_query($conn,
|
||||
|
||||
"SELECT * FROM laporan
|
||||
WHERE pelapor_id='$id'")
|
||||
|
||||
);
|
||||
|
||||
$pending = mysqli_num_rows(
|
||||
|
||||
mysqli_query($conn,
|
||||
|
||||
"SELECT * FROM laporan
|
||||
|
||||
WHERE pelapor_id='$id'
|
||||
AND status='pending'")
|
||||
|
||||
);
|
||||
|
||||
$disetujui = mysqli_num_rows(
|
||||
|
||||
mysqli_query($conn,
|
||||
|
||||
"SELECT * FROM laporan
|
||||
|
||||
WHERE pelapor_id='$id'
|
||||
AND status='disetujui'")
|
||||
|
||||
);
|
||||
|
||||
$diproses = mysqli_num_rows(
|
||||
|
||||
mysqli_query($conn,
|
||||
|
||||
"SELECT * FROM laporan
|
||||
|
||||
WHERE pelapor_id='$id'
|
||||
AND status='diproses'")
|
||||
|
||||
);
|
||||
|
||||
$selesai = mysqli_num_rows(
|
||||
|
||||
mysqli_query($conn,
|
||||
|
||||
"SELECT * FROM laporan
|
||||
|
||||
WHERE pelapor_id='$id'
|
||||
AND status='selesai'")
|
||||
|
||||
);
|
||||
|
||||
$ditolak = mysqli_num_rows(
|
||||
|
||||
mysqli_query($conn,
|
||||
|
||||
"SELECT * FROM laporan
|
||||
|
||||
WHERE pelapor_id='$id'
|
||||
AND status='ditolak'")
|
||||
|
||||
);
|
||||
|
||||
$persentase = 0;
|
||||
|
||||
if($total > 0){
|
||||
$persentase = round(($selesai/$total)*100);
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<title>Dashboard Warga</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" />
|
||||
|
||||
</head>
|
||||
|
||||
<body class="bg-slate-100 min-h-screen">
|
||||
|
||||
<!-- NAVBAR -->
|
||||
<nav class="bg-slate-800 text-white shadow">
|
||||
|
||||
<div class="max-w-7xl mx-auto px-4 py-4 flex flex-col md:flex-row justify-between items-center gap-3">
|
||||
|
||||
<h2 class="font-bold text-xl">
|
||||
WebGIS Kemiskinan
|
||||
</h2>
|
||||
|
||||
<div class="flex flex-col sm:flex-row items-center gap-3">
|
||||
|
||||
<span>
|
||||
Halo,
|
||||
<?= htmlspecialchars($_SESSION['nama']) ?>
|
||||
</span>
|
||||
|
||||
<a href="../logout.php" onclick="return confirm('Logout sekarang?');"
|
||||
class="bg-red-500 hover:bg-red-600 px-4 py-2 rounded-lg transition">
|
||||
|
||||
Logout
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
|
||||
<!-- CONTENT -->
|
||||
<div class="max-w-7xl mx-auto p-6">
|
||||
|
||||
<!-- HERO -->
|
||||
<div class="bg-gradient-to-r from-cyan-600 to-blue-600 text-white rounded-3xl p-8 shadow-lg">
|
||||
|
||||
<h1 class="text-3xl font-bold">
|
||||
Selamat Datang 👋
|
||||
<?= htmlspecialchars($_SESSION['nama']) ?>
|
||||
</h1>
|
||||
|
||||
<p class="mt-3 text-cyan-100">
|
||||
Laporkan kondisi warga yang membutuhkan bantuan sosial
|
||||
di sekitar lingkungan Anda.
|
||||
</p>
|
||||
|
||||
<div class="flex flex-col sm:flex-row gap-3 mt-6">
|
||||
|
||||
<a href="laporan.php"
|
||||
class="bg-white text-blue-600 font-semibold px-6 py-3 rounded-xl shadow hover:shadow-lg transition">
|
||||
|
||||
<i class="fa-solid fa-plus mr-2"></i>
|
||||
Buat Laporan
|
||||
|
||||
</a>
|
||||
|
||||
<a href="status.php"
|
||||
class="bg-slate-800 text-white font-semibold px-6 py-3 rounded-xl shadow hover:bg-slate-900 transition">
|
||||
|
||||
<i class="fa-solid fa-list-check mr-2"></i>
|
||||
Lihat Laporan
|
||||
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<div class="bg-white rounded-2xl shadow p-6 mt-6">
|
||||
|
||||
<p class="font-semibold">
|
||||
Progress Bantuan
|
||||
</p>
|
||||
|
||||
<div class="w-full bg-slate-200 rounded-full h-4 mt-3">
|
||||
|
||||
<div class="bg-green-500 h-4 rounded-full" style="width: <?= $persentase ?>%">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<p class="mt-2 text-sm text-slate-500">
|
||||
<?= $persentase ?>% laporan telah selesai
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- CARDS -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-6 mt-8">
|
||||
|
||||
<!-- Total -->
|
||||
<div class="bg-white rounded-2xl shadow p-6">
|
||||
<i class="fa-solid fa-file text-4xl text-blue-600"></i>
|
||||
<p class="text-slate-500 mt-3">Total Laporan</p>
|
||||
<h2 class="text-4xl font-bold"><?= $total ?></h2>
|
||||
</div>
|
||||
|
||||
<!-- Pending -->
|
||||
<div class="bg-white rounded-2xl shadow p-6">
|
||||
<i class="fa-solid fa-clock text-4xl text-yellow-500"></i>
|
||||
<p class="text-slate-500 mt-3">Pending</p>
|
||||
<h2 class="text-4xl font-bold"><?= $pending ?></h2>
|
||||
</div>
|
||||
|
||||
<!-- Disetujui -->
|
||||
<div class="bg-white rounded-2xl shadow p-6">
|
||||
<i class="fa-solid fa-circle-check text-4xl text-green-500"></i>
|
||||
<p class="text-slate-500 mt-3">Disetujui</p>
|
||||
<h2 class="text-4xl font-bold"><?= $disetujui ?></h2>
|
||||
</div>
|
||||
|
||||
<!-- Diproses -->
|
||||
<div class="bg-white rounded-2xl shadow p-6">
|
||||
<i class="fa-solid fa-spinner animate-spin text-4xl text-blue-500"></i>
|
||||
<p class="text-slate-500 mt-3">Diproses</p>
|
||||
<h2 class="text-4xl font-bold"><?= $diproses ?></h2>
|
||||
</div>
|
||||
|
||||
<!-- Selesai -->
|
||||
<div class="bg-white rounded-2xl shadow p-6">
|
||||
<i class="fa-solid fa-hand-holding-heart text-4xl text-purple-500"></i>
|
||||
<p class="text-slate-500 mt-3">Selesai</p>
|
||||
<h2 class="text-4xl font-bold"><?= $selesai ?></h2>
|
||||
</div>
|
||||
|
||||
<!-- Ditolak -->
|
||||
<div class="bg-white rounded-2xl shadow p-6">
|
||||
<i class="fa-solid fa-circle-xmark text-4xl text-red-500"></i>
|
||||
<p class="text-slate-500 mt-3">Ditolak</p>
|
||||
<h2 class="text-4xl font-bold"><?= $ditolak ?></h2>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
if(!isset($_SESSION['role'])){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($_SESSION['role'] != 'warga'){
|
||||
|
||||
header("Location: ../index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
||||
<title>Buat Laporan</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
|
||||
|
||||
</head>
|
||||
|
||||
<body class="bg-slate-100 min-h-screen">
|
||||
|
||||
|
||||
<div class="max-w-5xl 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-4 py-3 rounded-xl shadow">
|
||||
|
||||
← Kembali ke Dashboard
|
||||
|
||||
</a>
|
||||
|
||||
<div class="bg-white rounded-3xl shadow-lg p-8 mt-6">
|
||||
|
||||
<div class="mb-8">
|
||||
|
||||
<h1 class="text-3xl font-bold text-slate-800">
|
||||
Buat Laporan Warga
|
||||
</h1>
|
||||
|
||||
<p class="text-slate-500 mt-2">
|
||||
Isi data warga yang membutuhkan bantuan sosial dan pilih lokasi pada peta.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
<form action="simpan_laporan.php" method="POST" enctype="multipart/form-data" class="space-y-5">
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block mb-2 font-medium text-slate-700">
|
||||
Nama Warga
|
||||
</label>
|
||||
|
||||
<input type="text" name="nama_warga" required
|
||||
class="w-full border rounded-xl px-4 py-3 focus:ring-2 focus:ring-blue-500 focus:outline-none">
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block mb-2 font-medium text-slate-700">
|
||||
Alamat
|
||||
</label>
|
||||
|
||||
<textarea name="alamat" rows="3" required
|
||||
class="w-full border rounded-xl px-4 py-3 focus:ring-2 focus:ring-blue-500 focus:outline-none"></textarea>
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block mb-2 font-medium text-slate-700">
|
||||
Kondisi Warga
|
||||
</label>
|
||||
|
||||
<textarea name="kondisi" rows="4" required
|
||||
class="w-full border rounded-xl px-4 py-3 focus:ring-2 focus:ring-blue-500 focus:outline-none"></textarea>
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block mb-2 font-medium text-slate-700">
|
||||
Foto Kondisi Warga
|
||||
</label>
|
||||
|
||||
<input type="file" name="foto" accept="image/*" required class="w-full border rounded-xl px-4 py-3">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="grid md:grid-cols-2 gap-4">
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block mb-2 font-medium text-slate-700">
|
||||
Latitude
|
||||
</label>
|
||||
|
||||
<input type="text" name="latitude" id="latitude" readonly required
|
||||
class="w-full border rounded-xl px-4 py-3 bg-slate-100">
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block mb-2 font-medium text-slate-700">
|
||||
Longitude
|
||||
</label>
|
||||
|
||||
<input type="text" name="longitude" id="longitude" readonly required
|
||||
class="w-full border rounded-xl px-4 py-3 bg-slate-100">
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
<label class="block mb-3 font-medium text-slate-700">
|
||||
Pilih Lokasi Pada Peta
|
||||
</label>
|
||||
|
||||
<p class="text-sm text-slate-500 mb-3">
|
||||
Klik pada peta untuk menentukan lokasi warga.
|
||||
</p>
|
||||
|
||||
<div id="map" style="height:450px;" class="rounded-2xl border">
|
||||
</div>
|
||||
|
||||
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
|
||||
|
||||
<script>
|
||||
var map = L.map('map').setView(
|
||||
[-0.0263, 109.3425],
|
||||
11
|
||||
);
|
||||
|
||||
L.tileLayer(
|
||||
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19
|
||||
}
|
||||
).addTo(map);
|
||||
|
||||
var marker;
|
||||
|
||||
map.on('click', function(e) {
|
||||
|
||||
var lat = e.latlng.lat.toFixed(6);
|
||||
var lng = e.latlng.lng.toFixed(6);
|
||||
|
||||
document.getElementById('latitude').value = lat;
|
||||
document.getElementById('longitude').value = lng;
|
||||
|
||||
if (marker) {
|
||||
map.removeLayer(marker);
|
||||
}
|
||||
|
||||
marker = L.marker([lat, lng])
|
||||
.addTo(map)
|
||||
.bindPopup(
|
||||
"Lat: " + lat +
|
||||
"<br>Lng: " + lng
|
||||
)
|
||||
.openPopup();
|
||||
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
map.invalidateSize();
|
||||
}, 200);
|
||||
</script>
|
||||
|
||||
</div>
|
||||
|
||||
<button type="submit"
|
||||
class="w-full md:w-auto bg-blue-600 hover:bg-blue-700 text-white px-8 py-3 rounded-xl font-semibold shadow">
|
||||
|
||||
Kirim Laporan
|
||||
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,106 @@
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #f8fafc;
|
||||
font-family: 'Segoe UI', sans-serif;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
/* CARD */
|
||||
|
||||
.card {
|
||||
background: white;
|
||||
border-radius: 16px;
|
||||
padding: 25px;
|
||||
box-shadow:
|
||||
0 4px 20px rgba(0, 0, 0, .08);
|
||||
transition: .3s;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
transform: translateY(-5px);
|
||||
}
|
||||
|
||||
/* TABLE */
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
background: white;
|
||||
border-radius: 15px;
|
||||
overflow: hidden;
|
||||
box-shadow:
|
||||
0 4px 20px rgba(0, 0, 0, .08);
|
||||
}
|
||||
|
||||
th {
|
||||
background: #2563eb;
|
||||
color: white;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: 14px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
/* BUTTON */
|
||||
|
||||
.btn {
|
||||
padding: 10px 16px;
|
||||
border-radius: 10px;
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.approve {
|
||||
background: #16a34a;
|
||||
}
|
||||
|
||||
.reject {
|
||||
background: #dc2626;
|
||||
}
|
||||
|
||||
.delete {
|
||||
background: #64748b;
|
||||
}
|
||||
|
||||
.warning {
|
||||
background: #f59e0b;
|
||||
}
|
||||
|
||||
/* INPUT */
|
||||
|
||||
input,
|
||||
select,
|
||||
textarea {
|
||||
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
|
||||
border: 1px solid #ddd;
|
||||
|
||||
border-radius: 10px;
|
||||
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
/* BOX */
|
||||
|
||||
.box {
|
||||
background: white;
|
||||
padding: 25px;
|
||||
border-radius: 20px;
|
||||
box-shadow:
|
||||
0 4px 20px rgba(0, 0, 0, .08);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
include '../config/koneksi.php';
|
||||
|
||||
$pelapor_id = $_SESSION['id'];
|
||||
|
||||
$nama_warga = mysqli_real_escape_string(
|
||||
$conn,
|
||||
$_POST['nama_warga']
|
||||
);
|
||||
|
||||
$alamat = mysqli_real_escape_string(
|
||||
$conn,
|
||||
$_POST['alamat']
|
||||
);
|
||||
|
||||
$kondisi = mysqli_real_escape_string(
|
||||
$conn,
|
||||
$_POST['kondisi']
|
||||
);
|
||||
|
||||
$latitude = floatval($_POST['latitude']);
|
||||
$longitude = floatval($_POST['longitude']);
|
||||
|
||||
/* FOTO */
|
||||
$foto =
|
||||
time().'_'.
|
||||
basename($_FILES['foto']['name']);
|
||||
|
||||
$tmp = $_FILES['foto']['tmp_name'];
|
||||
|
||||
$ext = strtolower(
|
||||
pathinfo(
|
||||
$foto,
|
||||
PATHINFO_EXTENSION
|
||||
)
|
||||
);
|
||||
|
||||
$allowed = [
|
||||
'jpg',
|
||||
'jpeg',
|
||||
'png',
|
||||
'webp'
|
||||
];
|
||||
|
||||
if(!in_array($ext,$allowed)){
|
||||
|
||||
echo "
|
||||
<script>
|
||||
alert('Format foto harus JPG, PNG, atau WEBP');
|
||||
history.back();
|
||||
</script>
|
||||
";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
if(!move_uploaded_file(
|
||||
$tmp,
|
||||
"../assets/uploads/".$foto
|
||||
)){
|
||||
die("Upload foto gagal");
|
||||
}
|
||||
/* INSERT */
|
||||
|
||||
mysqli_query($conn,
|
||||
|
||||
"INSERT INTO laporan
|
||||
|
||||
(
|
||||
pelapor_id,
|
||||
nama_warga,
|
||||
alamat,
|
||||
latitude,
|
||||
longitude,
|
||||
kondisi,
|
||||
foto,
|
||||
status
|
||||
)
|
||||
|
||||
VALUES
|
||||
|
||||
(
|
||||
'$pelapor_id',
|
||||
'$nama_warga',
|
||||
'$alamat',
|
||||
'$latitude',
|
||||
'$longitude',
|
||||
'$kondisi',
|
||||
'$foto',
|
||||
'pending'
|
||||
)"
|
||||
|
||||
);
|
||||
|
||||
echo "
|
||||
<script>
|
||||
alert('Laporan berhasil dikirim');
|
||||
window.location='dashboard.php';
|
||||
</script>
|
||||
";
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,224 @@
|
||||
<?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>
|
||||
Reference in New Issue
Block a user