diff --git a/www/assets/images/dropbox-icon.png b/www/assets/images/dropbox-icon.png
new file mode 100644
index 0000000..efd14b4
Binary files /dev/null and b/www/assets/images/dropbox-icon.png differ
diff --git a/www/assets/images/dropbox-icon.svg b/www/assets/images/dropbox-icon.svg
new file mode 100644
index 0000000..bfb63d2
--- /dev/null
+++ b/www/assets/images/dropbox-icon.svg
@@ -0,0 +1,202 @@
+
+
+
+
+
+
+
+
+ image/svg+xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/www/assets/js/Map.class.js b/www/assets/js/MapControl.class.js
similarity index 54%
rename from www/assets/js/Map.class.js
rename to www/assets/js/MapControl.class.js
index 1934023..f83fe47 100644
--- a/www/assets/js/Map.class.js
+++ b/www/assets/js/MapControl.class.js
@@ -4,32 +4,66 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-class Map {
- constructor(mapboxElement) {
+class MapControl {
+ constructor(mapboxElement, interactive) {
this.mapObj = null;
this.mapEl = mapboxElement;
+ this.interactiveMap = interactive == true;
}
createMap() {
if (mapboxgl.supported()) {
$(this.mapEl).css("display", "");
- this.mapObj = maplibreMap(this.mapEl);
+ this.mapObj = maplibreMap(this.mapEl, this.interactiveMap);
} else {
console.log("maplibre-gl not supported, disabling map");
$(this.mapEl).css("display", "none");
}
}
- clearOldMarkersAndCenterMapOnNewMarker(classname) {
- var latitude = $(this.mapEl).data("latitude");
- var longitude = $(this.mapEl).data("longitude");
- var accurate = $(this.mapEl).data("accurate") == true;
-
+ /**
+ * Clear all markers from the map, make a new marker, and fly to it.
+ * @param {string} classname CSS class for the marker, for adding icon and stuff. Default will be invisible and 0x0px.
+ * @param {number} latitude
+ * @param {number} longitude
+ * @param {boolean} accurate set true to zoom to street level (z13), false to zoom to general area (z10).
+ * @returns {undefined}
+ */
+ clearMarkersAndCenterMapOnNewMarker(classname, latitude, longitude, accurate) {
this.mapObj.removeMarkers();
this.mapObj.addMarker(latitude, longitude, classname);
this.mapObj.animateMapIn(latitude, longitude, (accurate ? 13 : 10));
}
+ loadMarkersFromGeoJson(geojson, iconname, name) {
+ this.mapObj.addSource("markers-" + name, {
+ 'type': 'geojson',
+ 'data': geojson
+ });
+ this.mapObj.addLayer({
+ id: "marker-layer-" + name,
+ type: "symbol",
+ source: "markers-" + name,
+ layout: {
+ "icon-image": iconname,
+ "icon-anchor": "bottom",
+ 'icon-allow-overlap': true
+ }
+ });
+ }
+
+ loadIcon(url, name, callback) {
+ var mapObj = this.mapObj;
+ this.mapObj.loadImage(
+ url,
+ function (error, image) {
+ if (error)
+ throw error;
+ mapObj.addImage(name, image);
+ callback();
+ });
+ }
+
/**
* Destroy and re-create the map.
* @returns {undefined}
@@ -57,10 +91,10 @@ class Map {
}
setMapLocation(latitude, longitude) {
- if (mapObj == null) {
+ if (this.mapObj == null) {
return;
}
- mapObj.setMapLocation(latitude, longitude);
+ this.mapObj.setMapLocation(latitude, longitude);
}
animateMapIn(latitude, longitude, zoom, heading) {
diff --git a/www/assets/js/account.js b/www/assets/js/account.js
new file mode 100644
index 0000000..5a13d48
--- /dev/null
+++ b/www/assets/js/account.js
@@ -0,0 +1,249 @@
+/*
+ * 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 checkAccountStatus(callback) {
+ if (inStorage("phonenumber")) {
+ apirequest(SETTINGS.apis.authorstartverify, {
+ phone: getStorage("phonenumber"),
+ accountkey: (inStorage("accountkey") ? getStorage("accountkey") : "")
+ }, function (resp) {
+ if (resp.status == "OK") {
+ if (resp.authok && resp.accountok) {
+ callback(true);
+ } else if (!resp.authok && resp.accountok) {
+ // verify phone or email
+ // openAccountVerify(resp.verifymsg);
+ callback("noauth", resp.verifymsg);
+ } else if (!resp.authok && !resp.accountok) {
+ callback(false);
+ } else {
+ callback("badstate");
+ }
+ } else {
+ app.dialog.alert(resp.msg, "Error");
+ }
+ }, function (err) {
+ app.dialog.alert("Something went wrong. Try again later.", "Error");
+ });
+ } else {
+ callback(false);
+ }
+}
+
+function openAccountVerify(verifymsg) {
+ app.dialog.prompt(verifymsg, "Verify Your Account", function (val) {
+ verifyCode(val);
+ }, function (cancel) {
+ // shrug
+ }, "");
+}
+
+/**
+ * Confirm auth/login code with server and store login key if successful.
+ * @param {type} code
+ * @returns {undefined}
+ */
+function verifyCode(code) {
+ app.dialog.preloader("Verifying...");
+ apirequest(SETTINGS.apis.verifyauthcode, {
+ code: code,
+ phone: getStorage("phonenumber")
+ }, function (resp) {
+ app.dialog.close();
+ if (resp.status == "OK") {
+ setStorage("accountkey", resp.authkey);
+ app.dialog.alert("This device has been successfully linked to your Helena Express account.", "Account verified!");
+ displayAccountInfo();
+ } else if (resp.status == "ERROR") {
+ app.dialog.alert(resp.msg, "Error");
+ }
+ }, function (error) {
+ app.dialog.close();
+ app.dialog.alert("There's a server or network problem. Check your Internet connection or try again later.", "Error");
+ });
+}
+
+function displayAccountInfo() {
+ $("#loyaltyBalanceBox").addClass("display-none");
+ $("#loyaltyErrorMessage").html("");
+ if (inStorage("accountkey") && inStorage("phonenumber")) {
+ } else {
+ $("#loyaltyErrorMessage").text("Error: No account connected.");
+ return;
+ }
+ apirequest(SETTINGS.apis.getaccountinfo, {
+ phone: getStorage("phonenumber"),
+ accountkey: getStorage("accountkey")
+ }, function (success) {
+ $("#hasaccountbox").css("display", "");
+ $("#loadingaccountbox").css("display", "none");
+ if (success.status == "OK") {
+ $("#loyaltyCreditBalanceHeading").text(success.credits + " points");
+ $("#loyaltyBalanceBox").removeClass("display-none");
+
+ var canvas = document.createElement('canvas');
+
+ bwipjs.toCanvas(canvas, {
+ bcid: 'code128', // Barcode type
+ text: success.phone, // Text to encode
+ scaleX: 5,
+ scaleY: 1,
+ includetext: false, // Show human-readable text
+ textxalign: 'center', // Always good to set this
+ eclevel: 'M'
+ });
+ $("#accountnumberspan").text("Account number: " + success.phone);
+ document.getElementById("loyaltyBarcodeImg").src = canvas.toDataURL('image/png');
+
+ if (success.payments_setup === false) {
+ $("#addPaymentMethodBox").css("display", "");
+ }
+
+
+ $("#accountupdateform input#name").val(success.name);
+ $("#accountupdateform input#email").val(success.email);
+ $("#accountupdateform input#streetaddress").val(success.streetaddress);
+ $("#accountupdateform input#zipcode").val(success.zipcode);
+ } else {
+ $("#loyaltyBalanceBox").addClass("display-none");
+ $("#loyaltyErrorMessage").text("Error: " + success.msg);
+ }
+ }, function (error) {
+ $("#loyaltyErrorMessage").text("Error: Couldn't get your account info. Try again later.");
+ }, "GET");
+}
+
+$("#app").on("click", "#setupAccountBtn", function () {
+ if ($("#accountsetupform input#phonenumber").val() == "") {
+ app.dialog.alert("Add your phone number.", "Error");
+ return;
+ }
+ if ($("#accountsetupform input#name").val() == "") {
+ app.dialog.alert("Add your name.", "Error");
+ return;
+ }
+ if ($("#accountsetupform input#email").val() == "") {
+ app.dialog.alert("Add your email address.", "Error");
+ return;
+ }
+ if ($("#accountsetupform input#streetaddress").val() == "") {
+ app.dialog.alert("Add your street address.", "Error");
+ return;
+ }
+ if ($("#accountsetupform input#zipcode").val() == "") {
+ app.dialog.alert("Add your ZIP Code.", "Error");
+ return;
+ }
+ app.dialog.preloader("Creating Account...");
+ apirequest(SETTINGS.apis.accountregister, {
+ phone: $("#accountsetupform input#phonenumber").val(),
+ name: $("#accountsetupform input#name").val(),
+ email: $("#accountsetupform input#email").val(),
+ address: $("#accountsetupform input#streetaddress").val(),
+ zipcode: $("#accountsetupform input#zipcode").val()
+ }, function (resp) {
+ app.dialog.close();
+
+ if (resp.status == "ERROR") {
+ app.dialog.alert(resp.msg, "Error");
+ return;
+ } else {
+ setStorage("phonenumber", resp.phone);
+ router.refreshPage();
+ }
+ }, function (error) {
+ app.dialog.close();
+ app.dialog.alert("There's a server or network problem. Check your Internet connection or try again later.", "Error");
+ });
+});
+
+$("#app").on("click", "#updateAccountBtn", function () {
+ if ($("#accountupdateform input#name").val() == "") {
+ app.dialog.alert("Add your name.", "Error");
+ return;
+ }
+ if ($("#accountupdateform input#email").val() == "") {
+ app.dialog.alert("Add your email address.", "Error");
+ return;
+ }
+ if ($("#accountupdateform input#streetaddress").val() == "") {
+ app.dialog.alert("Add your street address.", "Error");
+ return;
+ }
+ if ($("#accountupdateform input#zipcode").val() == "") {
+ app.dialog.alert("Add your ZIP Code.", "Error");
+ return;
+ }
+ app.dialog.preloader("Updating Account...");
+ apirequest(SETTINGS.apis.accountregister, {
+ phone: getStorage("phonenumber"),
+ accountkey: getStorage("accountkey"),
+ name: $("#accountupdateform input#name").val(),
+ email: $("#accountupdateform input#email").val(),
+ address: $("#accountupdateform input#streetaddress").val(),
+ zipcode: $("#accountupdateform input#zipcode").val()
+ }, function (resp) {
+ app.dialog.close();
+
+ if (resp.status == "ERROR") {
+ app.dialog.alert(resp.msg, "Error");
+ return;
+ } else {
+ app.popup.close("#accountUpdatePopup", true);
+ setStorage("phonenumber", resp.phone);
+ router.refreshPage();
+ app.dialog.alert("Account details updated.", "Account Updated");
+ }
+ }, function (error) {
+ app.dialog.close();
+ app.dialog.alert("There's a server or network problem. Check your Internet connection or try again later.", "Error");
+ });
+});
+
+$("#app").on("click", "#connectExistingAccountBtn", function () {
+ app.dialog.prompt("Enter your phone number or account number:", "Connect Your Account", function (val) {
+ var phone = val.replace(/\D/g, '');
+ if (phone.length < 10) {
+ app.dialog.alert("Please enter a full 10-digit phone number.", "Oops!");
+ return;
+ }
+ setStorage("phonenumber", phone);
+ router.refreshPage();
+ }, function (cancel) {
+ // shrug
+ }, "");
+});
+
+$("#app").on("popup:open", "#accountUpdatePopup", function () {
+ app.input.checkEmptyState("#accountupdateform input#name");
+ app.input.checkEmptyState("#accountupdateform input#email");
+ app.input.checkEmptyState("#accountupdateform input#streetaddress");
+ app.input.checkEmptyState("#accountupdateform input#zipcode");
+});
+
+function initAccountPage() {
+ checkAccountStatus(function (result, msg) {
+ switch (result) {
+ case true:
+ displayAccountInfo();
+ break;
+ case false:
+ $("#setupaccountbox").css("display", "");
+ $("#loadingaccountbox").css("display", "none");
+ break;
+ case "noauth":
+ openAccountVerify(msg);
+ break;
+ case "badstate":
+ app.dialog.alert("Your account is in an unstable state. This shouldn't happen. Please contact us at (406) 389-8988 and we'll fix it.", "Error");
+ break;
+ default:
+ app.dialog.alert("Something went very wrong. Close the app completely (swipe it away from the app switcher) and re-open it. If you continue to get this message, contact us for help: (406) 389-8988", "Error");
+ break;
+ }
+ });
+}
\ No newline at end of file
diff --git a/www/assets/js/dropandsend.js b/www/assets/js/dropandsend.js
new file mode 100644
index 0000000..3b90baf
--- /dev/null
+++ b/www/assets/js/dropandsend.js
@@ -0,0 +1,66 @@
+/*
+ * 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 captureAndSendPickupCode() {
+ scanBarcode(function (result) {
+ var code = "";
+ var coderegex = /^[0-9a-zA-Z]{5,40}$/;
+ if (result.startsWith("https://helena.express/dropandsend#")) {
+ code = result.split("#")[1];
+ } else if (coderegex.test(result)) {
+ code = result;
+ } else {
+ app.dialog.alert("That's not a valid drop box code.", "Error");
+ return;
+ }
+ sendPickupCode(code);
+ }, function () {
+ app.dialog.prompt("Something went wrong while trying to scan the barcode. Type the location number to request a pickup.", "Send Pickup Code", function (code) {
+ if (code == "") {
+ app.dialog.alert("You didn't enter a location number.", "Error");
+ } else {
+ sendPickupCode(code);
+ }
+ }, function (cancel) {
+
+ }, "");
+ });
+}
+
+function sendPickupCode(code) {
+ app.dialog.preloader("Loading...");
+ apirequest(SETTINGS.apis.dropandsendpickup, {
+ phone: getStorage("phonenumber"),
+ accountkey: getStorage("accountkey"),
+ locationnumber: code
+ }, function (resp) {
+ app.dialog.close();
+ if (resp.status == "OK") {
+ app.dialog.alert("Thank you for using Helena Express! You'll get an emailed receipt after we pick up and process your package(s).", "Pickup Requested!");
+ } else if (resp.status == "ERROR") {
+ app.dialog.alert(resp.msg, "Error");
+ }
+ }, function (error) {
+ app.dialog.close();
+ app.dialog.alert("There's a server or network problem. Check your Internet connection or try again later.", "Error");
+ });
+}
+
+$("#app").on("click", "#pickupCodeQRScanBtn", function () {
+ captureAndSendPickupCode();
+});
+
+$("#app").on("click", "#pickupCodeManualEntryBtn", function () {
+ app.dialog.prompt("Enter the location number to request a pickup.", "Send Pickup Code", function (code) {
+ if (code == "") {
+ app.dialog.alert("You didn't enter a location number.", "Error");
+ } else {
+ sendPickupCode(code);
+ }
+ }, function (cancel) {
+
+ }, "");
+});
\ No newline at end of file
diff --git a/www/assets/js/loyalty.js b/www/assets/js/loyalty.js
deleted file mode 100644
index 7b3c64c..0000000
--- a/www/assets/js/loyalty.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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 displayLoyaltyPoints() {
- $("#loyalty-balance-box").addClass("display-none");
- $("#loyalty-error").html("");
- if (inStorage("phonenumber")) {
- var phone = getStorage("phonenumber");
- } else {
- $("#loyalty-error").text("Error: No phone number saved.");
- }
- app.dialog.preloader("Checking points balance...");
- apirequest(SETTINGS.apis.loyalty, {phone: phone}, function (success) {
- app.dialog.close();
- if (success.status == "OK") {
- $("#loyalty-credit-balance").text(success.credits + " points");
- $("#loyalty-balance-box").removeClass("display-none");
-
- var canvas = document.createElement('canvas');
-
- bwipjs.toCanvas(canvas, {
- bcid: 'code128', // Barcode type
- text: success.phone, // Text to encode
- scaleX: 5,
- scaleY: 1,
- includetext: false, // Show human-readable text
- textxalign: 'center', // Always good to set this
- eclevel: 'M'
- });
- document.getElementById("loyalty-barcode").src = canvas.toDataURL('image/png');
- } else {
- $("#loyalty-balance-box").addClass("display-none");
- $("#loyalty-error").text("Error: " + success.message);
- }
- }, function (error) {
- $("#loyalty-error").text("Error: Couldn't check your points balance. Try again later.");
- }, "GET");
-}
-
-function savePhoneNumber() {
- var phone = $("#phonenumber").val().replace(/\D/g, '');
- if (phone.length < 10) {
- app.dialog.alert("Please enter a full 10-digit phone number.", "Oops!");
- return;
- }
- setStorage("phonenumber", phone);
- router.refreshPage();
-}
\ No newline at end of file
diff --git a/www/assets/js/map.js b/www/assets/js/map.js
index f66c1c6..13e5f91 100644
--- a/www/assets/js/map.js
+++ b/www/assets/js/map.js
@@ -5,4 +5,4 @@
*/
-///var trackingMap = new Map(document.getElementById("mapbox-track"));
\ No newline at end of file
+var dropboxMap = null;
\ No newline at end of file
diff --git a/www/assets/js/map_maplibre.js b/www/assets/js/map_maplibre.js
index 3b296c1..0e97fea 100644
--- a/www/assets/js/map_maplibre.js
+++ b/www/assets/js/map_maplibre.js
@@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-function maplibreMap(containerEl) {
+function maplibreMap(containerEl, interactive) {
var theme = "liberty";
if ($("#app").hasClass("theme-dark")) {
@@ -17,13 +17,39 @@ function maplibreMap(containerEl) {
container: containerEl.id,
style: SETTINGS.maptileurls[theme].json,
//attributionControl: false,
- interactive: false,
+ interactive: interactive,
pitch: 0,
zoom: 1,
- maxZoom: 14,
+ maxZoom: 18,
center: [-97, 38]
});
+ if (interactive) {
+ map.addControl(new mapboxgl.NavigationControl({
+ visualizePitch: false,
+ showCompass: false
+ }), 'top-left');
+
+ map.addControl(
+ new mapboxgl.GeolocateControl({
+ positionOptions: {
+ enableHighAccuracy: true,
+ timeout: 10 * 1000
+ },
+ fitBoundsOptions: {
+ maxZoom: 16
+ },
+ trackUserLocation: false
+ }), 'top-left'
+ );
+
+ map.addControl(
+ new mapboxgl.ScaleControl({
+ unit: "imperial"
+ })
+ );
+ }
+
map.mapEasing = function (t) {
return t * (2 - t);
};
diff --git a/www/assets/js/platform.js b/www/assets/js/platform.js
index 6ea23df..cf8d933 100644
--- a/www/assets/js/platform.js
+++ b/www/assets/js/platform.js
@@ -179,7 +179,13 @@ function initCordova() {
// Handle geo: urls
$("#app").on("click", "a[href^='geo:']", function (evt) {
- window.open($(this).attr("href"), "_system");
+ if (cordova.platformId == "ios") {
+ window.open($(this).attr("href").replace("geo:", "http://maps.apple.com/?q="), "_system");
+ } else if (cordova.platformId == "android") {
+ window.open($(this).attr("href").replace("geo:", "geo:0,0?q="), "_system");
+ } else {
+ window.open($(this).attr("href"), "_system");
+ }
evt.preventDefault();
});
}
@@ -223,7 +229,7 @@ function initNW() {
setupHTML5BarcodeScanner();
// Handle geo: urls
- $("#app").on("click", ".geolink", function (evt) {
+ $("#app").on("click", "a[href^='geo:']", function (evt) {
require('nw.gui').Shell.openExternal($(this).attr("href"));
evt.preventDefault();
});
diff --git a/www/index.html b/www/index.html
index fe73a94..4e3001f 100644
--- a/www/index.html
+++ b/www/index.html
@@ -47,14 +47,15 @@
-
+
+
-
+
\ No newline at end of file
diff --git a/www/pages/account.html b/www/pages/account.html
new file mode 100644
index 0000000..75b985a
--- /dev/null
+++ b/www/pages/account.html
@@ -0,0 +1,178 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Add a credit or debit card to use Drop and Send. It'll be securely saved for future use.
+
Add Card
+
+
+
+
You have earned a total of
+
...
+
+
+
+
+
+
+
+
+
+ Loyalty points have no cash value. All points and associated discounts
+ are offered as a courtesy by and at the discretion of Helena Express
+ and may be revoked, canceled, or modified at any time for any reason.
+
+
+
+
+
+
+ Set up an account to use our Drop and Send service, earn rewards points, and more!
+
+
+ Already have an account?
+
+ Tap
+ Click here
+ to connect it.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/www/pages/dropandsend.html b/www/pages/dropandsend.html
new file mode 100644
index 0000000..a943ed8
--- /dev/null
+++ b/www/pages/dropandsend.html
@@ -0,0 +1,62 @@
+
+
+
\ No newline at end of file
diff --git a/www/pages/loyalty.html b/www/pages/loyalty.html
deleted file mode 100644
index e08a3d7..0000000
--- a/www/pages/loyalty.html
+++ /dev/null
@@ -1,135 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- {{#if hasphone}}
-
-
You have earned a total of
-
...
-
-
-
-
-
-
-
-
-
100 Points
-
-
-
- $1 pickup discount
-
-
-
-
-
500 Points
-
-
-
-
-
Sheet of Forever stamps
-
-
-
-
-
800 Points
-
-
-
- Postage for a Priority Mail envelope or small flat rate box
-
-
-
-
-
2500 Points
-
-
-
- Postage for a Priority Mail Express envelope
-
-
-
-
-
-
- {{else}}
-
- Save your phone number to start earning points!
-
-
-
- {{/if}}
-
-
-
- Loyalty points have no cash value. All points and associated discounts
- are offered as a courtesy by and at the discretion of Helena Express
- and may be revoked, canceled, or modified at any time for any reason.
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/www/routes.js b/www/routes.js
index a6044e8..b49a0d3 100644
--- a/www/routes.js
+++ b/www/routes.js
@@ -20,36 +20,42 @@ var routes = [
icon: "fad fa-calendar-alt",
text: "Get mailing, shipping, and notary services on your schedule anywhere in the Helena area."
},
+ {
+ title: "Drop and Send",
+ href: "/dropandsend",
+ icon: "fad fa-box-alt",
+ text: "Bring your package to a secure drop location and we'll ship it for you. No postage or appointment needed."
+ },
{
title: "Track Package",
href: "/track",
icon: "fad fa-search",
text: "Find the latest location and updates about any shipment."
},
- {
- title: "Pick Up and Redeliver",
- href: "/noticeslip",
- icon: "fad fa-sticky-note",
- text: "Take a picture of your pink postal notice slip and we'll go get your missed delivery."
- },
- {
- title: "Loyalty Points",
- href: "/loyalty",
- icon: "fad fa-badge-dollar",
- text: "Earn free stamps and discounts."
- },
- {
- title: "Express Pickup",
- href: "/addresscode",
- icon: "fal fa-qrcode",
- text: "Get a faster pickup and a discount by pre-typing the destination address here."
- },
{
title: "Get Rates",
href: "/rates",
icon: "fad fa-calculator",
text: "Calculate postage and prices for your item."
},
+ {
+ title: "My Account",
+ href: "/account",
+ icon: "fad fa-user-circle",
+ text: "Earn rewards and use Drop and Send with a Helena Express account."
+ },
+// {
+// title: "Express Pickup",
+// href: "/addresscode",
+// icon: "fal fa-qrcode",
+// text: "Get a faster pickup and a discount by pre-typing the destination address here."
+// },
+ {
+ title: "Pick Up and Redeliver",
+ href: "/noticeslip",
+ icon: "fad fa-sticky-note",
+ text: "Take a picture of your pink postal notice slip and we'll go get your missed delivery."
+ }
]
}
});
@@ -99,6 +105,76 @@ var routes = [
}
]
},
+ {
+ path: '/dropandsend',
+ name: 'dropandsend',
+ templateUrl: './pages/dropandsend.html',
+ on: {
+ pageAfterIn: function () {
+ var mapboxel = document.getElementById("mapbox-dropboxes");
+ dropboxMap = new MapControl(mapboxel, true);
+ dropboxMap.reloadMap();
+ dropboxMap.mapObj.on('load', function () {
+ dropboxMap.mapObj.jumpTo({center: [-112.005, 46.589], zoom: 8});
+ dropboxMap.loadIcon("./assets/images/dropbox-icon.png", "dropbox", function () {
+ apirequest(SETTINGS.apis.dropandsendlocations, {}, function (data) {
+ dropboxMap.loadMarkersFromGeoJson(data, "dropbox", "dropbox");
+ dropboxMap.mapObj.on('click', 'marker-layer-dropbox', function (e) {
+ var coordinates = e.features[0].geometry.coordinates.slice();
+ var name = e.features[0].properties.name;
+ var type = e.features[0].properties.type;
+ var info = e.features[0].properties.info;
+ var hours = e.features[0].properties.hours;
+ var geolink = "geo:" + (Math.round(coordinates[1] * 1000000) / 1000000) + "," + (Math.round(coordinates[0] * 1000000) / 1000000);
+
+ var typedesc = " Unknown package size limits";
+ switch (type) {
+ case "micro":
+ typedesc = " Fits envelopes";
+ break;
+ case "mini":
+ typedesc = " Fits large envelopes and small packages";
+ break;
+ case "standard":
+ typedesc = " Fits up to medium-size packages";
+ break;
+ case "large":
+ typedesc = " Fits most packages";
+ break;
+ case "business":
+ typedesc = " Shipping location, accepts any size package";
+ break;
+ }
+
+ while (Math.abs(e.lngLat.lng - coordinates[0]) > 180) {
+ coordinates[0] += e.lngLat.lng > coordinates[0] ? 360 : -360;
+ }
+
+ new mapboxgl.Popup()
+ .setLngLat(coordinates)
+ .setHTML("" + name + " " + typedesc
+ + "Hours: " + hours
+ + "More Info: " + info
+ + " Directions ")
+ .addTo(dropboxMap.mapObj);
+ });
+
+ dropboxMap.mapObj.on('mouseenter', 'marker-layer-dropbox', function () {
+ dropboxMap.mapObj.getCanvas().style.cursor = 'pointer';
+ });
+
+ dropboxMap.mapObj.on('mouseleave', 'marker-layer-dropbox', function () {
+ dropboxMap.mapObj.getCanvas().style.cursor = '';
+ });
+ dropboxMap.animateMapIn(46.589, -112.005, 9, 0);
+ }, function (error) {
+
+ }, "GET");
+ });
+ });
+ }
+ }
+ },
{
path: '/track',
url: './pages/track.html',
@@ -164,23 +240,21 @@ var routes = [
}
},
{
- path: '/loyalty',
- name: 'loyalty',
- async: function (routeTo, routeFrom, resolve, reject) {
- var hasPhone = inStorage("phonenumber");
- var phone = getStorage("phonenumber");
- resolve({
- templateUrl: './pages/loyalty.html'
- }, {
- context: {
- hasphone: hasPhone,
- phone: phone
- },
- on: {
- pageAfterIn: displayLoyaltyPoints
- }
- });
- }
+ path: '/account',
+ name: 'account',
+ templateUrl: './pages/account.html',
+ on: {
+ pageAfterIn: function () {
+ initAccountPage();
+ }
+ },
+ routes: [
+ {
+ path: '/managepayment',
+ name: 'managepayment',
+ templateUrl: './pages/managepayment.html'
+ }
+ ]
},
{
path: '/track/:code',
@@ -188,9 +262,13 @@ var routes = [
async: trackOpenAsync,
on: {
pageAfterIn: function () {
- var trackingMap = new Map(document.getElementById("mapbox-track"));
+ var mapboxel = document.getElementById("mapbox-track");
+ var trackingMap = new MapControl(mapboxel, false);
trackingMap.reloadMap();
- trackingMap.clearOldMarkersAndCenterMapOnNewMarker("package-marker");
+ var latitude = $(mapboxel).data("latitude");
+ var longitude = $(mapboxel).data("longitude");
+ var accurate = $(mapboxel).data("accurate") == true;
+ trackingMap.clearMarkersAndCenterMapOnNewMarker("package-marker", latitude, longitude, accurate);
}
}
},
diff --git a/www/settings.js b/www/settings.js
index 4841018..f4418f8 100644
--- a/www/settings.js
+++ b/www/settings.js
@@ -6,10 +6,16 @@
var SETTINGS = {
apis: {
- track: "https://helena.express/tracker/api.php",
- rates: "https://helena.express/rateapi.php",
+ track: "https://helena.express/apis/track/",
+ rates: "https://helena.express/apis/rates/",
pickuprequest: "https://helena.express/pspickup.php",
- loyalty: "https://helena.express/loyalty.php"
+ dropandsendlocations: "https://helena.express/apis/dropandsend/locations/",
+ dropandsendpickup: "https://helena.express/apis/dropandsend/requestpickup/",
+ getaccountinfo: "https://helena.express/apis/account/getinfo/",
+ authorstartverify: "https://helena.express/apis/account/authorstartverify/",
+ verifyauthcode: "https://helena.express/apis/account/verifyauthcode/",
+ accountregister: "https://helena.express/apis/account/register/",
+ updatepaymentmethod: "https://helena.express/apis/account/updatepaymentmethod/",
},
stripe_pubkey: "pk_live_RgpadCo1LIIkfyUsY47VhUq6",
appointmenturl: "https://appointments.netsyms.com/index.php?hlnexp=1&embed=1&only=1&theme=darkly",