feat: botão imprimir pedido cozinha

This commit is contained in:
2025-03-20 17:02:28 -03:00
parent 6d9693bc26
commit 725e566d74
9 changed files with 53 additions and 2 deletions

Binary file not shown.

View File

@@ -83,7 +83,7 @@ Detalhes {{comanda.name}}
{% for item in consumo%} {% for item in consumo%}
<tr> <tr>
<td > <td id="id-for-print-{{item.id}}">
{{item.product.name}} {{item.product.name}}
{% if item.product.cuisine == True %} {% if item.product.cuisine == True %}
<span data-tooltip="Observações para preparo." data-flow="top"> <span data-tooltip="Observações para preparo." data-flow="top">
@@ -94,6 +94,12 @@ Detalhes {{comanda.name}}
style="width: 25px; height: 35px; cursor: pointer;"> style="width: 25px; height: 35px; cursor: pointer;">
</img> </img>
</span> </span>
<img
onclick="printOrder({{item.id}})"
src="{% static 'midia/icons/print.svg' %}"
style="width: 35px; height: 35px; cursor: pointer;">
</img>
{% endif %} {% endif %}
</td> </td>

Binary file not shown.

View File

@@ -8,7 +8,7 @@
{% for item in consumo%} {% for item in consumo%}
<tr> <tr>
<td > <td id="id-for-print-{{item.id}}">
{{item.product.name}} {{item.product.name}}
{% if item.product.cuisine == True %} {% if item.product.cuisine == True %}
<span data-tooltip="Observações para preparo." data-flow="top"> <span data-tooltip="Observações para preparo." data-flow="top">
@@ -19,6 +19,12 @@
style="width: 25px; height: 35px; cursor: pointer;"> style="width: 25px; height: 35px; cursor: pointer;">
</img> </img>
</span> </span>
<img
onclick="printOrder({{item.id}})"
src="{% static 'midia/icons/print.svg' %}"
style="width: 35px; height: 35px; cursor: pointer;">
</img>
{% endif %} {% endif %}
</td> </td>

View File

@@ -110,6 +110,38 @@ function imprimirFichas() {
console.error(`Element with ID not found`); console.error(`Element with ID not found`);
} }
} }
function printOrder(id) {
var item = document.getElementById('id-for-print-'+id).innerText
var cliente = document.getElementById('name-comanda').innerText
var local = document.getElementById('mesa-comanda').innerText
const agora = new Date();
var dateString = agora.getDate() + '/' + (agora.getMonth()+1) + '/' + agora.getFullYear() + ' - ' + agora.getHours() + ':' + agora.getMinutes();
console.log(item)
console.log(cliente)
console.log(local)
const body = `<style>
td, th {
border-collapse: collapse;
padding-top: 35px;
margin: 20px;
text-align: center;
font-size: 20px;}
</style>
<tr><td>${item}</td></tr>
<tr><td>${cliente}</td></tr>
<tr><td>${local}</td></tr>
<tr><td>${dateString}</td></tr>
`;
var printWindow = window.open('', '_blank');
// printWindow.body.appendChild(body);
printWindow.document.write('<table>'+body+'</table>');
printWindow.document.close();
printWindow.print();
printWindow.close();
}
function imprimirConta() { function imprimirConta() {

View File

@@ -0,0 +1,7 @@
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Transformed by: SVG Repo Mixer Tools -->
<svg width="233px" height="233px" viewBox="0 0 24.00 24.00" fill="none" xmlns="http://www.w3.org/2000/svg" stroke="#ffa500" stroke-width="0.8399999999999999">
<g id="SVGRepo_bgCarrier" stroke-width="0"/>

After

Width:  |  Height:  |  Size: 1.9 KiB