Fix bugs
This commit is contained in:
parent
825565a9b1
commit
e6b561f944
@ -52,11 +52,15 @@ $("#app").on("click", "#package-info-sheet #package-info-get-directions", functi
|
||||
window.open($(this).attr("href"), "_system");
|
||||
});
|
||||
|
||||
function openPackageInfoSheet(package, refreshOnly) {
|
||||
function openPackageInfoSheet(coordid, refreshOnly) {
|
||||
if (typeof refreshOnly == "undefined") {
|
||||
refreshOnly = false;
|
||||
}
|
||||
|
||||
for (var i = 0; i < packages.length; i++) {
|
||||
if (packages[i].id == coordid) {
|
||||
package = packages[i];
|
||||
|
||||
$("#package-info-get-directions").attr("href", "geo:" + package.coords[0] + "," + package.coords[1]);
|
||||
$("#package-info-sheet-inner").html("");
|
||||
|
||||
@ -81,6 +85,8 @@ function openPackageInfoSheet(package, refreshOnly) {
|
||||
app.sheet.create({el: "#package-info-sheet"}).open();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setMapLocation(latitude, longitude) {
|
||||
if (map == null) {
|
||||
|
@ -78,7 +78,7 @@ function leafletMap() {
|
||||
icon: icon
|
||||
})
|
||||
.on("click", function () {
|
||||
openPackageInfoSheet(data[i]);
|
||||
openPackageInfoSheet(data[i].id);
|
||||
});
|
||||
|
||||
map.packagelayer.addLayer(marker);
|
||||
|
@ -17,7 +17,7 @@ if (localStorage.getItem("packages") != null) {
|
||||
*/
|
||||
function getUndeliveredCount(address) {
|
||||
var undelivered = 0;
|
||||
for (var i = 0; i < address.items.length; j++) {
|
||||
for (var i = 0; i < address.items.length; i++) {
|
||||
if (!address.items[i].delivered) {
|
||||
undelivered++;
|
||||
}
|
||||
@ -28,7 +28,7 @@ function getUndeliveredCount(address) {
|
||||
function addPackage(address, latitude, longitude) {
|
||||
var added = false;
|
||||
for (var i = 0; i < packages.length; i++) {
|
||||
if (packages[i].coords == [latitude, longitude] && packages[i].address == address) {
|
||||
if (packages[i].coords[0] == latitude && packages[i].coords[1] == longitude && packages[i].address == address) {
|
||||
packages[i].items.push({
|
||||
address: address,
|
||||
delivered: false,
|
||||
|
Loading…
x
Reference in New Issue
Block a user