Add ALPHA scan-to-add feature for UPS MI and FedEx barcodes, bump version
This commit is contained in:
parent
adda98320f
commit
bb55884003
@ -1,5 +1,5 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<widget id="com.netsyms.PackageHelper" version="1.5.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
||||
<widget id="com.netsyms.PackageHelper" version="1.5.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
||||
<name>PackageHelper</name>
|
||||
<description>
|
||||
Assistant app for door-to-door package delivery.
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "com.netsyms.packagehelper",
|
||||
"displayName": "PackageHelper",
|
||||
"version": "1.5.0",
|
||||
"version": "1.5.1",
|
||||
"description": "Assistant app for door-to-door package delivery.",
|
||||
"product_string": "PackageHelper",
|
||||
"main": "www/index.html",
|
||||
|
@ -4,6 +4,35 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
$(".scanbarcodebtn").click(function () {
|
||||
scanBarcode(function (code) {
|
||||
playSound("scan");
|
||||
if (code != "" && (code.match(/^([^\\t]*\\t[^\\t]*){13}$/) || code.match(/.*\\x1D.*/))) {
|
||||
addPackageByBarcode(code, $("input[name=itemtype]:checked").val(),
|
||||
function (ids) {
|
||||
var packageObj = getPackage(ids.packageID);
|
||||
// Reset item type to default
|
||||
$("input[name=itemtype][data-default=1]").prop("checked", true);
|
||||
$("#historylist").prepend('<li class="history-list-item item-content" data-package="' + ids.packageID + '">'
|
||||
+ ' <div class="item-media">'
|
||||
+ ' <i class="icon ' + getIconForType(packageObj.type) + '"></i>'
|
||||
+ ' </div>'
|
||||
+ ' <div class="item-inner">'
|
||||
+ ' <div class="item-title">'
|
||||
+ ' ' + packageObj.address
|
||||
+ ' </div>'
|
||||
+ ' </div>'
|
||||
+ '</li>');
|
||||
$("#tap-to-remove-history-prompt").removeClass("display-none");
|
||||
});
|
||||
} else {
|
||||
app.dialog.alert("That barcode doesn't contain the required data.", "Error");
|
||||
}
|
||||
}, function (error) {
|
||||
app.dialog.alert(error, "Error");
|
||||
});
|
||||
});
|
||||
|
||||
$(".addpackagebtn").click(function () {
|
||||
if ($("input[name=number]").val().trim() == "") {
|
||||
playSound("error");
|
||||
|
@ -607,6 +607,122 @@ function addPackageByAddress(number, unit, street, citystate, zip, type, callbac
|
||||
}
|
||||
}
|
||||
|
||||
function addPackageByBarcode(barcode, type, callback) {
|
||||
var requestfinished = false;
|
||||
var searchingdialogopen = false;
|
||||
var deadline = false;
|
||||
|
||||
var ajaxlookup = function () {
|
||||
$.ajax({
|
||||
url: SETTINGS.geocodebarcodeapi,
|
||||
dataType: 'json',
|
||||
data: {
|
||||
code: barcode,
|
||||
type: SETTINGS.itemtypes[type].allowedlocationtypes
|
||||
},
|
||||
timeout: 15 * 1000,
|
||||
success: function (resp) {
|
||||
if (searchingdialogopen) {
|
||||
app.dialog.close();
|
||||
searchingdialogopen = false;
|
||||
}
|
||||
requestfinished = true;
|
||||
if (resp.status == "OK") {
|
||||
if (resp.accuracy.ok) {
|
||||
addPackage(resp.address.street, resp.coords[0], resp.coords[1], type, callback, deadline);
|
||||
} else {
|
||||
playSound("error");
|
||||
app.dialog.alert("The scanned address couldn't be reliably located.", "Error");
|
||||
}
|
||||
} else {
|
||||
playSound("error");
|
||||
app.dialog.alert(resp.message, "Error");
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, status, errorThrown) {
|
||||
if (searchingdialogopen) {
|
||||
app.dialog.close();
|
||||
searchingdialogopen = false;
|
||||
}
|
||||
requestfinished = true;
|
||||
playSound("error");
|
||||
app.dialog.alert("There was a network issue while looking up the barcode. Please try again.", "Error");
|
||||
}
|
||||
});
|
||||
|
||||
// Open a loading message if there's a delay finding the address
|
||||
setTimeout(function () {
|
||||
if (!requestfinished) {
|
||||
app.dialog.preloader("Looking up barcode...");
|
||||
searchingdialogopen = true;
|
||||
}
|
||||
}, 750);
|
||||
}
|
||||
|
||||
var prelookup = function () {
|
||||
if (type == "express") {
|
||||
if (getStorage("deadlinealarm_minutes") == null) {
|
||||
setStorage("deadlinealarm_minutes", 20);
|
||||
}
|
||||
var minutes = getStorage("deadlinealarm_minutes");
|
||||
app.dialog.create({
|
||||
title: 'Express Item',
|
||||
text: 'Set a reminder for ' + minutes + ' minutes before:',
|
||||
buttons: [
|
||||
{
|
||||
text: '10:30 AM',
|
||||
close: true
|
||||
},
|
||||
{
|
||||
text: '12:00 PM',
|
||||
close: true
|
||||
},
|
||||
{
|
||||
text: '3:00 PM',
|
||||
close: true
|
||||
},
|
||||
{
|
||||
text: "No reminder",
|
||||
color: "red",
|
||||
close: true
|
||||
}
|
||||
],
|
||||
verticalButtons: true,
|
||||
onClick: function (dialog, index) {
|
||||
deadline = new Date();
|
||||
switch (index) {
|
||||
case 0:
|
||||
deadline.setMinutes(30);
|
||||
deadline.setHours(10);
|
||||
break;
|
||||
case 1:
|
||||
deadline.setMinutes(00);
|
||||
deadline.setHours(12);
|
||||
break;
|
||||
case 2:
|
||||
deadline.setMinutes(00);
|
||||
deadline.setHours(12 + 3);
|
||||
break;
|
||||
case 3:
|
||||
default:
|
||||
deadline = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (deadline != false) {
|
||||
deadline = deadline.getTime() / 1000;
|
||||
}
|
||||
ajaxlookup();
|
||||
}
|
||||
}).open();
|
||||
} else {
|
||||
ajaxlookup();
|
||||
}
|
||||
}
|
||||
|
||||
prelookup();
|
||||
}
|
||||
|
||||
function checkDeadlines() {
|
||||
if (getStorage("deadlinealarm_minutes") == null) {
|
||||
setStorage("deadlinealarm_minutes", 20);
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "PackageHelper",
|
||||
"version": "1.5.0",
|
||||
"version": "1.5.1",
|
||||
"main": "index.html",
|
||||
"license": "MPL-2.0",
|
||||
"dependencies": {
|
||||
|
@ -15,6 +15,9 @@
|
||||
</div>
|
||||
<div class="title">Add Items</div>
|
||||
<div class="right">
|
||||
<a class="link scanbarcodebtn">
|
||||
<i class="icon material-icons">center_focus_strong</i>
|
||||
</a>
|
||||
<a class="link popover-open" data-popover="#popover-add-options">
|
||||
<i class="icon material-icons">more_vert</i>
|
||||
</a>
|
||||
@ -55,6 +58,9 @@
|
||||
</div>
|
||||
<div class="title">Add Items</div>
|
||||
<div class="right">
|
||||
<a class="link scanbarcodebtn">
|
||||
<i class="icon material-icons">center_focus_strong</i>
|
||||
</a>
|
||||
<a class="link popover-open" data-popover="#popover-add-options">
|
||||
<i class="icon material-icons">more_vert</i>
|
||||
</a>
|
||||
@ -119,7 +125,7 @@
|
||||
<li>
|
||||
<label class="item-radio item-content">
|
||||
<input type="radio" name="itemtype" value="{{id}}" {{#if selected}}data-default="1" checked{{/if}} />
|
||||
<i class="icon icon-radio"></i>
|
||||
<i class="icon icon-radio"></i>
|
||||
<div class="item-inner">
|
||||
<div class="item-title"><i class="{{icon}}"></i> {{name}}</div>
|
||||
</div>
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
var SETTINGS = {
|
||||
cacheversion: "v1.5.0_0",
|
||||
cacheversion: "v1.5.1_0",
|
||||
activitylog_maxlength: 500,
|
||||
maptileurls: {
|
||||
liberty: {
|
||||
@ -355,6 +355,7 @@ var SETTINGS = {
|
||||
],
|
||||
geocodecacheexpiry: 604800, // One week
|
||||
geocodeapi: "https://apis.netsyms.net/packagehelper/geocode.php",
|
||||
geocodebarcodeapi: "https://apis.netsyms.net/packagehelper/geocode_barcode.php",
|
||||
trackingapi: "https://apis.netsyms.net/packagehelper/track.php",
|
||||
weatherapi: "https://apis.netsyms.net/packagehelper/weather.php",
|
||||
geoipapi: "https://apis.netsyms.net/packagehelper/geoip.php",
|
||||
|
Loading…
x
Reference in New Issue
Block a user