Add buttons to open geo: url for packages (close #15)
This commit is contained in:
parent
1d0f6c825e
commit
991a82892e
@ -29,6 +29,7 @@
|
||||
<allow-intent href="sms:*" />
|
||||
<allow-intent href="mailto:*" />
|
||||
<allow-intent href="geo:*" />
|
||||
<access launch-external="yes" origin="geo:*" />
|
||||
<platform name="android">
|
||||
<allow-intent href="market:*" />
|
||||
</platform>
|
||||
@ -36,9 +37,9 @@
|
||||
<allow-intent href="itms:*" />
|
||||
<allow-intent href="itms-apps:*" />
|
||||
</platform>
|
||||
<engine name="android" spec="~8.0.0" />
|
||||
<plugin name="cordova-plugin-geolocation" spec="~4.0.2" />
|
||||
<plugin name="cordova-plugin-whitelist" spec="1" />
|
||||
<plugin name="cordova-plugin-inappbrowser" spec="~3.1.0" />
|
||||
<plugin name="cordova-plugin-powermanagement-netsyms" />
|
||||
<engine name="android" spec="~8.0.0" />
|
||||
</widget>
|
||||
|
@ -4,33 +4,20 @@
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
$(".view-main").on("click", "#addresslist .package-list-item .item-content", function () {
|
||||
$(".view-main").on("click", "#addresslist .package-list-item .deliver-btn", function () {
|
||||
var pid = $(this).data("packageid");
|
||||
if (typeof packages[pid].delivered == "undefined" || packages[pid].delivered == false) {
|
||||
packages[pid].delivered = true;
|
||||
localStorage.setItem("packages", JSON.stringify(packages));
|
||||
loadPackageList();
|
||||
} else {
|
||||
app.dialog.confirm(
|
||||
packages[pid].address,
|
||||
"Mark Undelivered",
|
||||
function () {
|
||||
// undeliver
|
||||
packages[pid].delivered = false;
|
||||
localStorage.setItem("packages", JSON.stringify(packages));
|
||||
loadPackageList();
|
||||
},
|
||||
function () {
|
||||
// cancel
|
||||
}
|
||||
);
|
||||
packages[pid].delivered = false;
|
||||
}
|
||||
localStorage.setItem("packages", JSON.stringify(packages));
|
||||
loadPackageList();
|
||||
});
|
||||
|
||||
$(".view-main").on("mousedown", "#addresslist .package-list-item .item-content", function (e) {
|
||||
if (e.button == 2) {
|
||||
confirmDeletePackage($(this).data("packageid"));
|
||||
}
|
||||
// Open geo: url
|
||||
$(".view-main").on("click", "#addresslist .package-list-item .directions-btn", function () {
|
||||
window.open($(this).attr("href"), "_blank");
|
||||
});
|
||||
|
||||
$(".view-main").on("swipeout:delete", "#addresslist .package-list-item", function () {
|
||||
@ -123,7 +110,9 @@ function loadPackageList(sortType) {
|
||||
for (var i = 0; i < sortedPackages.length; i++) {
|
||||
var icon = "fas fa-box-open";
|
||||
var classes = "";
|
||||
var delivered = false;
|
||||
if (sortedPackages[i].value.delivered == true) {
|
||||
delivered = true;
|
||||
icon = "fas fa-check";
|
||||
classes = "text-color-green";
|
||||
} else if (typeof sortedPackages[i].value.distance != 'undefined' && sortedPackages[i].value.distance * 1 < localStorage.getItem("alertradius") * 1) {
|
||||
@ -144,8 +133,12 @@ function loadPackageList(sortType) {
|
||||
+ ' </div>'
|
||||
+ ' </div>'
|
||||
+ '</div>'
|
||||
+ '<div class="swipeout-actions-left">'
|
||||
+ ' <a href="#" class="color-green deliver-btn" data-packageid="' + sortedPackages[i].index + '">' + (delivered ? "<i class='fas fa-undo'></i> Mark Undelivered" : "<i class='fas fa-check'></i> Mark Delivered") + '</a>'
|
||||
+ ' <a href="geo:' + sortedPackages[i].value.coords[0] + ',' + sortedPackages[i].value.coords[1] + '" class="color-blue directions-btn"><i class="fas fa-route"></i> Directions</a>'
|
||||
+ '</div>'
|
||||
+ '<div class="swipeout-actions-right">'
|
||||
+ ' <a href="#" class="swipeout-delete">Delete</a>'
|
||||
+ ' <a href="#" class="swipeout-delete"><i class="fas fa-trash"></i> Delete</a>'
|
||||
+ '</div>'
|
||||
+ '</li>'
|
||||
);
|
||||
|
@ -61,6 +61,10 @@ $("#app").on("click", "#package-info-sheet #package-info-toggle-status", functio
|
||||
}
|
||||
});
|
||||
|
||||
$("#app").on("click", "#package-info-sheet #package-info-get-directions", function () {
|
||||
window.open($(this).attr("href"), "_blank");
|
||||
});
|
||||
|
||||
function openPackageInfoSheet(package, refreshOnly) {
|
||||
if (typeof refreshOnly == "undefined") {
|
||||
refreshOnly = false;
|
||||
@ -69,6 +73,7 @@ function openPackageInfoSheet(package, refreshOnly) {
|
||||
return p == package;
|
||||
}));
|
||||
$("#package-info-address").text(package.address);
|
||||
$("#package-info-get-directions").attr("href", "geo:" + package.coords[0] + "," + package.coords[1]);
|
||||
if (package.delivered) {
|
||||
$("#package-info-delivery-status").html('<span class="text-color-green"><i class="fas fa-check-circle"></i> Delivered</span>');
|
||||
$("#package-info-toggle-status").text("Mark undelivered");
|
||||
|
@ -32,12 +32,17 @@
|
||||
<div class="sheet-modal" id="package-info-sheet">
|
||||
<div class="toolbar">
|
||||
<div class="toolbar-inner">
|
||||
<div class="left padding-left"><span id="package-info-delivery-status"></span></div>
|
||||
<div class="left padding-left">
|
||||
<a class="link" id="package-info-get-directions"><i class="fas fa-route"></i></a>
|
||||
</div>
|
||||
<div class="right"><a class="link sheet-close" href="#">Done</a></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sheet-modal-inner">
|
||||
<div class="block margin-top-half">
|
||||
<div>
|
||||
<span id="package-info-delivery-status"></span>
|
||||
</div>
|
||||
<h3>
|
||||
<span id="package-info-address">...</span>
|
||||
</h3>
|
||||
|
Loading…
x
Reference in New Issue
Block a user