diff --git a/gestaoRaul/comandas/__pycache__/htmx_views.cpython-312.pyc b/gestaoRaul/comandas/__pycache__/htmx_views.cpython-312.pyc index 5f0bebd..6c5f633 100644 Binary files a/gestaoRaul/comandas/__pycache__/htmx_views.cpython-312.pyc and b/gestaoRaul/comandas/__pycache__/htmx_views.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/__pycache__/urls.cpython-312.pyc b/gestaoRaul/comandas/__pycache__/urls.cpython-312.pyc index a608b8d..b0a2808 100644 Binary files a/gestaoRaul/comandas/__pycache__/urls.cpython-312.pyc and b/gestaoRaul/comandas/__pycache__/urls.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/__pycache__/views.cpython-312.pyc b/gestaoRaul/comandas/__pycache__/views.cpython-312.pyc index 68fd0dd..7480791 100644 Binary files a/gestaoRaul/comandas/__pycache__/views.cpython-312.pyc and b/gestaoRaul/comandas/__pycache__/views.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/htmx_views.py b/gestaoRaul/comandas/htmx_views.py index 902f6a5..3c5a7ee 100644 --- a/gestaoRaul/comandas/htmx_views.py +++ b/gestaoRaul/comandas/htmx_views.py @@ -6,7 +6,7 @@ from django.shortcuts import render, redirect from comandas.models import Comanda, ProductComanda from orders.models import Order from products.models import Product -from payments.models import Payments +from payments.models import Payments, somar from typePay.models import TypePay from gestaoRaul.decorators import group_required from websocket_client.websocketClient import enviar_mensagem @@ -29,80 +29,6 @@ from asgiref.sync import async_to_sync # print(f"Erro ao enviar mensagem via websocket: {e}") -def somar(consumo:ProductComanda, comanda:Comanda): - parcial = Payments.objects.filter(comanda=comanda) - totalParcial = Decimal(0) - total:Decimal = Decimal(0) - for p in parcial: - totalParcial += p.value - for produto in consumo: - total += Decimal(produto.product.price) - valores = { - 'total':total, - 'parcial':totalParcial, - 'taxa': round(total * Decimal(0.1), 2), - 'totalSemTaxa':total - totalParcial, - 'totalComTaxa': round((total - totalParcial)+(total * Decimal(0.1)),2) - } - return valores - -def listProduct(request, comanda_id): - product = request.GET.get("search-product") - allProducts = Product.objects.filter(name__icontains=product) - products = [] - for p in allProducts: - if p.active == True: - products.append(p) - 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): - config = { - 'taxa': False - } - obs = request.GET.get("obs") - product_comanda = ProductComanda(comanda_id=comanda_id, product_id=product_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() - msg = JsonResponse({ - 'type': 'broadcast', - 'message': f""" -