feat: implement web GIS layout with sidebar, custom UI controls, and modular map feature integration
This commit is contained in:
@@ -63,7 +63,7 @@ map.on('mouseup', function(e) {
|
||||
isResizing = false;
|
||||
map.dragging.enable();
|
||||
if (resizingIbadah) {
|
||||
updateIbadah(resizingIbadah.id, resizingIbadah.nama, resizingIbadah.alamat, resizingIbadah.radius, resizingIbadah.lat, resizingIbadah.lng);
|
||||
updateIbadah(resizingIbadah.id, resizingIbadah.nama, resizingIbadah.jenis, resizingIbadah.alamat, resizingIbadah.radius, resizingIbadah.lat, resizingIbadah.lng);
|
||||
}
|
||||
resizingCircle = null;
|
||||
resizingIbadah = null;
|
||||
@@ -89,11 +89,17 @@ function loadRumahIbadah() {
|
||||
}
|
||||
|
||||
function addIbadahMarker(item) {
|
||||
const marker = L.marker([item.lat, item.lng], { icon: makeIbadahIcon(item.jenis), draggable: true });
|
||||
const lat = parseFloat(item.lat);
|
||||
const lng = parseFloat(item.lng);
|
||||
const radius = parseFloat(item.radius) || 100; // fallback if invalid
|
||||
|
||||
if (isNaN(lat) || isNaN(lng)) return;
|
||||
|
||||
const marker = L.marker([lat, lng], { icon: makeIbadahIcon(item.jenis), draggable: true });
|
||||
|
||||
// Lingkaran radius
|
||||
const circle = L.circle([item.lat, item.lng], {
|
||||
radius: item.radius,
|
||||
const circle = L.circle([lat, lng], {
|
||||
radius: radius,
|
||||
color: '#ff7800',
|
||||
weight: 2,
|
||||
fillColor: '#ff7800',
|
||||
@@ -153,7 +159,7 @@ function addIbadahMarker(item) {
|
||||
item.lat = newPos.lat;
|
||||
item.lng = newPos.lng;
|
||||
// Update ke DB
|
||||
updateIbadah(item.id, item.nama, item.alamat, item.radius, newPos.lat, newPos.lng);
|
||||
updateIbadah(item.id, item.nama, item.jenis, item.alamat, item.radius, newPos.lat, newPos.lng);
|
||||
});
|
||||
|
||||
rumahIbadahLayer.addLayer(circle);
|
||||
@@ -340,7 +346,11 @@ function updateIbadah(id, nama, jenis, alamat, radius, lat, lng) {
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ id, nama, jenis, alamat, radius, lat, lng })
|
||||
}).then(res => res.json()).then(data => {
|
||||
if(data.status === 'success') { map.closePopup(); loadRumahIbadah(); }
|
||||
if(data.status === 'success') {
|
||||
if (typeof closeModal === 'function') closeModal();
|
||||
map.closePopup();
|
||||
loadRumahIbadah();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -375,7 +385,11 @@ function loadPendudukMiskin() {
|
||||
}
|
||||
|
||||
function addMiskinMarker(item) {
|
||||
const marker = L.marker([item.lat, item.lng], { icon: makeMiskinIcon(false), draggable: true });
|
||||
const lat = parseFloat(item.lat);
|
||||
const lng = parseFloat(item.lng);
|
||||
if (isNaN(lat) || isNaN(lng)) return;
|
||||
|
||||
const marker = L.marker([lat, lng], { icon: makeMiskinIcon(false), draggable: true });
|
||||
marker.miskinData = item;
|
||||
|
||||
const d = item;
|
||||
|
||||
Reference in New Issue
Block a user