|
|
|
@ -51,6 +51,31 @@ function brokenScannerAddTextEntry() {
|
|
|
|
|
|
|
|
|
|
function addCodeToScannerList(code) {
|
|
|
|
|
code = code.toUpperCase();
|
|
|
|
|
|
|
|
|
|
var signatureregexes = [
|
|
|
|
|
/^E[A-Z][0-9]{9}US$/, // Priority Mail Express
|
|
|
|
|
/^[RV][A-Z][0-9]{9}[A-Z]{2}$/, // Registered mail
|
|
|
|
|
/^(420[0-9]{5})?7[0-9]{19}$/ // Certified Mail
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Regex of IMpb codes that don't need anything special
|
|
|
|
|
* @type {RegExp}
|
|
|
|
|
*/
|
|
|
|
|
var stcregex = /^(420[0-9]{5})?[0-9]{2}(001|023|055|056|112|113|134|135|138|140|141|142|164|209|211|259|265|269|346|361|389|390|419|431|490|502|551|563|612|624|671|701|702|703|704|723|746|748|790|791|793|794|905|906|907|909|971|972)[0-9]+$/;
|
|
|
|
|
|
|
|
|
|
var signatureRequired = false;
|
|
|
|
|
for (var i = 0; i < signatureregexes.length; i++) {
|
|
|
|
|
if (code.match(signatureregexes[i])) {
|
|
|
|
|
signatureRequired = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!code.match(stcregex)) {
|
|
|
|
|
signatureRequired = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var codeEntryTemplate = Template7.compile('<li class="codelist-entry" data-code="{{code}}">'
|
|
|
|
|
+ ' <div class="item-content">'
|
|
|
|
|
+ ' <div class="item-inner">'
|
|
|
|
@ -58,9 +83,40 @@ function addCodeToScannerList(code) {
|
|
|
|
|
+ ' </div>'
|
|
|
|
|
+ ' </div>'
|
|
|
|
|
+ '</li>');
|
|
|
|
|
$("#codelist").append(codeEntryTemplate({
|
|
|
|
|
code: code
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
if (signatureRequired) {
|
|
|
|
|
if (code.match(/^E[A-Z][0-9]{9}US$/)) {
|
|
|
|
|
app.dialog.confirm(
|
|
|
|
|
"Does this item contain a waiver of signature endorsement?",
|
|
|
|
|
"Express Item",
|
|
|
|
|
function () {
|
|
|
|
|
$("#codelist").append(codeEntryTemplate({
|
|
|
|
|
code: code
|
|
|
|
|
}));
|
|
|
|
|
},
|
|
|
|
|
function () {
|
|
|
|
|
// cancel
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
app.dialog.confirm(
|
|
|
|
|
"It looks like this item might require a signature or other special procedures. Add it anyways?",
|
|
|
|
|
"Signature Item",
|
|
|
|
|
function () {
|
|
|
|
|
$("#codelist").append(codeEntryTemplate({
|
|
|
|
|
code: code
|
|
|
|
|
}));
|
|
|
|
|
},
|
|
|
|
|
function () {
|
|
|
|
|
// cancel
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$("#codelist").append(codeEntryTemplate({
|
|
|
|
|
code: code
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function chooseScanEvent() {
|
|
|
|
|