mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
feat: update status comanda for PAYING
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -26,4 +26,12 @@ def removeProductComanda(request, productComanda_id):
|
|||||||
total = 0
|
total = 0
|
||||||
for produto in consumo:
|
for produto in consumo:
|
||||||
total += produto.product.price
|
total += produto.product.price
|
||||||
return render(request, "htmx_components/htmx_list_products_in_comanda.html",{'consumo': consumo, 'total': total})
|
return render(request, "htmx_components/htmx_list_products_in_comanda.html",{'consumo': consumo, 'total': total})
|
||||||
|
|
||||||
|
def closeComanda(request, comanda_id):
|
||||||
|
# id = request.POST.get('id-comanda')
|
||||||
|
# comanda_id = int(id)
|
||||||
|
comanda = Comanda.objects.get(id=comanda_id)
|
||||||
|
comanda.status = "PAYING"
|
||||||
|
comanda.save()
|
||||||
|
return redirect('comandas')
|
||||||
@@ -20,7 +20,13 @@ Comandas
|
|||||||
|
|
||||||
<a href="{% url 'viewcomanda' %}?parametro={{ comanda.id }}" style="text-decoration: none;">
|
<a href="{% url 'viewcomanda' %}?parametro={{ comanda.id }}" style="text-decoration: none;">
|
||||||
<article >
|
<article >
|
||||||
<header> {{comanda.name}} | {{comanda.mesa}}</header><br>
|
<header
|
||||||
|
{% if comanda.status == 'OPEN' %}
|
||||||
|
style="background-color: #036800;"
|
||||||
|
{% elif comanda.status == 'PAYING' %}
|
||||||
|
style="background-color: rgb(165, 86, 33);"
|
||||||
|
{% endif %}
|
||||||
|
> {{comanda.name}} | {{comanda.mesa}}</header><br>
|
||||||
<p>Aberta ás: {{comanda.dt_open|date:"H:i"}}</p>
|
<p>Aberta ás: {{comanda.dt_open|date:"H:i"}}</p>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,24 @@ Detalhes {{comanda.name}}
|
|||||||
<body>
|
<body>
|
||||||
<div class="grid-container" >
|
<div class="grid-container" >
|
||||||
<div>
|
<div>
|
||||||
<button class="primary" id="openModal">Adicionar Produto</button>
|
<button class="primary" id="openModal"
|
||||||
<button id="pagarComanda">Pagar Comanda</button>
|
{% if comanda.status != 'OPEN'%}
|
||||||
|
disabled
|
||||||
|
{% endif %}
|
||||||
|
>Adicionar Produto</button>
|
||||||
|
|
||||||
|
<button id="pagarComanda" hx-get="{% url 'closeComanda' comanda.id %} " hx-trigger="click"
|
||||||
|
{% if comanda.status != 'OPEN' %}
|
||||||
|
style="display: none;"
|
||||||
|
{% endif %}
|
||||||
|
>Fechar Comanda</button>
|
||||||
|
|
||||||
|
<button id="pagarComanda"
|
||||||
|
{% if comanda.status != 'PAYING' %}
|
||||||
|
style="display: none;"
|
||||||
|
{% endif %}
|
||||||
|
>Receber</button>
|
||||||
|
|
||||||
<button class="button" id="imprimirFichas" onclick="imprimirFichas()">Imprimir Fichas</button>
|
<button class="button" id="imprimirFichas" onclick="imprimirFichas()">Imprimir Fichas</button>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,7 @@ htmx_urlpatterns = [
|
|||||||
path('listProduct/<int:comanda_id>/', htmx_views.listProduct, name='listProduct'),
|
path('listProduct/<int:comanda_id>/', htmx_views.listProduct, name='listProduct'),
|
||||||
path('addProduct<int:product_id>/<int:comanda_id>/', htmx_views.addProduct, name='addProduct'),
|
path('addProduct<int:product_id>/<int:comanda_id>/', htmx_views.addProduct, name='addProduct'),
|
||||||
path('removeProductComanda<int:productComanda_id>/', htmx_views.removeProductComanda, name='removeProductComanda'),
|
path('removeProductComanda<int:productComanda_id>/', htmx_views.removeProductComanda, name='removeProductComanda'),
|
||||||
# path('removeProduct/', views.removeProduct, name='removeProduct'),
|
path('closeComanda<int:comanda_id>/', htmx_views.closeComanda, name='closeComanda'),
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
urlpatterns += htmx_urlpatterns
|
urlpatterns += htmx_urlpatterns
|
||||||
@@ -33,4 +33,5 @@ def createComanda(request):
|
|||||||
comanda = Comanda(name=name, mesa=mesa)
|
comanda = Comanda(name=name, mesa=mesa)
|
||||||
comanda.save()
|
comanda.save()
|
||||||
|
|
||||||
return redirect('comandas')
|
return redirect('comandas')
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user