grocy/js/viewjs/locationcontentsheet.js
2021-06-24 00:11:44 +02:00

29 lines
776 B
JavaScript

function locationcontentsheetView(Grocy, scope = null)
{
var $scope = $;
var top = scope != null ? $(scope) : $(document);
if (scope != null)
{
$scope = (scope) => $(scope).find(scope);
}
top.on("click", ".print-all-locations-button", function(e)
{
$scope(".page").removeClass("d-print-none").removeClass("no-page-break");
$scope(".print-timestamp").text(moment().format("l LT"));
window.print();
});
top.on("click", ".print-single-location-button", function(e)
{
$scope(".page").addClass("d-print-none");
$scope(e.currentTarget).closest(".page").removeClass("d-print-none").addClass("no-page-break");
$scope(".print-timestamp").text(moment().format("l LT"));
window.print();
});
}
window.locationcontentsheetView = locationcontentsheetView