style e verificaçao: display flex para os botoes da viewComandas | verificação para apagar produto da comanda

This commit is contained in:
2025-03-28 14:28:35 -03:00
parent ac2a0283d0
commit b35fc39a60
5 changed files with 35 additions and 28 deletions

View File

@@ -102,6 +102,7 @@ def removeProductComanda(request, productComanda_id):
} }
product_comanda = ProductComanda.objects.get(id=productComanda_id) product_comanda = ProductComanda.objects.get(id=productComanda_id)
comanda = Comanda.objects.get(id= product_comanda.comanda.id) comanda = Comanda.objects.get(id= product_comanda.comanda.id)
if comanda.status == 'OPEN':
parcial = Payments.objects.filter(comanda=comanda) parcial = Payments.objects.filter(comanda=comanda)
consumo = ProductComanda.objects.filter(comanda=comanda) consumo = ProductComanda.objects.filter(comanda=comanda)
valores = somar(consumo,comanda) valores = somar(consumo,comanda)
@@ -122,7 +123,8 @@ def removeProductComanda(request, productComanda_id):
product_comanda.delete() product_comanda.delete()
return render(request, "htmx_components/comandas/htmx_list_products_in_comanda.html",{'config':config, 'valores': valores,'parcials':parcial,'consumo': consumo, 'comanda':comanda}) return render(request, "htmx_components/comandas/htmx_list_products_in_comanda.html",{'config':config, 'valores': valores,'parcials':parcial,'consumo': consumo, 'comanda':comanda})
else:
pass

View File

@@ -21,7 +21,7 @@ Detalhes {{comanda.name}}
<body> <body>
<input hidden id="id-temp" type="number"> <input hidden id="id-temp" type="number">
<div class="grid-container" > <div class="grid-container" >
<div> <div style="display: flex;padding: 5px;gap:8px">
<button class="btn-primary" id="openModal" onclick="openModal()" popovertarget="addProduct" <button class="btn-primary" id="openModal" onclick="openModal()" popovertarget="addProduct"
{% if comanda.status != 'OPEN'%} {% if comanda.status != 'OPEN'%}
disabled disabled
@@ -38,6 +38,11 @@ Detalhes {{comanda.name}}
<button class="btn-secondary" id="pagarComanda" <button class="btn-secondary" id="pagarComanda"
onclick="modal_payment_comanda()" onclick="modal_payment_comanda()"
>Receber</button> >Receber</button>
<button class="btn-primary" id="printComanda"
style="display: flex;"
onclick="imprimirConta()"
>Imprimir Conta</button>
{% else %} {% else %}
<button class="btn-secondary" id="pagarComanda" <button class="btn-secondary" id="pagarComanda"
@@ -45,12 +50,12 @@ Detalhes {{comanda.name}}
style="display: none;" style="display: none;"
>Receber</button> >Receber</button>
{% endif %}
<button class="btn-primary" id="printComanda" <button class="btn-primary" id="printComanda"
style="display: none;" style="display: none;"
onclick="imprimirConta()">Imprimir Conta</button> onclick="imprimirConta()"
>Imprimir Conta</button>
{% endif %}
{% if user|groupUser:"Gerente" %} {% if user|groupUser:"Gerente" %}
<button class="btn-primary" id="reOpenComanda" hx-get="{% url 'reopenComanda' comanda.id %} " hx-trigger="click" hx-swap="none" onclick="reloadPage()" <button class="btn-primary" id="reOpenComanda" hx-get="{% url 'reopenComanda' comanda.id %} " hx-trigger="click" hx-swap="none" onclick="reloadPage()"

Binary file not shown.

View File

@@ -208,11 +208,11 @@ function closeConta(id){
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
if(data.status == 'ok'){ if(data.status == 'ok'){
buttonPrintComanda.style.display = 'block' buttonPrintComanda.style.display = 'flex'
buttonClose.style.display = 'none' buttonClose.style.display = 'none'
buttonAdd.style.display = 'none' buttonAdd.style.display = 'none'
buttonreOpenComanda.style.display = 'block' buttonreOpenComanda.style.display = 'flex'
buttonPayment.style.display = 'block' buttonPayment.style.display = 'flex'
showToast('✅Comanda encerrada!😁','success') showToast('✅Comanda encerrada!😁','success')
imprimirConta() imprimirConta()
} }