diff --git a/spbu/index.php b/spbu/index.php index d74d953..f288dd6 100644 --- a/spbu/index.php +++ b/spbu/index.php @@ -1092,7 +1092,20 @@ function openJalanPopup(layer, geojson, panjang) { if (!form) return; form.addEventListener('submit', function(ev) { ev.preventDefault(); - fetch('simpan_jalan.php', { method:'POST', body:new FormData(this) }).then(() => location.reload()); + fetch('simpan_jalan.php', { method:'POST', body:new FormData(this) }) + .then(r => r.text()) + .then(res => { + if (res.trim() === 'success') { + map.closePopup(); + cancelPendingShape(false); + setMode(null); + loadData(); + showToast('Jalan berhasil ditambahkan!', 'success'); + } else { + showToast('Gagal simpan jalan: ' + res, 'error'); + } + }) + .catch(() => showToast('Error koneksi ke server.', 'error')); }); }, 50); } @@ -1105,7 +1118,20 @@ function openParsilPopup(layer, geojson, luas) { if (!form) return; form.addEventListener('submit', function(ev) { ev.preventDefault(); - fetch('simpan_parsil.php', { method:'POST', body:new FormData(this) }).then(() => location.reload()); + fetch('simpan_parsil.php', { method:'POST', body:new FormData(this) }) + .then(r => r.text()) + .then(res => { + if (res.trim() === 'success') { + map.closePopup(); + cancelPendingShape(false); + setMode(null); + loadData(); + showToast('Parsil berhasil ditambahkan!', 'success'); + } else { + showToast('Gagal simpan parsil: ' + res, 'error'); + } + }) + .catch(() => showToast('Error koneksi ke server.', 'error')); }); }, 50); } diff --git a/spbu/simpan.php b/spbu/simpan.php index 077edb2..1b33669 100644 --- a/spbu/simpan.php +++ b/spbu/simpan.php @@ -1,18 +1,17 @@ \ No newline at end of file diff --git a/spbu/simpan_jalan.php b/spbu/simpan_jalan.php index ad5738a..f1f301e 100644 --- a/spbu/simpan_jalan.php +++ b/spbu/simpan_jalan.php @@ -1,11 +1,16 @@ \ No newline at end of file diff --git a/spbu/simpan_parsil.php b/spbu/simpan_parsil.php index 148bdb0..d8a65ca 100644 --- a/spbu/simpan_parsil.php +++ b/spbu/simpan_parsil.php @@ -1,11 +1,16 @@ \ No newline at end of file