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,27 +102,29 @@ def removeProductComanda(request, productComanda_id):
}
product_comanda = ProductComanda.objects.get(id=productComanda_id)
comanda = Comanda.objects.get(id= product_comanda.comanda.id)
parcial = Payments.objects.filter(comanda=comanda)
consumo = ProductComanda.objects.filter(comanda=comanda)
valores = somar(consumo,comanda)
if product_comanda.product.cuisine == True:
order = Order.objects.get(productComanda=product_comanda)
product_comanda.delete()
msg = JsonResponse({
'type': 'broadcast',
'message': 'Atenção! Pedido cancelado',
'local':'cozinha',
'tipo':'delete',
'id':order.id,
'speak': f'Pedido cancelado! {order.id_product.name}.'
})
asyncio.run(enviar_mensagem(msg))
# order.delete()
if comanda.status == 'OPEN':
parcial = Payments.objects.filter(comanda=comanda)
consumo = ProductComanda.objects.filter(comanda=comanda)
valores = somar(consumo,comanda)
if product_comanda.product.cuisine == True:
order = Order.objects.get(productComanda=product_comanda)
product_comanda.delete()
msg = JsonResponse({
'type': 'broadcast',
'message': 'Atenção! Pedido cancelado',
'local':'cozinha',
'tipo':'delete',
'id':order.id,
'speak': f'Pedido cancelado! {order.id_product.name}.'
})
asyncio.run(enviar_mensagem(msg))
# order.delete()
else:
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})
else:
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})
pass

View File

@@ -21,7 +21,7 @@ Detalhes {{comanda.name}}
<body>
<input hidden id="id-temp" type="number">
<div class="grid-container" >
<div>
<div style="display: flex;padding: 5px;gap:8px">
<button class="btn-primary" id="openModal" onclick="openModal()" popovertarget="addProduct"
{% if comanda.status != 'OPEN'%}
disabled
@@ -38,6 +38,11 @@ Detalhes {{comanda.name}}
<button class="btn-secondary" id="pagarComanda"
onclick="modal_payment_comanda()"
>Receber</button>
<button class="btn-primary" id="printComanda"
style="display: flex;"
onclick="imprimirConta()"
>Imprimir Conta</button>
{% else %}
<button class="btn-secondary" id="pagarComanda"
@@ -45,12 +50,12 @@ Detalhes {{comanda.name}}
style="display: none;"
>Receber</button>
<button class="btn-primary" id="printComanda"
style="display: none;"
onclick="imprimirConta()"
>Imprimir Conta</button>
{% endif %}
<button class="btn-primary" id="printComanda"
style="display: none;"
onclick="imprimirConta()">Imprimir Conta</button>
{% if user|groupUser:"Gerente" %}
<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(data => {
if(data.status == 'ok'){
buttonPrintComanda.style.display = 'block'
buttonPrintComanda.style.display = 'flex'
buttonClose.style.display = 'none'
buttonAdd.style.display = 'none'
buttonreOpenComanda.style.display = 'block'
buttonPayment.style.display = 'block'
buttonreOpenComanda.style.display = 'flex'
buttonPayment.style.display = 'flex'
showToast('✅Comanda encerrada!😁','success')
imprimirConta()
}