Add "deliver all" button to map panel (close #54)
This commit is contained in:
parent
3cb322cb31
commit
a11a342454
@ -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 = "";
|
||||
@ -121,6 +137,7 @@ function openPackageInfoSheet(coordid, refreshOnly) {
|
||||
if (!refreshOnly) {
|
||||
app.sheet.create({el: "#package-info-sheet"}).open();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-inner">
|
||||
<a class="link geolink" id="package-info-get-directions"><i class="material-icons">directions</i></a>
|
||||
<a class="link color-green" id="package-info-deliver-all" href="#"><i class="far fa-check-circle fa-fw"></i> Deliver All</a>
|
||||
<a class="link sheet-close" href="#">Done</a>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user