forked from Netsyms/PackageHelper
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
/*
|
|
* To change this license header, choose License Headers in Project Properties.
|
|
* To change this template file, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
|
|
var packages = [];
|
|
|
|
if (localStorage.getItem("packages") != null) {
|
|
packages = JSON.parse(localStorage.getItem("packages"));
|
|
}
|
|
|
|
function confirmDeletePackage(id) {
|
|
app.dialog.confirm(
|
|
"Delete package at " + packages[id].address + "?",
|
|
"Confirm",
|
|
function () {
|
|
// delete
|
|
packages.splice(id, 1);
|
|
localStorage.setItem("packages", JSON.stringify(packages));
|
|
loadPackageList();
|
|
},
|
|
function () {
|
|
// cancel
|
|
}
|
|
);
|
|
}
|
|
|
|
function deletePackage(id) {
|
|
packages.splice(id, 1);
|
|
localStorage.setItem("packages", JSON.stringify(packages));
|
|
loadPackageList();
|
|
}
|
|
|
|
function countRemainingPackages() {
|
|
var undelivered = 0;
|
|
for (var i = 0; i < packages.length; i++) {
|
|
if (packages[i].delivered != true) {
|
|
undelivered++;
|
|
}
|
|
}
|
|
return undelivered;
|
|
} |