Construction consent/fix event

This commit is contained in:
Luca Haid
2025-03-12 14:01:55 +00:00
parent fc4d70764d
commit 6dc7fc58fc
4 changed files with 31 additions and 13 deletions

View File

@@ -392,8 +392,8 @@
}
$("#kg").change(updateGstnr);
$("#gst").change(updateGstnr);
$("#kg").on("input", updateGstnr);
$("#gst").on("input", updateGstnr);
async function updateGstnr() {
let kg = $("#kg").val();
@@ -404,18 +404,16 @@
$("#gstnr").val(kg + gst);
// update EZ
if($("#object_type").val() == "building") {
$("#ez").prop("readonly", true);
var response = await fetch('<?=self::getUrl("ConstructionConsent", "Api", ["do" => "getEz"])?>&kg=' + kg + '&gst=' + gst);
if (!response.ok) {
return false;
}
var resp_json = await response.json();
if (resp_json.status == "OK" && resp_json.result.ez) {
$("#ez").val(resp_json.result.ez);
}
$("#ez").prop("readonly", false);
$("#ez").prop("readonly", true);
var response = await fetch('<?=self::getUrl("ConstructionConsent", "Api", ["do" => "getEz"])?>&kg=' + kg + '&gst=' + gst);
if (!response.ok) {
return false;
}
var resp_json = await response.json();
if (resp_json.status == "OK" && resp_json.result.ez) {
$("#ez").val(resp_json.result.ez);
}
$("#ez").prop("readonly", false);
}
$(window).bind("paste", (e) => {