feat: add database dump, backup script, dashboard and address feature
This commit is contained in:
@@ -0,0 +1,458 @@
|
||||
<?php
|
||||
include 'koneksi.php';
|
||||
|
||||
// Fetch SPBU
|
||||
$spbu_data = [];
|
||||
$res = $conn->query("SELECT * FROM spbu");
|
||||
if ($res) {
|
||||
while($row = $res->fetch_assoc()) {
|
||||
$spbu_data[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch Jalan
|
||||
$jalan_data = [];
|
||||
$res = $conn->query("SELECT * FROM jalan");
|
||||
if ($res) {
|
||||
while($row = $res->fetch_assoc()) {
|
||||
$jalan_data[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch Parsil
|
||||
$parsil_data = [];
|
||||
$res = $conn->query("SELECT * FROM parsil_tanah");
|
||||
if ($res) {
|
||||
while($row = $res->fetch_assoc()) {
|
||||
$parsil_data[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
$conn->close();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Dashboard Data - WebGIS</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
:root {
|
||||
--blue: #2563EB;
|
||||
--blue-d: #1D4ED8;
|
||||
--blue-l: #EFF6FF;
|
||||
--navy: #1E293B; /* softer navy */
|
||||
--navy-d: #0F172A;
|
||||
--green: #10B981;
|
||||
--green-d: #059669;
|
||||
--green-l: #ECFDF5;
|
||||
--red: #EF4444;
|
||||
--amber: #F59E0B;
|
||||
--surface: #FFFFFF;
|
||||
--border: #E2E8F0;
|
||||
--border-l:#F1F5F9;
|
||||
--text-2: #475569;
|
||||
--text-3: #94A3B8;
|
||||
--r: 16px;
|
||||
--r2: 12px;
|
||||
--r3: 8px;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body {
|
||||
font-family: 'Plus Jakarta Sans', sans-serif;
|
||||
background: #F8FAFC;
|
||||
min-height: 100vh;
|
||||
color: var(--navy-d);
|
||||
padding-top: 80px; /* space for navbar */
|
||||
}
|
||||
|
||||
/* ── NAVBAR ── */
|
||||
#navbar {
|
||||
position: fixed;
|
||||
top: 0; left: 0; right: 0;
|
||||
height: 56px;
|
||||
z-index: 1200;
|
||||
background: rgba(255,255,255,0.92);
|
||||
backdrop-filter: blur(24px);
|
||||
border-bottom: 1px solid rgba(226,232,240,0.7);
|
||||
box-shadow: 0 1px 16px rgba(15,23,42,0.08);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 16px;
|
||||
}
|
||||
.nav-brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 9px;
|
||||
text-decoration: none;
|
||||
}
|
||||
.nav-brand-logo {
|
||||
width: 32px; height: 32px;
|
||||
border-radius: 9px;
|
||||
background: linear-gradient(135deg, var(--navy), var(--navy-d));
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
box-shadow: 0 2px 8px rgba(15,23,42,0.2);
|
||||
}
|
||||
.nav-brand-text {
|
||||
font-size: 14px;
|
||||
font-weight: 800;
|
||||
color: var(--navy-d);
|
||||
letter-spacing: -0.3px;
|
||||
}
|
||||
.nav-link {
|
||||
text-decoration: none;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
color: var(--navy-d);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 8px 12px;
|
||||
border-radius: 8px;
|
||||
transition: all 0.2s;
|
||||
background: white;
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
.nav-link:hover {
|
||||
background: var(--border-l);
|
||||
color: var(--navy-d);
|
||||
}
|
||||
|
||||
/* ── DASHBOARD CONTAINER ── */
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 20px 40px;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
.page-title {
|
||||
font-size: 28px;
|
||||
font-weight: 800;
|
||||
letter-spacing: -0.5px;
|
||||
margin-bottom: 8px;
|
||||
color: var(--navy-d);
|
||||
}
|
||||
.page-subtitle {
|
||||
color: var(--text-2);
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* ── TABS ── */
|
||||
.tabs {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-bottom: 24px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
.tab-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 10px 16px;
|
||||
font-family: inherit;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: var(--text-3);
|
||||
cursor: pointer;
|
||||
border-radius: var(--r2);
|
||||
transition: all 0.2s;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
.tab-btn:hover {
|
||||
color: var(--navy-d);
|
||||
background: var(--border-l);
|
||||
}
|
||||
.tab-btn.active {
|
||||
color: white;
|
||||
background: var(--navy);
|
||||
box-shadow: 0 2px 8px rgba(15,23,42,0.15);
|
||||
}
|
||||
.tab-icon {
|
||||
width: 18px; height: 18px;
|
||||
}
|
||||
|
||||
/* ── TABLE ── */
|
||||
.table-container {
|
||||
background: white;
|
||||
border-radius: var(--r);
|
||||
box-shadow: 0 4px 24px rgba(15,23,42,0.06);
|
||||
border: 1px solid var(--border-l);
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
overflow-x: auto;
|
||||
}
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
text-align: left;
|
||||
font-size: 13px;
|
||||
}
|
||||
th {
|
||||
background: var(--navy);
|
||||
padding: 14px 20px;
|
||||
font-weight: 800;
|
||||
color: white;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
font-size: 11px;
|
||||
border-bottom: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
td {
|
||||
padding: 14px 20px;
|
||||
border-bottom: 1px solid var(--border-l);
|
||||
color: var(--navy-d);
|
||||
font-weight: 500;
|
||||
vertical-align: middle;
|
||||
}
|
||||
/* Striped Rows */
|
||||
tr:nth-child(even) td {
|
||||
background-color: #F8FAFC;
|
||||
}
|
||||
tr:nth-child(odd) td {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
tr:hover td {
|
||||
background-color: #F1F5F9 !important;
|
||||
}
|
||||
tr:last-child td {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
/* Badges */
|
||||
.badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 4px 10px;
|
||||
border-radius: 20px;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
.badge.green { background: var(--green-l); color: var(--green-d); }
|
||||
.badge.red { background: #FEF2F2; color: var(--red); }
|
||||
.badge.blue { background: var(--blue-l); color: var(--blue-d); }
|
||||
.badge.amber { background: #FFFBEB; color: #D97706; }
|
||||
|
||||
.btn-map {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 6px 12px;
|
||||
border-radius: 6px;
|
||||
background: var(--blue);
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
transition: all 0.2s;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.btn-map:hover {
|
||||
background: var(--blue-d);
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
padding: 40px;
|
||||
text-align: center;
|
||||
color: var(--text-3);
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* TAB CONTENT */
|
||||
.tab-pane {
|
||||
display: none;
|
||||
animation: fadeIn 0.3s ease;
|
||||
}
|
||||
.tab-pane.active {
|
||||
display: block;
|
||||
}
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; transform: translateY(10px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- NAVBAR -->
|
||||
<nav id="navbar">
|
||||
<div class="nav-brand">
|
||||
<div class="nav-brand-logo">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><rect x="7" y="7" width="3" height="9"></rect><rect x="14" y="7" width="3" height="5"></rect>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="nav-brand-text">Dashboard WebGIS</div>
|
||||
</div>
|
||||
<a href="index.php" class="nav-link">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline>
|
||||
</svg>
|
||||
Kembali ke Peta
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
<div class="container">
|
||||
<div class="page-header">
|
||||
<h1 class="page-title">Data Overview</h1>
|
||||
<p class="page-subtitle">Kelola dan tinjau semua data aset SPBU, jaringan jalan, dan parsil tanah yang terdaftar pada sistem.</p>
|
||||
</div>
|
||||
|
||||
<!-- TABS -->
|
||||
<div class="tabs">
|
||||
<button class="tab-btn active" onclick="openTab('tab-spbu')">
|
||||
<svg class="tab-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z"></path><circle cx="12" cy="10" r="3"></circle></svg>
|
||||
Data SPBU (<?= count($spbu_data) ?>)
|
||||
</button>
|
||||
<button class="tab-btn" onclick="openTab('tab-jalan')">
|
||||
<svg class="tab-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18M3 12h18M3 18h18"/></svg>
|
||||
Data Jalan (<?= count($jalan_data) ?>)
|
||||
</button>
|
||||
<button class="tab-btn" onclick="openTab('tab-parsil')">
|
||||
<svg class="tab-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="3 6 9 3 15 6 21 3 21 18 15 21 9 18 3 21"></polygon></svg>
|
||||
Data Parsil (<?= count($parsil_data) ?>)
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- SPBU TAB -->
|
||||
<div id="tab-spbu" class="tab-pane active">
|
||||
<div class="table-container">
|
||||
<?php if(count($spbu_data) > 0): ?>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Nama SPBU</th>
|
||||
<th>Pengelola</th>
|
||||
<th>Kontak</th>
|
||||
<th>Alamat Lengkap</th>
|
||||
<th>Status</th>
|
||||
<th>Aksi</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($spbu_data as $row):
|
||||
$is24 = (trim($row['buka_24jam']) === 'Ya');
|
||||
?>
|
||||
<tr>
|
||||
<td style="color:var(--text-3); font-weight:700;">#<?= $row['id'] ?></td>
|
||||
<td><b><?= htmlspecialchars($row['nama_spbu']) ?></b></td>
|
||||
<td><?= htmlspecialchars($row['nama_pengelola'] ? $row['nama_pengelola'] : '-') ?></td>
|
||||
<td><?= htmlspecialchars($row['no_wa']) ?></td>
|
||||
<td style="max-width: 250px; white-space: normal; line-height: 1.4;"><?= htmlspecialchars($row['alamat_lengkap'] ? $row['alamat_lengkap'] : '-') ?></td>
|
||||
<td>
|
||||
<?php if($is24): ?>
|
||||
<span class="badge green">Buka 24 Jam</span>
|
||||
<?php else: ?>
|
||||
<span class="badge red">Tutup Malam</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<a href="index.php?lat=<?= $row['lat'] ?>&lng=<?= $row['lng'] ?>&zoom=18" class="btn-map">
|
||||
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z"></path><circle cx="12" cy="10" r="3"></circle></svg>
|
||||
Lihat di Peta
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else: ?>
|
||||
<div class="empty-state">Belum ada data SPBU tersimpan.</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- JALAN TAB -->
|
||||
<div id="tab-jalan" class="tab-pane">
|
||||
<div class="table-container">
|
||||
<?php if(count($jalan_data) > 0): ?>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Nama Jalan</th>
|
||||
<th>Status Jalan</th>
|
||||
<th>Panjang</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($jalan_data as $row):
|
||||
$badgeClass = 'amber';
|
||||
if($row['status_jalan'] == 'Nasional') $badgeClass = 'red';
|
||||
else if($row['status_jalan'] == 'Provinsi') $badgeClass = 'blue';
|
||||
else if($row['status_jalan'] == 'Kabupaten') $badgeClass = 'green';
|
||||
?>
|
||||
<tr>
|
||||
<td style="color:var(--text-3); font-weight:700;">#<?= $row['id'] ?></td>
|
||||
<td><b><?= htmlspecialchars($row['nama_jalan']) ?></b></td>
|
||||
<td><span class="badge <?= $badgeClass ?>"><?= htmlspecialchars($row['status_jalan']) ?></span></td>
|
||||
<td><?= htmlspecialchars($row['panjang_jalan']) ?> m</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else: ?>
|
||||
<div class="empty-state">Belum ada data Jalan tersimpan.</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- PARSIL TAB -->
|
||||
<div id="tab-parsil" class="tab-pane">
|
||||
<div class="table-container">
|
||||
<?php if(count($parsil_data) > 0): ?>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Status Kepemilikan</th>
|
||||
<th>Luas Tanah</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($parsil_data as $row): ?>
|
||||
<tr>
|
||||
<td style="color:var(--text-3); font-weight:700;">#<?= $row['id'] ?></td>
|
||||
<td><b><?= htmlspecialchars($row['status_kepemilikan']) ?></b></td>
|
||||
<td><?= htmlspecialchars($row['luas_tanah']) ?> m²</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else: ?>
|
||||
<div class="empty-state">Belum ada data Parsil Tanah tersimpan.</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function openTab(tabId) {
|
||||
// Hide all tab panes
|
||||
document.querySelectorAll('.tab-pane').forEach(el => el.classList.remove('active'));
|
||||
// Remove active class from all tab buttons
|
||||
document.querySelectorAll('.tab-btn').forEach(el => el.classList.remove('active'));
|
||||
|
||||
// Show selected tab
|
||||
document.getElementById(tabId).classList.add('active');
|
||||
// Add active class to clicked button
|
||||
event.currentTarget.classList.add('active');
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
include 'koneksi.php';
|
||||
$sql = "ALTER TABLE spbu ADD COLUMN nama_pengelola VARCHAR(255) DEFAULT '';";
|
||||
$sql = "ALTER TABLE spbu ADD COLUMN alamat_lengkap TEXT DEFAULT NULL;";
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo "Sukses_DB";
|
||||
} else {
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
box-shadow: 0 1px 16px rgba(15,23,42,0.08);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 16px;
|
||||
}
|
||||
.nav-brand {
|
||||
@@ -75,6 +76,23 @@
|
||||
color: var(--navy);
|
||||
letter-spacing: -0.3px;
|
||||
}
|
||||
.nav-link {
|
||||
text-decoration: none;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
color: var(--blue);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 8px 12px;
|
||||
border-radius: 8px;
|
||||
transition: all 0.2s;
|
||||
background: var(--blue-l);
|
||||
}
|
||||
.nav-link:hover {
|
||||
background: var(--blue);
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* ── MAP ── */
|
||||
#map {
|
||||
@@ -382,6 +400,12 @@
|
||||
</div>
|
||||
<div class="nav-brand-text">WebGIS SPBU & Parsil Tanah</div>
|
||||
</a>
|
||||
<a href="dashboard.php" class="nav-link">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><rect x="7" y="7" width="3" height="9"></rect><rect x="14" y="7" width="3" height="5"></rect>
|
||||
</svg>
|
||||
Dashboard Data
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
<div id="map"></div>
|
||||
@@ -572,6 +596,10 @@
|
||||
<label>No. Whatsapp</label>
|
||||
<input type="text" id="no_wa" placeholder="Contoh: 0812..." required>
|
||||
</div>
|
||||
<div class="ff">
|
||||
<label>Alamat Lengkap</label>
|
||||
<input type="text" id="alamat_lengkap" placeholder="Masukkan alamat lengkap" required>
|
||||
</div>
|
||||
<div class="ff" style="margin-bottom:0;">
|
||||
<label>Buka 24 Jam?</label>
|
||||
<select id="buka_24jam">
|
||||
@@ -596,10 +624,12 @@
|
||||
let pengelola = document.getElementById('nama_pengelola').value;
|
||||
let wa = document.getElementById('no_wa').value;
|
||||
let jam = document.getElementById('buka_24jam').value;
|
||||
if (!nama || !pengelola || !wa || jam === "") { alert("Harap isi semua data termasuk status 24 jam!"); return; }
|
||||
let alamat = document.getElementById('alamat_lengkap').value;
|
||||
if (!nama || !pengelola || !wa || !alamat || jam === "") { alert("Harap isi semua data!"); return; }
|
||||
|
||||
let fd = new FormData();
|
||||
fd.append('nama_spbu', nama); fd.append('nama_pengelola', pengelola); fd.append('no_wa', wa);
|
||||
fd.append('alamat_lengkap', alamat);
|
||||
fd.append('buka_24jam', jam); fd.append('lat', tempLatLng.lat); fd.append('lng', tempLatLng.lng);
|
||||
|
||||
let btn = document.querySelector('.btn-sv.g');
|
||||
@@ -631,12 +661,19 @@
|
||||
<div class="lp-su">Kontak: ${spbu.no_wa}</div>
|
||||
</div>
|
||||
<div class="lp-bd">
|
||||
Alamat: ${spbu.alamat_lengkap || '-'}<br>
|
||||
Status: <b>${is24 ? '<span style="color:#10B981;">Buka 24 Jam</span>' : '<span style="color:#EF4444;">Tutup Malam</span>'}</b><br>
|
||||
<i style="font-size:10px; color:#94A3B8; display:block; margin-top:8px;">Geser pin untuk mengubah lokasi koordinat.</i>
|
||||
</div>
|
||||
<div class="lp-btns" style="display:flex; gap:6px;">
|
||||
<button class="btn-sv w" onclick="bukaFormEdit(${spbu.id})">Edit</button>
|
||||
<button class="btn-sv r" onclick="hapusSPBU(${spbu.id})">Hapus</button>
|
||||
<div class="lp-btns" style="display:flex; flex-direction: column; gap:6px;">
|
||||
<button class="btn-sv b" onclick="window.open('https://www.google.com/maps/dir/?api=1&destination=${spbu.lat},${spbu.lng}', '_blank')">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="3 11 22 2 13 21 11 13 3 11"></polygon></svg>
|
||||
Rute ke SPBU
|
||||
</button>
|
||||
<div style="display:flex; gap:6px;">
|
||||
<button class="btn-sv w" onclick="bukaFormEdit(${spbu.id})">Edit</button>
|
||||
<button class="btn-sv r" onclick="hapusSPBU(${spbu.id})">Hapus</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -657,6 +694,10 @@
|
||||
<label>No. Whatsapp</label>
|
||||
<input type="text" id="edit_wa_${spbu.id}" value="${spbu.no_wa}">
|
||||
</div>
|
||||
<div class="ff">
|
||||
<label>Alamat Lengkap</label>
|
||||
<input type="text" id="edit_alamat_${spbu.id}" value="${spbu.alamat_lengkap || ''}">
|
||||
</div>
|
||||
<div class="ff" style="margin-bottom:0;">
|
||||
<label>Buka 24 Jam?</label>
|
||||
<select id="edit_jam_${spbu.id}">
|
||||
@@ -701,6 +742,7 @@
|
||||
fd.append('nama_spbu', document.getElementById(`edit_nama_${id}`).value);
|
||||
fd.append('nama_pengelola', document.getElementById(`edit_pengelola_${id}`).value);
|
||||
fd.append('no_wa', document.getElementById(`edit_wa_${id}`).value);
|
||||
fd.append('alamat_lengkap', document.getElementById(`edit_alamat_${id}`).value);
|
||||
fd.append('buka_24jam', document.getElementById(`edit_jam_${id}`).value);
|
||||
|
||||
fetch('update.php', { method: 'POST', body: fd })
|
||||
@@ -1105,6 +1147,46 @@
|
||||
muatDataSPBU();
|
||||
muatDataJalan();
|
||||
muatDataKavling();
|
||||
|
||||
// ============================================================
|
||||
// FOCUS PETA DARI URL PARAMETERS
|
||||
// ============================================================
|
||||
window.addEventListener('load', function() {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const focusLat = urlParams.get('lat');
|
||||
const focusLng = urlParams.get('lng');
|
||||
const focusZoom = urlParams.get('zoom') || 17;
|
||||
|
||||
if (focusLat && focusLng) {
|
||||
let lat = parseFloat(focusLat);
|
||||
let lng = parseFloat(focusLng);
|
||||
map.setView([lat, lng], parseInt(focusZoom));
|
||||
|
||||
// Tambahkan marker sementara untuk menyorot lokasi
|
||||
let highlight = L.circleMarker([lat, lng], {
|
||||
radius: 30,
|
||||
color: '#F59E0B',
|
||||
fillColor: '#FCD34D',
|
||||
fillOpacity: 0.4,
|
||||
weight: 2
|
||||
}).addTo(map);
|
||||
|
||||
// Animate pulse
|
||||
let size = 30;
|
||||
let growing = true;
|
||||
let pulseInterval = setInterval(() => {
|
||||
if (growing) { size += 1; if(size >= 40) growing = false; }
|
||||
else { size -= 1; if(size <= 30) growing = true; }
|
||||
highlight.setRadius(size);
|
||||
}, 50);
|
||||
|
||||
// Hapus marker highlight setelah 5 detik
|
||||
setTimeout(() => {
|
||||
clearInterval(pulseInterval);
|
||||
map.removeLayer(highlight);
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -6,11 +6,12 @@ if (isset($_POST['nama_spbu'])) {
|
||||
$pengelola = $_POST['nama_pengelola'];
|
||||
$wa = $_POST['no_wa'];
|
||||
$buka_24jam = $_POST['buka_24jam'];
|
||||
$alamat_lengkap = $_POST['alamat_lengkap'];
|
||||
$lat = $_POST['lat'];
|
||||
$lng = $_POST['lng'];
|
||||
|
||||
$sql = "INSERT INTO spbu (nama_spbu, nama_pengelola, no_wa, buka_24jam, lat, lng)
|
||||
VALUES ('$nama', '$pengelola', '$wa', '$buka_24jam', '$lat', '$lng')";
|
||||
$sql = "INSERT INTO spbu (nama_spbu, nama_pengelola, no_wa, buka_24jam, alamat_lengkap, lat, lng)
|
||||
VALUES ('$nama', '$pengelola', '$wa', '$buka_24jam', '$alamat_lengkap', '$lat', '$lng')";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo "Sukses";
|
||||
|
||||
@@ -7,9 +7,10 @@ $nama = $_POST['nama_spbu'];
|
||||
$pengelola = $_POST['nama_pengelola'];
|
||||
$wa = $_POST['no_wa'];
|
||||
$buka_24jam = $_POST['buka_24jam'];
|
||||
$alamat_lengkap = $_POST['alamat_lengkap'];
|
||||
|
||||
// Query UPDATE untuk mengubah data berdasarkan ID-nya
|
||||
$sql = "UPDATE spbu SET nama_spbu='$nama', nama_pengelola='$pengelola', no_wa='$wa', buka_24jam='$buka_24jam' WHERE id='$id'";
|
||||
$sql = "UPDATE spbu SET nama_spbu='$nama', nama_pengelola='$pengelola', no_wa='$wa', buka_24jam='$buka_24jam', alamat_lengkap='$alamat_lengkap' WHERE id='$id'";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo "Sukses";
|
||||
|
||||
Reference in New Issue
Block a user