From ac56869c2a981e40d6cf4637fb8fd46c06207c9d Mon Sep 17 00:00:00 2001 From: Christian Kollmann Date: Thu, 2 Dec 2021 16:05:57 +0100 Subject: Add PLZ to search for adresses in ZMR --- .../src/main/resources/templates/residency.html | 26 ++++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'connector/src/main/resources') diff --git a/connector/src/main/resources/templates/residency.html b/connector/src/main/resources/templates/residency.html index 3f0532dd..b434b9f9 100644 --- a/connector/src/main/resources/templates/residency.html +++ b/connector/src/main/resources/templates/residency.html @@ -33,7 +33,8 @@ let foundText = /*[[#{gui.residency.found}]]*/ 'Found {0}'; let uniqueText = /*[[#{gui.residency.unique}]]*/ 'Unique'; let invalidInputText = /*[[#{gui.residency.header.inputinvalid}]]*/ 'Invalid'; - if (!$("#inputForm #inputMunicipality").val().trim() && !$("#inputForm #inputVillage").val().trim()) { + if (!$("#inputForm #inputMunicipality").val().trim() && !$("#inputForm #inputPostleitzahl").val().trim() && + !$("#inputForm #inputVillage").val().trim()) { $("#textResult").show().text(invalidInputText); return; } @@ -46,6 +47,7 @@ $("#textResult").show().text(uniqueText); $("#tableResult tbody").empty(); $("#tableResult").hide(); + $("#inputForm #inputPostleitzahl").val(data["results"][0]["postleitzahl"]); $("#inputForm #inputMunicipality").val(data["results"][0]["municipality"]); $("#inputForm #inputVillage").val(data["results"][0]["village"]); $("#inputForm #inputStreet").val(data["results"][0]["street"]); @@ -58,20 +60,25 @@ $.each(data.results, function (i, output) { $("#tableResult tbody") .append($("") + .append($("").text(output["postleitzahl"] !== null ? output["postleitzahl"] : "")) .append($("").text(output["municipality"] !== null ? output["municipality"] : "")) .append($("").text(output["village"] !== null ? output["village"] : "")) .append($("").text(output["street"] !== null ? output["street"] : "")) .append($("").text(output["number"] !== null ? output["number"] : "")) .append($("").text(applyText).attr("href", "#").click(function () { - $("#inputForm #inputMunicipality").val($(this).parent().children("td:nth-child(1)").text()); - $("#inputForm #inputVillage").val($(this).parent().children("td:nth-child(2)").text()); - $("#inputForm #inputStreet").val($(this).parent().children("td:nth-child(3)").text()); - $("#inputForm #inputNumber").val($(this).parent().children("td:nth-child(4)").text()); + $("#inputForm #inputPostleitzahl").val($(this).parent().children("td:nth-child(1)").text()); + $("#inputForm #inputMunicipality").val($(this).parent().children("td:nth-child(2)").text()); + $("#inputForm #inputVillage").val($(this).parent().children("td:nth-child(3)").text()); + $("#inputForm #inputStreet").val($(this).parent().children("td:nth-child(4)").text()); + $("#inputForm #inputNumber").val($(this).parent().children("td:nth-child(5)").text()); $("#textResult").show().text(updatedText); search(); })) ); }) + if (data.results.length == 0) { + $("#tableResult").hide(); + } }).fail(function (jqXHR, textStatus, errorThrown) { $("#textResult").show().text(errorText); }) @@ -106,6 +113,10 @@
Please enter a Municipality or Village first
+
+ + +
@@ -134,8 +145,8 @@
- +
@@ -148,6 +159,7 @@ + -- cgit v1.2.3
Postleitzahl Municipality Village Street