From e6beb6f4b510abd6e8c08dc83075a5477523f6c0 Mon Sep 17 00:00:00 2001 From: Welton Moura Date: Sat, 15 Feb 2025 17:14:14 -0300 Subject: [PATCH] feat: pagamento parcial comanda part2 --- gestaoRaul/balcao/templates/viewBalcao.html | 6 ++--- .../__pycache__/htmx_views.cpython-310.pyc | Bin 3631 -> 3715 bytes gestaoRaul/comandas/htmx_views.py | 8 ++++--- .../comandas/templates/viewcomanda.html | 16 +++++++------ gestaoRaul/db.sqlite3 | Bin 311296 -> 311296 bytes .../{ => comandas}/htmx_list_products.html | 0 .../htmx_list_products_in_comanda.html | 13 +++++++++-- .../htmx_list_products_in_balcao.html | 8 +++---- .../templates/static/comandas/js/comandas.js | 5 +++-- .../static/comandas/js/viewcomanda.js | 21 ++++++++++++------ 10 files changed, 49 insertions(+), 28 deletions(-) rename gestaoRaul/templates/htmx_components/{ => comandas}/htmx_list_products.html (100%) rename gestaoRaul/templates/htmx_components/{ => comandas}/htmx_list_products_in_comanda.html (72%) diff --git a/gestaoRaul/balcao/templates/viewBalcao.html b/gestaoRaul/balcao/templates/viewBalcao.html index 7dd83b1..5d1958e 100644 --- a/gestaoRaul/balcao/templates/viewBalcao.html +++ b/gestaoRaul/balcao/templates/viewBalcao.html @@ -36,15 +36,15 @@ - - + + {% for item in consumo%} - + {% endfor %} diff --git a/gestaoRaul/comandas/__pycache__/htmx_views.cpython-310.pyc b/gestaoRaul/comandas/__pycache__/htmx_views.cpython-310.pyc index c2f15eeea6fbab4a34ea04690042b243993d5f8c..6eb2beb4b5cb69adcbb1434edabcaabdab08d5f0 100644 GIT binary patch delta 1480 zcmZ`(&2JM&6!*;T&aT(?5CMcW_kQzxZ|CXGLEVcg z6}N!D|Neb;dwT3I?=feYTIKs#RsF+nv6^~pZ&CBcVEe&elcl>iThUTK>V>@|K7eM> zlYz>NrG4WV0X8FCF9qFh6C!!1mBdh|arBjOdrx=RlM*x1UqJ*_LZ8<85id23%JIYkz$=8vmd8 z+^t_&yC%)+PCtNFJLtwxL2uYf;34=G_>$}i<%s$UkixJLA+uX|+Ht!V0$m$w1SW!C zf=ROX5NI(ed$!>ny`k1xVx0iKpnWR>8N#~U>tv>VH;}Rk>WOg2x8uCb%gkY({<~~U z+b-M6;E?)TG}zZ_%-$JJpd(OrI7nb1_@-u;Z5+~>%`1lt%wfm*r_2o7T!z>>t^XYLkp%tZ6_wet(-)~uY(2XcogG>N}vy%7xVoBjBQ~v+dzSsEGPibkf?{cfsmJr{=+@SKuiHr9$--TK zDCfA^TdG~84<;-2gWJIpzA4ctA+I0Yqm3b>E9f0>Lhv{>ao)nzQVxR)$n1fjhXkfo zt^C!>88Xiy_%6^pGg^I)Ynj<>EMCp5KD2vD{*`LB9}%Uqq(xqLN)KlV&J&C%_>OQh z5c*yCSv@aT*=6;*{PLt$WQqZZ+UPqzcLKJMz&Z-C)X&A{^U? z4j#&9NH6~==WO(?!8;DG|C;Z}qh6?#HAj9z*9G99;C5jqiMfSk!rp?n$vi7})QrT5rDEelnrzz)GK|DYiKRQcN7$S%oB?a zB_H9RjQja|sPWnS!o!RM0@SBl)LD!;T8b=~$VY)?PK)#5uaaH2@GeD0t?;N&fe(h)oSR)M zyugE)O&+xUHUOI*3^NXwPS^~v%5Y*mR&Rg;%W}^;*^ZwRhB?46BvBT(@&x~A^;{Km z{tqKmm_iU`#yD&OVH%;K>zt$xb=`waAKf7ryi}GzU^2@GQ{P8K{=H~9gn+Xz`p-sC g8bg>tm_;~nE~E~A%|73rGKsFitHZ0t|4Ezt1(p;HrT_o{ diff --git a/gestaoRaul/comandas/htmx_views.py b/gestaoRaul/comandas/htmx_views.py index 849a4f6..7a4c1b8 100644 --- a/gestaoRaul/comandas/htmx_views.py +++ b/gestaoRaul/comandas/htmx_views.py @@ -27,7 +27,7 @@ def listProduct(request, comanda_id): for p in allProducts: if p.active == True: products.append(p) - return render(request, "htmx_components/htmx_list_products.html", {"products": products,'comanda_id':comanda_id}) + return render(request, "htmx_components/comandas/htmx_list_products.html", {"products": products,'comanda_id':comanda_id}) @group_required(groupName='Garçom') def addProduct(request, product_id, comanda_id): @@ -36,12 +36,13 @@ def addProduct(request, product_id, comanda_id): product_comanda.save() product = Product.objects.get(id=product_id) comanda = Comanda.objects.get(id=comanda_id) + parcial = Payments.objects.filter(comanda=comanda) if product.cuisine == True: order = Order(id_comanda=comanda, id_product=product, productComanda=product_comanda, obs='') order.save() consumo = ProductComanda.objects.filter(comanda=comanda_id) total = somar(consumo,comanda) - return render(request, "htmx_components/htmx_list_products_in_comanda.html",{'consumo': consumo, 'total': total, 'comanda':comanda}) + return render(request, "htmx_components/comandas/htmx_list_products_in_comanda.html",{'parcials':parcial,'consumo': consumo, 'total': total, 'comanda':comanda}) @group_required(groupName='Garçom') def editOrders(request, productComanda_id, obs): @@ -55,10 +56,11 @@ def editOrders(request, productComanda_id, obs): 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) product_comanda.delete() total = somar(consumo, comanda) - return render(request, "htmx_components/htmx_list_products_in_comanda.html",{'consumo': consumo, 'total': total, 'comanda':comanda}) + return render(request, "htmx_components/comandas/htmx_list_products_in_comanda.html",{'parcials':parcial,'consumo': consumo, 'total': total, 'comanda':comanda}) @group_required(groupName='Garçom') def closeComanda(request, comanda_id): diff --git a/gestaoRaul/comandas/templates/viewcomanda.html b/gestaoRaul/comandas/templates/viewcomanda.html index 0d01c21..7d84bdf 100644 --- a/gestaoRaul/comandas/templates/viewcomanda.html +++ b/gestaoRaul/comandas/templates/viewcomanda.html @@ -76,8 +76,8 @@ Detalhes {{comanda.name}}
ProdutoPreçoProdutoPreço
{{item.product.name}} R$ {{item.product.price}}
- - + + {% for item in consumo%} @@ -117,11 +117,13 @@ Detalhes {{comanda.name}} {% endif %} {% endfor %} + {% if parcials%} + + {% endif %} {% for parcial in parcials %} - - - + + {% endfor %} @@ -130,7 +132,7 @@ Detalhes {{comanda.name}} - +
ProdutoPreçoProdutoPreço
Pagamentos parciais
{{parcial.datetime}}R$ -{{parcial.value}}{{parcial.description}}{{parcial.description}} ás {{parcial.datetime|date:"H:i"}}R$ -{{parcial.value}}
Total R$ {{total}}Total R$ {{total}}
@@ -201,7 +203,7 @@ Detalhes {{comanda.name}}

Pagamento Parcial

{% csrf_token %} - +