feat: implement form popups for polyline and polygon drawing tools

This commit is contained in:
unknown
2026-06-09 18:21:36 +07:00
parent c33deeace9
commit f56f3e7759
+43
View File
@@ -179,6 +179,49 @@
});
};
function show_jalan_form(layer, geojson_string) {
const form_html = `
<div style="padding: 10px; min-width: 200px;">
<h4 style="margin-top:0;">Tambah Jalan Baru</h4>
<label>Nama Jalan</label><br>
<input type='text' id='nama_jalan' style='width:100%; margin-bottom:8px;' placeholder='Masukkan nama jalan'><br>
<label>Status Jalan</label><br>
<select id='status_jalan' style='width:100%; margin-bottom:12px;'>
<option value='Nasional'>Nasional</option>
<option value='Provinsi'>Provinsi</option>
<option value='Kota'>Kota</option>
</select><br>
<button onclick='save_jalan_data(${geojson_string})' style='width:100%; background-color:#4CAF50; color:white; border:none; padding:6px; cursor:pointer;'>Simpan Jalan</button>
</div>
`;
layer.bindPopup(form_html).openPopup();
}
/**
* Menampilkan formulir sembul untuk pengisian data bidang persil tanah baru
* @param {Object} layer - Objek layer Leaflet Draw
* @param {String} geojson_string - String representasi spasial GeoJSON
* @param {Number} area_size - Luas area hasil kalkulasi sistem
*/
function show_persil_form(layer, geojson_string, area_size) {
const form_html = `
<div style="padding: 10px; min-width: 220px;">
<h4 style="margin-top:0;">Tambah Persil Baru</h4>
<label>Nomor Persil</label><br>
<input type='text' id='nomor_persil' style='width:100%; margin-bottom:8px;' placeholder='Masukkan nomor persil'><br>
<label>Jenis Hak Kepemilikan</label><br>
<select id='jenis_hak' style='width:100%; margin-bottom:8px;'>
<option value='SHM'>SHM</option>
<option value='HGB'>HGB</option>
</select><br>
<p style='margin: 8px 0;'>Luas: <strong>${area_size.toFixed(2)} m²</strong></p>
<button onclick='save_persil_data(${geojson_string}, ${area_size})' style='width:100%; background-color:#4CAF50; color:white; border:none; padding:6px; cursor:pointer;'>Simpan Persil</button>
</div>
`;
layer.bindPopup(form_html).openPopup();
}
// Merender data dari database
function muat_data_feature() {
fetch('tampil_feature.php').then(response => response.json()).then(res => {