Add package tracking (close #23), add large package and signature item types

master
Skylar Ittner 5 years ago
parent 9117e599fa
commit afbf8b6122

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
aria-hidden="true"
focusable="false"
data-prefix="fas"
data-icon="box"
class="svg-inline--fa fa-box fa-w-16"
role="img"
viewBox="0 0 512 512"
version="1.1"
id="svg4"
sodipodi:docname="largebox.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)"
inkscape:export-filename="/home/skylar/Documents/Projects/Sources/Apps/Native/PackageHelper/www/assets/images/largebox.png"
inkscape:export-xdpi="9.3800001"
inkscape:export-ydpi="9.3800001">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1013"
id="namedview6"
showgrid="false"
inkscape:zoom="0.4609375"
inkscape:cx="-451.93349"
inkscape:cy="107.74134"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg4" />
<path
d="m 117.95,255.99998 h 276.1 c 6.9025,0 12.55,-5.64696 12.55,-12.5488 V 67.76794 c 0,-6.901842 -5.6475,-12.548804 -12.55,-12.548804 H 306.19999 V 155.60955 l -50.2,-25.0976 -50.2,25.0976 V 55.219136 H 117.95 c -6.9025,0 -12.55,5.646962 -12.55,12.548804 v 175.68324 c 0,6.90184 5.6475,12.5488 12.55,12.5488 z m 376.5,100.39042 c 6.9025,0 12.55,-5.64695 12.55,-12.5488 V 318.744 c 0,-6.90185 -5.6475,-12.54881 -12.55,-12.54881 H 17.55 C 10.6475,306.19519 5,311.84215 5,318.744 v 25.0976 c 0,6.90185 5.6475,12.5488 12.55,12.5488 H 55.2 v 50.19522 H 17.55 c -6.9025,0 -12.55,5.64695 -12.55,12.5488 v 25.09764 c 0,6.90184 5.6475,12.5488 12.55,12.5488 h 476.9 c 6.9025,0 12.55,-5.64696 12.55,-12.5488 v -25.09764 c 0,-6.90185 -5.6475,-12.5488 -12.55,-12.5488 H 456.8 V 356.3904 Z M 230.89999,406.58562 H 105.4 V 356.3904 h 125.49999 z m 175.70001,0 H 281.09999 V 356.3904 H 406.6 Z"
id="path2"
inkscape:connector-curvature="0"
style="fill:currentColor;stroke:#ffffff;stroke-width:10;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
aria-hidden="true"
focusable="false"
data-prefix="fas"
data-icon="box"
class="svg-inline--fa fa-box fa-w-16"
role="img"
viewBox="0 0 512 512"
version="1.1"
id="svg4"
sodipodi:docname="largeboxes.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)"
inkscape:export-filename="/home/skylar/Documents/Projects/Sources/Apps/Native/PackageHelper/www/assets/images/largeboxes.png"
inkscape:export-xdpi="9.3800001"
inkscape:export-ydpi="9.3800001">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1013"
id="namedview6"
showgrid="false"
inkscape:zoom="0.4609375"
inkscape:cx="-451.93349"
inkscape:cy="107.74134"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg4" />
<path
inkscape:connector-curvature="0"
style="fill:currentColor;stroke:#ffffff;stroke-width:10;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 67.75,256 h 175.7 c 6.9025,0 12.55,-5.64696 12.55,-12.5488 V 67.767965 c 0,-6.90184 -5.6475,-12.54881 -12.55,-12.54881 H 67.75 c -6.9025,0 -12.55,5.64697 -12.55,12.54881 V 243.4512 C 55.2,250.35304 60.8475,256 67.75,256 Z m 251,0 h 125.5 c 6.9025,0 12.55,-5.64696 12.55,-12.5488 V 117.96317 c 0,-6.90184 -5.6475,-12.5488 -12.55,-12.5488 h -125.5 c -6.9025,0 -12.55,5.64696 -12.55,12.5488 V 243.4512 c 0,6.90184 5.6475,12.5488 12.55,12.5488 z m 175.7,100.39042 c 6.9025,0 12.55,-5.64696 12.55,-12.5488 v -25.09761 c 0,-6.90184 -5.6475,-12.5488 -12.55,-12.5488 H 17.55 c -6.9025,0 -12.55,5.64696 -12.55,12.5488 v 25.09761 c 0,6.90184 5.6475,12.5488 12.55,12.5488 H 55.2 v 50.19521 H 17.55 c -6.9025,0 -12.55,5.64696 -12.55,12.5488 v 25.09761 c 0,6.90184 5.6475,12.5488 12.55,12.5488 h 476.9 c 6.9025,0 12.55,-5.64696 12.55,-12.5488 v -25.09761 c 0,-6.90184 -5.6475,-12.5488 -12.55,-12.5488 H 456.8 V 356.39042 Z M 230.9,406.58563 H 105.4 v -50.19521 h 125.5 z m 175.7,0 H 281.1 v -50.19521 h 125.5 z"
id="path2-6" />
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
aria-hidden="true"
focusable="false"
data-prefix="fas"
data-icon="box"
class="svg-inline--fa fa-box fa-w-16"
role="img"
viewBox="0 0 512 512"
version="1.1"
id="svg4"
sodipodi:docname="signature.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)"
inkscape:export-filename="/home/skylar/Documents/Projects/Sources/Apps/Native/PackageHelper/www/assets/images/signature.png"
inkscape:export-xdpi="9.3800001"
inkscape:export-ydpi="9.3800001">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1013"
id="namedview6"
showgrid="false"
inkscape:zoom="0.4609375"
inkscape:cx="-47.728814"
inkscape:cy="256"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg4" />
<path
inkscape:connector-curvature="0"
style="fill:currentColor;stroke:#ffffff;stroke-width:9.80799961;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 193.94336,405.45713 c -2.62221,-5.2622 -7.19108,-5.79553 -9.03996,-5.79553 -1.84888,0 -6.41775,0.52444 -8.90663,5.5022 l -6.81775,13.6355 c -5.6622,11.35995 -22.24879,10.10662 -26.20433,-1.85777 l -14.95994,-44.86203 -9.43107,28.33765 c -5.23553,15.69771 -19.893239,26.24878 -36.444279,26.24878 h -11.01329 c -7.85774,0 -14.22216,-6.36442 -14.22216,-14.22216 0,-7.85775 6.36442,-14.22216 14.22216,-14.22216 h 11.01329 c 4.29331,0 8.09774,-2.73777 9.45774,-6.80886 l 16.168809,-48.56868 c 2.93332,-8.71996 11.05773,-14.5866 20.2488,-14.5866 9.19108,0 17.31549,5.85775 20.23992,14.5866 l 12.33772,37.01317 c 17.55548,-14.39105 48.05313,-8.62218 58.66641,12.58661 1.68,3.35999 4.87998,5.28887 8.31997,5.56442 v -72.99523 l 113.77728,-112.9684 v -41.3776 H 220.4588 c -11.73328,0 -21.33324,-9.59996 -21.33324,-21.33324 V 28.44543 H 21.348551 c -11.8221703,0 -21.33324027,9.51107 -21.33324027,21.33325 v 412.44265 c 0,11.82217 9.51106997,21.33324 21.33324027,21.33324 H 320.01392 c 11.82217,0 21.33324,-9.51107 21.33324,-21.33324 v -35.5554 l -113.77728,-0.0978 c -14.32883,-0.27555 -27.18211,-8.24885 -33.62652,-21.11102 z m 147.4038,-268.65661 c 0,-5.59998 -2.22221,-11.02217 -6.22219,-15.02216 L 248.10312,34.66763 c -3.99998,-3.99998 -9.42218,-6.2222 -15.11104,-6.2222 h -5.4222 V 142.22272 H 341.34716 Z M 256.0142,336.85298 v 61.36863 h 61.32418 L 461.05331,253.5289 400.71579,193.19139 Z M 505.38201,177.18257 477.05324,148.8538 c -8.83552,-8.83552 -23.17323,-8.83552 -32.00875,0 l -24.22212,24.22212 60.33752,60.33751 24.22212,-24.22211 c 8.8444,-8.83552 8.8444,-23.17324 0,-32.00875 z"
id="path2-3" />
</svg>

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
aria-hidden="true"
focusable="false"
data-prefix="fas"
data-icon="box"
class="svg-inline--fa fa-box fa-w-16"
role="img"
viewBox="0 0 512 512"
version="1.1"
id="svg4"
sodipodi:docname="signatures.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)"
inkscape:export-filename="/home/skylar/Documents/Projects/Sources/Apps/Native/PackageHelper/www/assets/images/signatures.png"
inkscape:export-xdpi="9.3800001"
inkscape:export-ydpi="9.3800001">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1013"
id="namedview6"
showgrid="false"
inkscape:zoom="0.4609375"
inkscape:cx="-451.93349"
inkscape:cy="107.74134"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg4" />
<g
id="g1063"
transform="matrix(0.84074873,0,0,0.84030597,772.08632,-86.536242)"
style="stroke-width:1.18972933">
<path
id="path2-5"
d="m -606.48259,496.68926 c -2.40085,-4.818 -6.58404,-5.3064 -8.27685,-5.3064 -1.6928,0 -5.87599,0.4802 -8.15477,5.0378 l -6.24222,12.4845 c -5.18423,10.401 -20.37066,9.2534 -23.99229,-1.701 l -13.69709,-41.075 -8.63494,25.9455 c -4.79357,14.3726 -18.21395,24.033 -33.36783,24.033 h -10.0836 c -7.19443,0 -13.02159,-5.8271 -13.02159,-13.0216 0,-7.1944 5.82716,-13.0216 13.02159,-13.0216 h 10.0836 c 3.93089,0 7.41417,-2.5066 8.65936,-6.2341 l 14.80392,-44.46872 c 2.6857,-7.98386 10.12429,-13.35527 18.53949,-13.35527 8.41521,0 15.85379,5.36327 18.53136,13.35527 l 11.29623,33.8887 c 16.07353,-13.17623 43.99671,-7.89434 53.71407,11.52412 1.53818,3.0763 4.46803,4.8424 7.61763,5.0947 v -66.83334 l 104.17275,-103.43214 v -37.88469 h -110.69168 c -10.74282,0 -19.53239,-8.78958 -19.53239,-19.53239 V 151.50306 h -162.76991 c -10.8242,0 -19.53239,8.70819 -19.53239,19.53239 v 377.62621 c 0,10.8242 8.70819,19.5324 19.53239,19.5324 h 273.45345 c 10.8242,0 19.53239,-8.7082 19.53239,-19.5324 v -32.554 l -104.17275,-0.09 c -13.11925,-0.2523 -24.88752,-7.5525 -30.78793,-19.3289 z m 134.96068,-245.97794 c 0,-5.12725 -2.03462,-10.09174 -5.69695,-13.75406 L -556.89473,157.2 c -3.66232,-3.66232 -8.62681,-5.69694 -13.83544,-5.69694 h -4.96449 V 255.6758 h 104.17275 z m -78.12956,183.16498 v 56.18816 h 56.14748 l 131.5832,-132.47842 -55.24411,-55.24411 z m 228.31735,-146.1918 -25.93738,-25.93738 c -8.08966,-8.08967 -21.21706,-8.08967 -29.30672,0 l -22.1774,22.1774 55.24411,55.24411 22.17739,-22.1774 c 8.0978,-8.08967 8.0978,-21.21706 0,-29.30673 z"
style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-width:11.89729309;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="csssssscssc"
id="path2-7"
d="m -592.38477,599.76246 v 40 c 0,13.255 -10.745,24 -24,24 h -271.99997 c -13.255,0 -24,-10.745 -24,-24 v -368 c 0,-13.255 10.745,-24 24,-24 h 72 v 296 c 0,30.879 25.121,56 56,56 z"
style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-width:11.89729309;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:connector-curvature="0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

@ -17,7 +17,7 @@ function leafletMap() {
if (localStorage.getItem("mapsource") == null) {
localStorage.setItem("mapsource", "liberty");
}
$("#mapbox").css("background-color", SETTINGS.maptileurls[localStorage.getItem("mapsource")].bgcolor);
L.tileLayer(SETTINGS.maptileurls[localStorage.getItem("mapsource")].url, {
@ -65,6 +65,7 @@ function leafletMap() {
// of the loop, or something like that
(function (datai) {
var iconName = getMapIconForItems(datai.items);
console.log(iconName);
var icon = L.icon({
iconUrl: "assets/images/" + iconName + ".png",

@ -35,25 +35,12 @@ function getPackage(packageid) {
}
}
function getIconForType(packagetype) {
switch (packagetype) {
case "package":
return "fas fa-box";
case "letter":
return "fas fa-envelope";
case "express":
return "fas fa-shipping-fast";
default:
return "fas fa-box";
}
function getIconForType(type) {
return SETTINGS.itemtypes[type].icon;
}
function getMapIconForItems(items) {
var types = {
package: 0,
letter: 0,
express: 0
};
var types = {};
var deliveredcount = 0;
var type = "package";
for (var i = 0; i < items.length; i++) {
@ -63,27 +50,36 @@ function getMapIconForItems(items) {
deliveredcount++;
continue;
}
if (isNaN(types[items[i].type])) {
types[items[i].type] = 0;
}
types[items[i].type]++;
}
if (deliveredcount == items.length) {
return "check";
}
if (types.letter == 0 && types.express == 0) {
if (types.package > 1) {
return "boxes";
}
return "box";
}
if (types.package == 0 && types.express == 0) {
if (types.letter > 1) {
return "envelopes";
item_types = 0;
icon = "multiple-items";
// Count how many types we have, and set/overwrite the icon assuming we
// only have that type. If we end up with multiple types, we return that
// icon instead of a specific one.
console.log(types);
for (var type in types) {
console.log(type);
item_types++;
if (types[type] == 1) {
icon = SETTINGS.itemtypes[type].mapicon;
} else {
icon = SETTINGS.itemtypes[type].pluralmapicon;
}
return "envelope";
console.log(icon);
}
if (types.package == 0 && types.letter == 0) {
return "express";
if (item_types > 1) {
return "multiple-items";
}
return "multiple-items";
return icon;
}
function addPackage(address, latitude, longitude, type, callback) {
@ -281,7 +277,7 @@ function addPackageByAddress(address, citystate, type, callback) {
app.dialog.alert("There was a network issue while finding the address. Please try adding the item again.", "Error");
}
});
// Open a loading message if there's a delay finding the address
setTimeout(function () {
if (!requestfinished) {

@ -0,0 +1,125 @@
/*
* 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 locationArrayToString(location) {
var locarray = [];
if (location.street != "" && location.street != null) {
locarray.push(location.street);
}
if (location.city != "" && location.city != null) {
locarray.push(location.city);
}
if (location.state != "" && location.state != null) {
locarray.push(location.state);
}
if (location.zip != "" && location.zip != null) {
locarray.push(location.zip);
}
if (location.country != "" && location.country != "US" && location.country != null) {
locarray.push(location.country);
}
return locarray.join(", ");
}
function timestampToDateTimeString(timestamp) {
var date = new Date(timestamp * 1000);
var pm = date.getHours() >= 12;
var hours = date.getHours() > 12 ? date.getHours() - 12 : date.getHours();
var minutes = date.getMinutes();
var time = hours + ":" + minutes + " " + (pm ? "PM" : "AM");
return date.toLocaleDateString() + " " + time;
}
function trackingStatusToNiceString(status, icon) {
if (typeof icon == 'undefined' || icon !== true) {
var icon = false;
}
switch (status) {
case "UNKNOWN":
return (icon ? '<i class="fas fa-fw fa-question-circle"></i> ' : '') + "Unknown";
case "PRE_TRANSIT":
return (icon ? '<i class="fas fa-fw fa-circle-notch fa-spin"></i> ' : '') + "Pre-transit";
case "TRANSIT":
return (icon ? '<i class="fas fa-fw fa-chevron-circle-right"></i> ' : '') + "In Transit";
case "DELIVERED":
return (icon ? '<i class="fas fa-fw fa-check-circle"></i> ' : '') + "Delivered";
case "RETURNED":
return (icon ? '<i class="fas fa-fw fa-undo-alt"></i> ' : '') + "Returned";
case "FAILURE":
return (icon ? '<i class="fas fa-fw fa-times-circle"></i> ' : '') + "Failure";
default:
return status;
}
}
function openTrackingHistory(trackingcode) {
var requestfinished = false;
var trackingdialogopen = false;
$.ajax({
url: SETTINGS.trackingapi,
dataType: 'json',
data: {
code: trackingcode
},
timeout: 15 * 1000,
success: function (resp) {
if (trackingdialogopen) {
app.dialog.close();
trackingdialogopen = false;
}
requestfinished = true;
if (resp.status == "OK") {
var infocontext = resp;
infocontext.current.location.display = locationArrayToString(infocontext.current.location);
infocontext.current.date = timestampToDateTimeString(infocontext.current.date);
infocontext.current.status = trackingStatusToNiceString(infocontext.current.status, true);
for (var i = 0; i < infocontext.history.length; i++) {
infocontext.history[i].location.display = locationArrayToString(infocontext.history[i].location);
infocontext.history[i].date = timestampToDateTimeString(infocontext.history[i].date);
infocontext.history[i].status = trackingStatusToNiceString(infocontext.history[i].status, true);
}
// TODO: format timestamps as local time
router.navigate("/toolbox/track/info", {
context: infocontext
});
} else {
playSound("error");
app.dialog.alert(resp.message, "Error");
}
},
error: function (jqXHR, status, errorThrown) {
if (trackingdialogopen) {
app.dialog.close();
searchingdialogopen = false;
}
requestfinished = true;
playSound("error");
app.dialog.alert("There was a network issue while tracking the item. Please try again.", "Error");
}
});
// Open a loading message if there's a delay
setTimeout(function () {
if (!requestfinished) {
app.dialog.preloader("Tracking...");
trackingdialogopen = true;
}
}, 750);
}
$("#trackbtn").click(function () {
var code = $("input[name=trackingcode]").val();
if (code != "" && code.length > 5) {
openTrackingHistory(code);
} else {
app.dialog.alert("That's not a valid tracking code.", "Error");
}
});

@ -27,7 +27,7 @@
></div>
</div>
</div>
<div class="list no-hairlines tablet-inset" style="margin-top: 0;">
<div class="list no-hairlines tablet-inset no-margin-top">
<ul>
<li>
<a href="/manage" class="item-link item-content">
@ -53,6 +53,14 @@
</div>
</a>
</li>
<li>
<a href="/toolbox" class="item-link item-content">
<div class="item-media"><i class="icon fas fa-tools"></i></div>
<div class="item-inner">
<div class="item-title">Toolbox</div>
</div>
</a>
</li>
<li>
<a href="/settings" class="item-link item-content">
<div class="item-media"><i class="icon fas fa-cog"></i></div>

@ -64,33 +64,17 @@
</div>
</li>
<li class="item-divider">Item Type</li>
{{#each itemtypes}}
<li>
<label class="item-radio item-content">
<input type="radio" name="itemtype" value="package" checked />
<input type="radio" name="itemtype" value="{{id}}" {{#if selected}}checked{{/if}} />
<i class="icon icon-radio"></i>
<div class="item-inner">
<div class="item-title"><i class="fas fa-box"></i> Package</div>
</div>
</label>
</li>
<li>
<label class="item-radio item-content">
<input type="radio" name="itemtype" value="letter" />
<i class="icon icon-radio"></i>
<div class="item-inner">
<div class="item-title"><i class="fas fa-envelope"></i> Letter</div>
</div>
</label>
</li>
<li>
<label class="item-radio item-content">
<input type="radio" name="itemtype" value="express" />
<i class="icon icon-radio"></i>
<div class="item-inner">
<div class="item-title"><i class="fas fa-shipping-fast"></i> Express</div>
<div class="item-title"><i class="{{icon}}"></i> {{name}}</div>
</div>
</label>
</li>
{{/each}}
</ul>
</div>
</div>

@ -0,0 +1,41 @@
<!-- 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/. -->
<div class="page" data-name="toolbox">
<div class="navbar">
<div class="navbar-bg"></div>
<div class="navbar-inner">
<div class="left">
<a href="#" class="link icon-only back">
<i class="icon icon-back"></i>
</a>
</div>
<div class="title">Toolbox</div>
</div>
</div>
<div class="page-content">
<div class="list no-hairlines tablet-inset" style="margin-top: 0;">
<ul>
<li>
<a href="/toolbox/track" class="item-link item-content">
<div class="item-media"><i class="icon fas fa-search-location"></i></div>
<div class="item-inner">
<div class="item-title">Track Item</div>
</div>
</a>
</li>
<!--<li>
<a href="/toolbox/scanner" class="item-link item-content">
<div class="item-media"><i class="icon fas fa-barcode"></i></div>
<div class="item-inner">
<div class="item-title">Scan for Delivery</div>
</div>
</a>
</li>-->
</ul>
</div>
</div>
</div>

@ -0,0 +1,48 @@
<!-- 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/. -->
<div class="page" data-name="track">
<div class="navbar">
<div class="navbar-bg"></div>
<div class="navbar-inner">
<div class="left">
<a href="#" class="link icon-only back">
<i class="icon icon-back"></i>
</a>
</div>
<div class="title">Track Item</div>
</div>
</div>
<div class="page-content">
<div class="list no-hairlines tablet-inset">
<ul>
<li class="item-content item-input">
<div class="item-inner">
<div class="item-title item-label">Tracking Code</div>
<div class="item-input-wrap">
<input type="text" name="trackingcode" placeholder="" autocomplete="off" autocorrect="off" autocapitalize="off" />
<span class="input-clear-button"></span>
</div>
</div>
</li>
<!--
TODO: Add barcode scanning
<li>
<a class="item-link list-button" id="scancodebtn"><i class="fas fa-barcode"></i> Scan Barcode</a>
</li>-->
<li>
<a class="item-link list-button" id="trackbtn"><i class="fas fa-search-location"></i> Track</a>
</li>
</ul>
</div>
<div class="block">
Compatible with USPS, UPS, FedEx, and DHL tracking codes.
</div>
</div>
<script src="assets/js/toolbox_track.js"></script>
</div>

@ -0,0 +1,70 @@
<!-- 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/. -->
<div class="page" data-name="trackinginfo">
<div class="navbar">
<div class="navbar-bg"></div>
<div class="navbar-inner">
<div class="left">
<a href="#" class="link icon-only back">
<i class="icon icon-back"></i>
</a>
</div>
<div class="title">Tracking Status</div>
</div>
</div>
<div class="page-content">
<div class="list media-list no-hairlines tablet-inset no-margin-top">
<ul>
<li class="item-divider">Current Status</li>
<li>
<div class="item-content">
<div class="item-inner">
{{#with current}}
<div class="item-title-row">
<div class="item-title">{{status}}</div>
<div class="item-after">{{date}}</div>
</div>
<div class="item-text">{{details}}</div>
<div class="item-text"><b>{{location.display}}</b></div>
{{/with}}
<div class="item-text">{{carrier.name}} | {{service.name}}</div>
</div>
</div>
</li>
<li class="item-divider">Item Info</li>
<li>
<div class="item-content">
<div class="item-inner">
<div class="item-text">Tracking Code: {{code}}</div>
<div class="item-text">Carrier: {{carrier.name}} | {{service.name}}</div>
</div>
</div>
</li>
<li class="item-divider">History</li>
{{#each history}}
<li>
<div class="item-content">
<div class="item-inner">
<div class="item-title-row">
<div class="item-title">{{status}}</div>
<div class="item-after">{{date}}</div>
</div>
<div class="item-text">{{details}}</div>
<div class="item-text"><b>{{location.display}}</b></div>
</div>
</div>
</li>
{{else}}
<li class="item-content">
No item history found.
</li>
{{/each}}
</ul>
</div>
</div>
</div>

@ -27,7 +27,12 @@ var routes = [
},
{
path: '/manage',
url: './pages/manage.html',
templateUrl: './pages/manage.html',
options: {
context: {
itemtypes: SETTINGS.itemtypes
}
},
name: 'manage',
on: {
pageAfterIn: function () {
@ -83,6 +88,21 @@ var routes = [
}
}
},
{
path: '/toolbox',
url: './pages/toolbox.html',
name: 'toolbox'
},
{
path: '/toolbox/track',
url: './pages/toolbox/track.html',
name: 'track'
},
{
path: '/toolbox/track/info',
templateUrl: './pages/toolbox/trackinginfo.html',
name: 'trackinginfo'
},
{
path: '/credits',
url: './pages/credits.html',

@ -40,5 +40,44 @@ var SETTINGS = {
file: "alert.sonar.mp3"
}
},
geocodeapi: "https://apis.netsyms.net/packagehelper/geocode.php"
itemtypes: {
package: {
id: "package",
name: "Package",
icon: "fas fa-box fa-fw",
mapicon: "box",
pluralmapicon: "boxes",
selected: true
},
letter: {
id: "letter",
name: "Letter",
icon: "fas fa-envelope fa-fw",
mapicon: "envelope",
pluralmapicon: "envelopes"
},
signature: {
id: "signature",
name: "Signature",
icon: "fas fa-file-signature fa-fw",
mapicon: "signature",
pluralmapicon: "signatures"
},
large: {
id: "large",
name: "Large Package",
icon: "fas fa-pallet fa-fw",
mapicon: "largebox",
pluralmapicon: "largeboxes"
},
express: {
id: "express",
name: "Express",
icon: "fas fa-shipping-fast fa-fw",
mapicon: "express",
pluralmapicon: "multiple-items"
}
},
geocodeapi: "https://apis.netsyms.net/packagehelper/geocode.php",
trackingapi: "https://apis.netsyms.net/packagehelper/track.php"
}

Loading…
Cancel
Save