diff --git a/www/assets/js/map.js b/www/assets/js/map.js index 8518746..a1cf616 100644 --- a/www/assets/js/map.js +++ b/www/assets/js/map.js @@ -80,6 +80,21 @@ $("#app").on("sheet:close", "#package-info-sheet", function () { $(".package-marker").removeClass("selected"); }); +$("#app").on("click", "#package-info-sheet #package-info-deliver-all", function () { + var coordid = $(this).data("coordid"); + for (var i = 0; i < packages.length; i++) { + if (packages[i].id == coordid) { + package = packages[i]; + for (var j = 0; j < package.items.length; j++) { + markDelivered(package.items[j].id); + } + break; + } + } + map.updatePackageLayer(packages); + openPackageInfoSheet(coordid, true); +}); + function openPackageInfoSheet(coordid, refreshOnly) { if (typeof refreshOnly == "undefined") { refreshOnly = false; @@ -97,6 +112,7 @@ function openPackageInfoSheet(coordid, refreshOnly) { $("#package-info-get-directions").attr("href", "geo:" + package.coords[0] + "," + package.coords[1]); $("#package-info-sheet-inner .list ul").html(""); + $("#package-info-deliver-all").data("coordid", coordid); for (var j = 0; j < package.items.length; j++) { var classes = ""; @@ -118,9 +134,10 @@ function openPackageInfoSheet(coordid, refreshOnly) { + ''); } - if (!refreshOnly) { + if (!refreshOnly) { app.sheet.create({el: "#package-info-sheet"}).open(); } + break; } } } diff --git a/www/pages/map.html b/www/pages/map.html index d70ba15..92a867f 100644 --- a/www/pages/map.html +++ b/www/pages/map.html @@ -36,6 +36,7 @@
directions + Deliver All Done