mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
função imprimir fichas
This commit is contained in:
@@ -23,7 +23,7 @@ Detalhes {{comanda.name}}
|
|||||||
<div>
|
<div>
|
||||||
<button class="primary" id="openModal">Adicionar Produto</button>
|
<button class="primary" id="openModal">Adicionar Produto</button>
|
||||||
<button id="pagarComanda">Pagar Comanda</button>
|
<button id="pagarComanda">Pagar Comanda</button>
|
||||||
<button class="button" id="imprimirFichas">Imprimir Fichas</button>
|
<button class="button" id="imprimirFichas" onclick="imprimirFichas()">Imprimir Fichas</button>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Binary file not shown.
@@ -16,7 +16,21 @@ function removeCloseModal() {
|
|||||||
document.getElementById('remove-product-comanda').style.display = 'none';
|
document.getElementById('remove-product-comanda').style.display = 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function imprimirFichas() {
|
||||||
|
const element = document.getElementById("list-products-comanda");
|
||||||
|
if (element) {
|
||||||
|
var content = element.innerHTML;
|
||||||
|
console.log(content);
|
||||||
|
content = content.replace(/<button[^>]*>(?:(?!<\/button>)[\s\S])*<\/button>/gi,'');
|
||||||
|
const printWindow = window.open('', '_blank');
|
||||||
|
printWindow.document.write('<table>'+content+'</table>');
|
||||||
|
printWindow.document.close();
|
||||||
|
printWindow.print();
|
||||||
|
printWindow.close();
|
||||||
|
} else {
|
||||||
|
console.error(`Element with ID not found`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -24,7 +38,7 @@ document.getElementById('openModal').addEventListener('click', openModal);
|
|||||||
|
|
||||||
document.getElementById('productForm').addEventListener('submit', function(event) {
|
document.getElementById('productForm').addEventListener('submit', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user