459 lines
16 KiB
PHP
459 lines
16 KiB
PHP
<?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>
|