mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
evoluindo na função imprimir fichas
This commit is contained in:
@@ -47,7 +47,6 @@ Detalhes {{comanda.name}}
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{{item.product.name}}</td>
|
<td>{{item.product.name}}</td>
|
||||||
<td>R$ {{item.product.price}}</td>
|
<td>R$ {{item.product.price}}</td>
|
||||||
<!-- <td><button id="open_remove_product_comanda" onclick="open_remove_product_comanda()">🗑️ Apagar</button></td> -->
|
|
||||||
<td><button hx-get="{% url 'removeProductComanda' item.id %} " hx-trigger="click" hx-target="#list-products-comanda" onclick="open_remove_product_comanda()">🗑️ Apagar</button></td>
|
<td><button hx-get="{% url 'removeProductComanda' item.id %} " hx-trigger="click" hx-target="#list-products-comanda" onclick="open_remove_product_comanda()">🗑️ Apagar</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -18,12 +18,28 @@ function removeCloseModal() {
|
|||||||
|
|
||||||
function imprimirFichas() {
|
function imprimirFichas() {
|
||||||
const element = document.getElementById("list-products-comanda");
|
const element = document.getElementById("list-products-comanda");
|
||||||
|
const style = `<style>
|
||||||
|
td, th {
|
||||||
|
|
||||||
|
border-collapse: collapse;
|
||||||
|
padding-top: 35px;
|
||||||
|
margin: 20px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 24px;}
|
||||||
|
</style>`;
|
||||||
|
const agora = new Date();
|
||||||
|
var dateString = agora.getDay() + '/' + agora.getMonth() + '/' + agora.getFullYear() + ' - ' + agora.getHours() + ':' + agora.getMinutes()+' - Raul Rock Bar & Café';
|
||||||
|
|
||||||
if (element) {
|
if (element) {
|
||||||
var content = element.innerHTML;
|
var content = element.innerHTML;
|
||||||
console.log(content);
|
// console.log(content);
|
||||||
content = content.replace(/<button[^>]*>(?:(?!<\/button>)[\s\S])*<\/button>/gi,'');
|
content = content.replace(/<button[^>]*>(?:(?!<\/button>)[\s\S])*<\/button>/gi,'');
|
||||||
const printWindow = window.open('', '_blank');
|
content = content.replace(/<th[^>]*>(?:(?!<\/th>)[\s\S])*<\/th>/gi,'');
|
||||||
printWindow.document.write('<table>'+content+'</table>');
|
content = content.replace(/<\/tr>/g,'</tr><tr><td colspan="2" style="font-size: 12px">'+dateString+'</td></tr>');
|
||||||
|
console.log(content);
|
||||||
|
|
||||||
|
var printWindow = window.open('', '_blank');
|
||||||
|
printWindow.document.write('<table>'+content+'</table>'+style);
|
||||||
printWindow.document.close();
|
printWindow.document.close();
|
||||||
printWindow.print();
|
printWindow.print();
|
||||||
printWindow.close();
|
printWindow.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user