mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
alter: alterado metodo http para fechar comanda | retirada do htmx
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -93,21 +93,6 @@ def addProduct(request, product_id, comanda_id):
|
||||
|
||||
return render(request, "htmx_components/comandas/htmx_list_products_in_comanda.html",{'config':config, 'valores':valores,'parcials':parcial,'consumo': consumo,'comanda':comanda})
|
||||
|
||||
# @group_required(groupName='Garçom')
|
||||
# def editOrders(request, productComanda_id, obs):
|
||||
# order = Order.objects.get(productComanda=productComanda_id)
|
||||
# order.obs = obs
|
||||
# order.save()
|
||||
# msg = JsonResponse({
|
||||
# 'type': 'broadcast',
|
||||
# 'message': obs,
|
||||
# 'local':'cozinha',
|
||||
# 'tipo':'edit',
|
||||
# 'id':order.id,
|
||||
# 'speak': f'Pedido alterado! {order.id_product.name}, é {obs}.'
|
||||
# })
|
||||
# # asyncio.run(enviar_mensagem(msg))
|
||||
# return JsonResponse({'status': 'ok'})
|
||||
|
||||
|
||||
@group_required(groupName='Garçom')
|
||||
@@ -138,11 +123,7 @@ def removeProductComanda(request, productComanda_id):
|
||||
|
||||
return render(request, "htmx_components/comandas/htmx_list_products_in_comanda.html",{'config':config, 'valores': valores,'parcials':parcial,'consumo': consumo, 'comanda':comanda})
|
||||
|
||||
@group_required(groupName='Garçom')
|
||||
def closeComanda(request, comanda_id):
|
||||
comanda = Comanda.objects.get(id=comanda_id)
|
||||
comanda.status = "PAYING"
|
||||
comanda.save()
|
||||
|
||||
|
||||
|
||||
@group_required(groupName='Gerente')
|
||||
|
||||
@@ -28,27 +28,32 @@ Detalhes {{comanda.name}}
|
||||
{% endif %}
|
||||
>Add Produto</button>
|
||||
|
||||
<button class="btn-cancel" id="pagarComanda" hx-get="{% url 'closeComanda' comanda.id %} " hx-trigger="click" hx-swap="none" onclick="imprimirConta()"
|
||||
<button class="btn-cancel" id="closeComanda" onclick="closeConta({{comanda.id}})"
|
||||
{% if comanda.status != 'OPEN' %}
|
||||
style="display: none;"
|
||||
{% endif %}
|
||||
>Fechar Conta</button>
|
||||
|
||||
{% if comanda.status == 'PAYING' or comanda.status == 'FIADO'%}
|
||||
<button class="btn-secondary" id="pagarComanda" onclick="modal_payment_comanda()">Receber</button>
|
||||
{% else %}
|
||||
<button class="btn-secondary" id="pagarComanda"
|
||||
onclick="modal_payment_comanda()"
|
||||
>Receber</button>
|
||||
{% else %}
|
||||
|
||||
<button class="btn-secondary" id="pagarComanda"
|
||||
onclick="modal_payment_comanda()"
|
||||
style="display: none;"
|
||||
>Receber</button>
|
||||
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if comanda.status != 'OPEN'%}
|
||||
<button class="btn-primary" id="imprimirFichas"
|
||||
<button class="btn-primary" id="printComanda"
|
||||
style="display: none;"
|
||||
onclick="imprimirFichas()">Fichas</button>
|
||||
{% endif %}
|
||||
onclick="imprimirConta()">Imprimir Conta</button>
|
||||
|
||||
{% if user|groupUser:"Gerente" %}
|
||||
<button class="btn-primary" id="imprimirFichas" 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()"
|
||||
{% if comanda.status == 'OPEN'%}
|
||||
style="display: none;"
|
||||
{% elif comanda.status == 'CLOSED' %}
|
||||
|
||||
@@ -12,6 +12,7 @@ urlpatterns = [
|
||||
path('addContaCliente/', views.addContaCliente, name='addContaCliente'),
|
||||
path('notificacao/', views.notificacao, name='notificacao'),
|
||||
path('editOrders/<int:productComanda_id>/<str:obs>', views.editOrders, name='editOrders'),
|
||||
path('closeComanda/<int:comanda_id>/', views.closeComanda, name='closeComanda'),
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +24,6 @@ htmx_urlpatterns = [
|
||||
path('listProduct/<int:comanda_id>/', htmx_views.listProduct, name='listProduct'),
|
||||
path('addProduct<int:product_id>/<int:comanda_id>/', htmx_views.addProduct, name='addProduct'),
|
||||
path('removeProductComanda<int:productComanda_id>/', htmx_views.removeProductComanda, name='removeProductComanda'),
|
||||
path('closeComanda<int:comanda_id>/', htmx_views.closeComanda, name='closeComanda'),
|
||||
path('reopenComanda<int:comanda_id>/', htmx_views.reopenComanda, name='reopenComanda'),
|
||||
path('paymentComanda<int:comanda_id>/', htmx_views.paymentComanda, name='paymentComanda'),
|
||||
path('paymentParcial<int:comanda_id>/', htmx_views.paymentParcial, name='paymentParcial'),
|
||||
|
||||
@@ -155,4 +155,12 @@ def editOrders(request, productComanda_id, obs):
|
||||
'speak': f'Pedido alterado! {order.id_product.name}, é {obs}.'
|
||||
})
|
||||
# asyncio.run(enviar_mensagem(msg))
|
||||
return JsonResponse({'status': 'ok', 'obs':order.obs})
|
||||
return JsonResponse({'status': 'ok', 'obs':order.obs})
|
||||
|
||||
|
||||
@group_required(groupName='Garçom')
|
||||
def closeComanda(request, comanda_id):
|
||||
comanda = Comanda.objects.get(id=comanda_id)
|
||||
comanda.status = "PAYING"
|
||||
comanda.save()
|
||||
return JsonResponse({'status': 'ok', 'obs':'order.obs'})
|
||||
Reference in New Issue
Block a user