diff --git a/www/assets/js/toolbox_addresslookup.js b/www/assets/js/toolbox_addresslookup.js
new file mode 100644
index 0000000..aee6c4f
--- /dev/null
+++ b/www/assets/js/toolbox_addresslookup.js
@@ -0,0 +1,79 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+
+function addressLookup() {
+ if ($("#numberstreetinput").val() == "") {
+ app.dialog.alert("A street address is required.", "Not enough info");
+ return;
+ }
+ if ($("#cityinput").val() == "" || $("#stateinput").val() == "") {
+ var ziprequired = true;
+ }
+ if ($("#zipcodeinput").val() == "" && ziprequired) {
+ app.dialog.alert("A ZIP code or city and state are required.", "Not enough info");
+ }
+ app.dialog.preloader("Working...");
+ var addrlookupdialogopen = true;
+ $.ajax({
+ url: SETTINGS.addrlookupapi,
+ dataType: 'json',
+ method: 'post',
+ data: {
+ "street": $("#numberstreetinput").val(),
+ "unit": $("#unitinput").val(),
+ "city": $("#cityinput").val(),
+ "state": $("#stateinput").val(),
+ "zip": $("#zipcodeinput").val()
+ },
+ timeout: 15 * 1000,
+ success: function (resp) {
+ if (addrlookupdialogopen) {
+ app.dialog.close();
+ addrlookupdialogopen = false;
+ }
+ if (resp.status == "OK") {
+ if (resp.address.status == "OK") {
+ var address = resp.address;
+ $(".item-text #address").text(address.address);
+ var zipstr = "";
+ if (address.zip != "") {
+ zipstr = address.zip;
+ }
+ if (address.plus4 != "") {
+ zipstr += "-" + address.plus4;
+ }
+ $(".item-text #citystate").text(address.city + " " + address.state + " " + zipstr);
+
+ $(".item-text #dp").text(address.delivery_point);
+ $(".item-text #route").text(address.route);
+ $(".item-text #county").text(address.county);
+ $(".item-text #dpvconfirmed").text(address.dpv_confirmed ? "Yes" : "No");
+ $(".addrresult").removeClass("display-none");
+ } else {
+ $(".addrresult").addClass("display-none");
+ app.dialog.alert(resp.address.message, "Error");
+ }
+ if (resp.geocode.status == "OK") {
+ $(".georesult").removeClass("display-none");
+ $(".item-text #geocoords").text(resp.geocode.latitude + ", " + resp.geocode.longitude);
+ $(".item-text #geocoords").attr("src", "geo:" + resp.geocode.latitude + "," + resp.geocode.longitude);
+ } else {
+ $(".georesult").addClass("display-none");
+ }
+ } else {
+ app.dialog.alert(resp.message, "Error");
+ }
+ },
+ error: function (jqXHR, status, errorThrown) {
+ if (addrlookupdialogopen) {
+ app.dialog.close();
+ addrlookupdialogopen = false;
+ }
+ app.dialog.alert("There was a network or server issue. Please try again.", "Error");
+ }
+ });
+}
\ No newline at end of file
diff --git a/www/pages/toolbox.html b/www/pages/toolbox.html
index 0ab5660..17149fa 100644
--- a/www/pages/toolbox.html
+++ b/www/pages/toolbox.html
@@ -29,7 +29,7 @@
-
+
@@ -43,6 +43,14 @@
+
+
+
+
+
+
diff --git a/www/pages/toolbox/addrlookup.html b/www/pages/toolbox/addrlookup.html
new file mode 100644
index 0000000..a3e305c
--- /dev/null
+++ b/www/pages/toolbox/addrlookup.html
@@ -0,0 +1,125 @@
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
Number and Street
+
+
+
+
+
+
+
+
+ -
+
+
+ -
+
+
+ - Result
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/www/routes.js b/www/routes.js
index 84ff958..8e7767f 100644
--- a/www/routes.js
+++ b/www/routes.js
@@ -264,6 +264,11 @@ var routes = [
}
}
},
+ {
+ path: '/addrlookup',
+ url: './pages/toolbox/addrlookup.html',
+ name: 'addrlookup'
+ },
{
path: '/sharelist',
url: './pages/toolbox/sharelist.html',
diff --git a/www/settings.js b/www/settings.js
index 0474ae3..52e1343 100644
--- a/www/settings.js
+++ b/www/settings.js
@@ -361,4 +361,5 @@ var SETTINGS = {
loginurl: "https://apis.netsyms.net/packagehelper/login/",
syncapi: "https://apis.netsyms.net/packagehelper/sync.php",
mapfixapi: "https://apis.netsyms.net/packagehelper/contribgeocode.php",
+ addrlookupapi: "https://apis.netsyms.net/packagehelper/addresslookup.php"
}