second commit

This commit is contained in:
2026-06-11 13:17:12 +07:00
parent a7cb1f2de0
commit 69c15319dd
9 changed files with 478 additions and 133 deletions
+20 -9
View File
@@ -223,7 +223,7 @@ function enableLaporanAdd() {
openLaporanModal(e.latlng);
map.off('click', laporanClickHandler);
disableLaporanAdd();
};
map.once('click', laporanClickHandler);
@@ -238,6 +238,13 @@ function disablePointAdd() {
updateDrawModeUI();
}
function disableLaporanAdd() {
if (laporanClickHandler) {
map.off('click', laporanClickHandler);
laporanClickHandler = null;
}
}
/* Load all points from API */
async function loadPoints() {
const res = await fetch(API.points);
@@ -504,6 +511,7 @@ function showModal(type, data, extra) {
<textarea id="f-alamat">${data?.alamat || ''}</textarea>
</div>
<input type="hidden" id="f-status-verifikasi" value="${data?.status_verifikasi || 'Menunggu Verifikasi'}">
</div>
<div class="btn-row">
<button class="btn btn-primary btn-full" onclick="savePoint(${data?.id || 'null'}, ${latlng?.lat}, ${latlng?.lng})">
@@ -749,7 +757,7 @@ async function savePoint(id, lat, lng) {
document.getElementById('f-alamat')?.value || null,
status_verifikasi:
'Menunggu Verifikasi'
id ? (document.getElementById('f-status-verifikasi')?.value || 'Menunggu Verifikasi') : 'Menunggu Verifikasi'
};
try {
let res;
@@ -1334,6 +1342,7 @@ document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
stopDraw();
disablePointAdd();
disableLaporanAdd();
closeModal();
}
});
@@ -1347,13 +1356,15 @@ function updateMarkerColors() {
poorMarkers.forEach(marker => {
let distance = map.distance(selectedCenter, marker.getLatLng());
if (distance <= radius) {
marker.getElement().style.filter = "hue-rotate(0deg)";
inside++;
} else {
marker.getElement().style.filter = "hue-rotate(120deg)";
outside++;
const el = marker.getElement();
if (el) {
if (distance <= radius) {
el.style.filter = "hue-rotate(0deg)";
inside++;
} else {
el.style.filter = "hue-rotate(120deg)";
outside++;
}
}
});