Files
Backend-Api/ServiceHost/wwwroot/AssetsClient/pages/Checkouts/js/PrintOneRollCall.js
2024-10-05 19:27:04 +03:30

33 lines
945 B
JavaScript

if (window.matchMedia('(max-width: 767px)').matches) {
$(document).ready(function() {
window.onbeforeprint = (event) => {
$("#MainModal").modal("hide");
}
document.getElementById("MainModal").style.visibility = "hidden";
setTimeout(function () {
printElement(document.getElementById("printThis"));
},500);
});
} else {
document.getElementById("btnPrint").onclick = function () {
printElement(document.getElementById("printThis"));
}
}
function printElement(elem) {
var domClone = elem.cloneNode(true);
var $printSection = document.getElementById("printSection");
if (!$printSection) {
$printSection = document.createElement("div");
$printSection.id = "printSection";
document.body.appendChild($printSection);
}
$printSection.innerHTML = "";
$printSection.appendChild(domClone);
window.print();
}