up
This commit is contained in:
+2
-38
@@ -4147,37 +4147,7 @@
|
|||||||
window._tmpM.setIcon(createModernMarker(color, 'fas fa-gas-pump', 'SPBU Baru'));
|
window._tmpM.setIcon(createModernMarker(color, 'fas fa-gas-pump', 'SPBU Baru'));
|
||||||
};
|
};
|
||||||
|
|
||||||
function handlePointClick(e) {
|
|
||||||
const icon = createModernMarker('#10b981', 'fas fa-gas-pump', 'SPBU Baru');
|
|
||||||
const tmpM = L.marker(e.latlng, { icon, draggable: true }).addTo(map);
|
|
||||||
const upd = ll => {
|
|
||||||
const a = document.getElementById('p-lat'), b = document.getElementById('p-lng');
|
|
||||||
if (a) a.value = ll.lat.toFixed(6);
|
|
||||||
if (b) b.value = ll.lng.toFixed(6);
|
|
||||||
};
|
|
||||||
tmpM.on('dragend', ev => upd(ev.target.getLatLng()));
|
|
||||||
const form = `<div class="pf">
|
|
||||||
<h4><i class="fas fa-gas-pump" style="color:var(--green)"></i> Tambah SPBU</h4>
|
|
||||||
<label>Nama SPBU</label>
|
|
||||||
<input id="p-nama" placeholder="Pertamina Ahmad Yani">
|
|
||||||
<label>Nomor SPBU</label>
|
|
||||||
<input id="p-no" placeholder="64.xxx.xx">
|
|
||||||
<label>Status Operasional</label>
|
|
||||||
<select id="p-status" onchange="window.updateTempMarkerIcon()">
|
|
||||||
<option value="Ya">Buka 24 Jam</option>
|
|
||||||
<option value="Tidak">Tidak Buka 24 Jam</option>
|
|
||||||
</select>
|
|
||||||
<div class="coord-row">
|
|
||||||
<input id="p-lat" value="${e.latlng.lat.toFixed(6)}" readonly>
|
|
||||||
<input id="p-lng" value="${e.latlng.lng.toFixed(6)}" readonly>
|
|
||||||
</div>
|
|
||||||
<div class="hint-txt">* Geser marker untuk menyesuaikan posisi</div>
|
|
||||||
<button class="pbtn pbtn-g" onclick="savePoint()">Simpan SPBU</button>
|
|
||||||
</div>`;
|
|
||||||
tmpM.bindPopup(form, { maxWidth: 280, autoPanPaddingTopLeft: [0, 80], autoPanPaddingBottomRight: [0, 20] }).openPopup();
|
|
||||||
tmpM.on('popupclose', () => { if (map.hasLayer(tmpM)) map.removeLayer(tmpM); });
|
|
||||||
window._tmpM = tmpM;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -4605,14 +4575,8 @@
|
|||||||
}
|
}
|
||||||
function fmtArea(m) { return m >= 10000 ? (m / 10000).toFixed(2) + ' ha' : Math.round(m) + ' m²' }
|
function fmtArea(m) { return m >= 10000 ? (m / 10000).toFixed(2) + ' ha' : Math.round(m) + ' m²' }
|
||||||
|
|
||||||
function clearTemp() {
|
|
||||||
state.tempPoints = []; state.drawingLine = false; state.drawingPoly = false;
|
|
||||||
state.tempMarkers.forEach(m => map.removeLayer(m)); state.tempMarkers = [];
|
|
||||||
if (state.tempPolyline) { map.removeLayer(state.tempPolyline); state.tempPolyline = null; }
|
|
||||||
if (state.tempPolygon) { map.removeLayer(state.tempPolygon); state.tempPolygon = null; }
|
|
||||||
}
|
|
||||||
function cancelDrawing() {
|
function cancelDrawing() {
|
||||||
clearTemp();
|
|
||||||
if (window._tmpM) { map.removeLayer(window._tmpM); window._tmpM = null; }
|
if (window._tmpM) { map.removeLayer(window._tmpM); window._tmpM = null; }
|
||||||
if (window._tmpC) { map.removeLayer(window._tmpC); window._tmpC = null; }
|
if (window._tmpC) { map.removeLayer(window._tmpC); window._tmpC = null; }
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user