grocy/js/viewjs/locationcontentsheet.js
Katharina Bogad 2a7fbbecf8 Fix bugs
2021-06-24 22:18:19 +02:00

29 lines
782 B
JavaScript

function locationcontentsheetView(Grocy, scope = null)
{
var $scope = $;
var top = scope != null ? $(scope) : $(document);
if (scope != null)
{
$scope = (selector) => $(scope).find(selector);
}
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