feat: implement core WebGIS mapping features, sidebar UI, and API endpoints for data management

This commit is contained in:
Syariffullah
2026-05-08 20:44:23 +07:00
parent 448083d2ea
commit 08d6d30e02
14 changed files with 1326 additions and 188 deletions
+13 -33
View File
@@ -107,22 +107,19 @@ window.showSearchResults = function(query) {
};
// UI Logic: Custom Layer Control Toggle
const layerBtn = document.getElementById('layerBtn');
const layerBtn = document.getElementById('layerBtn');
const layerPanel = document.getElementById('layerPanel');
layerBtn.addEventListener('click', function() {
if (layerPanel.style.display === 'block') {
layerPanel.style.display = 'none';
} else {
layerPanel.style.display = 'block';
}
layerPanel.style.display = layerPanel.style.display === 'block' ? 'none' : 'block';
});
// Sembunyikan layer panel saat klik di luar area (pada map)
// Sembunyikan layer panel saat klik di peta
map.on('click', function() {
layerPanel.style.display = 'none';
});
// Logic untuk Toggle Layer Visibility
document.getElementById('layerSpbu').addEventListener('change', function(e) {
e.target.checked ? map.addLayer(spbuLayer) : map.removeLayer(spbuLayer);
@@ -248,18 +245,7 @@ window.closeConfirmModal = function() {
confirmModal.classList.remove('show');
};
// --- Action Menu Logic ---
const actionMenuBtn = document.getElementById('actionMenuBtn');
const actionMenu = document.getElementById('actionMenu');
actionMenuBtn.addEventListener('click', function() {
if (actionMenu.style.display === 'flex') {
actionMenu.style.display = 'none';
window.deactivateAddMode();
} else {
actionMenu.style.display = 'flex';
}
});
// --- Action Menu Logic (replaced by left sidebar) ---
window.currentAddMode = null; // 'spbu' atau 'rumah_ibadah'
window.currentDrawMode = null; // 'polyline' atau 'polygon'
@@ -279,19 +265,14 @@ window.activateAddMode = function(mode) {
window.currentAddMode = mode;
window.currentDrawMode = null;
// Update button UI
document.querySelectorAll('.action-menu button').forEach(btn => btn.classList.remove('active'));
if (mode === 'spbu') {
document.getElementById('btnMenuSpbu').classList.add('active');
if (window.cursorTooltip) window.cursorTooltip.textContent = 'Klik untuk Tambah SPBU';
}
if (mode === 'rumah_ibadah') {
document.getElementById('btnMenuIbadah').classList.add('active');
if (window.cursorTooltip) window.cursorTooltip.textContent = 'Klik untuk Tambah Rumah Ibadah';
}
// Tooltip
const tooltips = {
'spbu': 'Klik untuk Tambah SPBU',
'rumah_ibadah': 'Klik untuk Tambah Rumah Ibadah'
};
if (window.cursorTooltip && tooltips[mode]) window.cursorTooltip.textContent = tooltips[mode];
// Ubah kursor map menjadi crosshair
document.getElementById('map').style.cursor = 'crosshair';
};
@@ -303,7 +284,6 @@ window.deactivateAddMode = function() {
window.activeDrawHandler.disable();
window.activeDrawHandler = null;
}
document.querySelectorAll('.action-menu button').forEach(btn => btn.classList.remove('active'));
document.getElementById('map').style.cursor = '';
if (window.cursorTooltip) window.cursorTooltip.style.display = 'none';
};