diff --git a/gestaoRaul/balcao/__pycache__/htmx_views.cpython-313.pyc b/gestaoRaul/balcao/__pycache__/htmx_views.cpython-313.pyc index a70837d..a6a8066 100644 Binary files a/gestaoRaul/balcao/__pycache__/htmx_views.cpython-313.pyc and b/gestaoRaul/balcao/__pycache__/htmx_views.cpython-313.pyc differ diff --git a/gestaoRaul/balcao/__pycache__/views.cpython-313.pyc b/gestaoRaul/balcao/__pycache__/views.cpython-313.pyc index e32d326..e387b81 100644 Binary files a/gestaoRaul/balcao/__pycache__/views.cpython-313.pyc and b/gestaoRaul/balcao/__pycache__/views.cpython-313.pyc differ diff --git a/gestaoRaul/balcao/htmx_views.py b/gestaoRaul/balcao/htmx_views.py index 10d5acc..7c5b768 100644 --- a/gestaoRaul/balcao/htmx_views.py +++ b/gestaoRaul/balcao/htmx_views.py @@ -9,6 +9,7 @@ from mesas.models import Mesa from products.models import Product from payments.models import Payments from typePay.models import TypePay +from gestaoRaul.decorators import group_required def listProductBalcao(request, comanda_id, search_product): comanda_id = request.GET.get("id-comanda-balcao") @@ -32,7 +33,7 @@ def listProductBalcao(request, comanda_id, search_product): return render(request, "htmx_components/htmx_list_products_balcao.html", {"products": products,'comanda_id':comanda_id}) - +@group_required(groupName='Garçom') def addProductBalcao(request, product_id, comanda_id, qtd): for i in range(qtd): product_comanda = ProductComanda(comanda_id=comanda_id, product_id=product_id) @@ -43,6 +44,7 @@ def addProductBalcao(request, product_id, comanda_id, qtd): total += produto.product.price return render(request, "htmx_components/htmx_list_products_in_balcao.html",{'consumo': consumo, 'total': total}) +@group_required(groupName='Garçom') @csrf_exempt def addProductBalcaoTeclado(request, product_id, comanda_id, qtd): for i in range(qtd): @@ -54,7 +56,7 @@ def addProductBalcaoTeclado(request, product_id, comanda_id, qtd): total += produto.product.price return render(request, "htmx_components/htmx_list_products_in_balcao.html",{'consumo': consumo, 'total': total}) - +@group_required(groupName='Garçom') def removeProductBalcao(request, productComanda_id): product_comanda = ProductComanda.objects.get(id=productComanda_id) consumo = ProductComanda.objects.filter(comanda=product_comanda.comanda) @@ -64,7 +66,7 @@ def removeProductBalcao(request, productComanda_id): total += produto.product.price return render(request, "htmx_components/htmx_list_products_in_balcao.html",{'consumo': consumo, 'total': total}) - +@group_required(groupName='Garçom') def paymentBalcao(request, comanda_id): typePayment = TypePay.objects.get(id=1) consumo = ProductComanda.objects.filter(comanda=comanda_id) diff --git a/gestaoRaul/balcao/views.py b/gestaoRaul/balcao/views.py index 4a22a76..7924892 100644 --- a/gestaoRaul/balcao/views.py +++ b/gestaoRaul/balcao/views.py @@ -5,10 +5,11 @@ from products.models import Product from mesas.models import Mesa from django.db.models import Count, F from django.contrib.auth.models import User +from gestaoRaul.decorators import group_required - +@group_required(groupName='Garçom') def viewBalcao(request): try: comanda = Comanda.objects.get(name='VENDA BALCÃO') diff --git a/gestaoRaul/comandas/__pycache__/htmx_views.cpython-313.pyc b/gestaoRaul/comandas/__pycache__/htmx_views.cpython-313.pyc index 14be5d8..49ba024 100644 Binary files a/gestaoRaul/comandas/__pycache__/htmx_views.cpython-313.pyc and b/gestaoRaul/comandas/__pycache__/htmx_views.cpython-313.pyc differ diff --git a/gestaoRaul/comandas/__pycache__/views.cpython-313.pyc b/gestaoRaul/comandas/__pycache__/views.cpython-313.pyc index 6e64797..245e9ba 100644 Binary files a/gestaoRaul/comandas/__pycache__/views.cpython-313.pyc and b/gestaoRaul/comandas/__pycache__/views.cpython-313.pyc differ diff --git a/gestaoRaul/comandas/htmx_views.py b/gestaoRaul/comandas/htmx_views.py index 3fc9d57..f6fd66a 100644 --- a/gestaoRaul/comandas/htmx_views.py +++ b/gestaoRaul/comandas/htmx_views.py @@ -6,6 +6,7 @@ from orders.models import Order from products.models import Product from payments.models import Payments from typePay.models import TypePay +from gestaoRaul.decorators import group_required def listProduct(request, comanda_id): @@ -17,6 +18,7 @@ def listProduct(request, comanda_id): products.append(p) return render(request, "htmx_components/htmx_list_products.html", {"products": products,'comanda_id':comanda_id}) +@group_required(groupName='Garçom') def addProduct(request, product_id, comanda_id): obs = request.GET.get("obs") product_comanda = ProductComanda(comanda_id=comanda_id, product_id=product_id) @@ -34,6 +36,7 @@ def addProduct(request, product_id, comanda_id): total += produto.product.price return render(request, "htmx_components/htmx_list_products_in_comanda.html",{'consumo': consumo, 'total': total}) +@group_required(groupName='Garçom') def editOrders(request, productComanda_id, obs): order = Order.objects.get(productComanda=productComanda_id) print(obs) @@ -42,6 +45,7 @@ def editOrders(request, productComanda_id, obs): return JsonResponse({'status': 'ok'}) +@group_required(groupName='Garçom') def removeProductComanda(request, productComanda_id): product_comanda = ProductComanda.objects.get(id=productComanda_id) consumo = ProductComanda.objects.filter(comanda=product_comanda.comanda) @@ -51,12 +55,14 @@ def removeProductComanda(request, productComanda_id): total += produto.product.price return render(request, "htmx_components/htmx_list_products_in_comanda.html",{'consumo': consumo, 'total': total}) +@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') def reopenComanda(request, comanda_id): comanda = Comanda.objects.get(id=comanda_id) if comanda.status == 'CLOSED': @@ -65,6 +71,7 @@ def reopenComanda(request, comanda_id): comanda.status = "OPEN" comanda.save() +@group_required(groupName='Gerente') def paymentComanda(request, comanda_id): typePayment = TypePay.objects.get(id=1) consumo = ProductComanda.objects.filter(comanda=comanda_id) diff --git a/gestaoRaul/comandas/views.py b/gestaoRaul/comandas/views.py index c96de85..254bdf5 100644 --- a/gestaoRaul/comandas/views.py +++ b/gestaoRaul/comandas/views.py @@ -4,14 +4,17 @@ from django.db.models import Count, F from comandas.models import Comanda, ProductComanda from products.models import Product from mesas.models import Mesa +from gestaoRaul.decorators import group_required +@group_required(groupName='Garçom') def comandas(request): comandas = Comanda.objects.filter(status__in=["OPEN", "PAYING"]) mesas = Mesa.objects.all() return render(request, 'comandas.html', {'comandas': comandas, 'mesas': mesas}) +@group_required(groupName='Garçom') def viewComanda(request): id = request.GET.get('parametro') comanda_id = int(id) @@ -35,7 +38,7 @@ def viewComanda(request): return render(request, 'viewcomanda.html', {'comanda': comanda, 'consumo': consumo, 'total': total, 'products': products_ordenados}) - +@group_required(groupName='Garçom') def createComanda(request): name = request.POST.get('name-comanda') mesa_id = int(request.POST.get('select-mesa')[0]) diff --git a/gestaoRaul/db.sqlite3 b/gestaoRaul/db.sqlite3 index 56d2e16..27744d0 100644 Binary files a/gestaoRaul/db.sqlite3 and b/gestaoRaul/db.sqlite3 differ diff --git a/gestaoRaul/orders/__pycache__/views.cpython-313.pyc b/gestaoRaul/orders/__pycache__/views.cpython-313.pyc index 39bb598..32f21e8 100644 Binary files a/gestaoRaul/orders/__pycache__/views.cpython-313.pyc and b/gestaoRaul/orders/__pycache__/views.cpython-313.pyc differ diff --git a/gestaoRaul/orders/views.py b/gestaoRaul/orders/views.py index 9fc814f..7662515 100644 --- a/gestaoRaul/orders/views.py +++ b/gestaoRaul/orders/views.py @@ -4,6 +4,7 @@ from django.shortcuts import render from orders.models import Order from django.db.models import Q +from gestaoRaul.decorators import group_required def viewsOrders(request): @@ -11,6 +12,7 @@ def viewsOrders(request): orders = Order.objects.filter(queue__gte=fifteen_hours_ago ) return render(request, 'orders.html',{'orders': orders}) +@group_required(groupName='Cozinha') def preparing(request, order_id): order = Order.objects.get(id=order_id) order.preparing = timezone.now() @@ -20,6 +22,7 @@ def preparing(request, order_id): return render(request, 'htmx_components/orders/htmx_list_orders.html',{'orders': orders}) +@group_required(groupName='Cozinha') def finished(request, order_id): order = Order.objects.get(id=order_id) order.finished = timezone.now() @@ -28,6 +31,7 @@ def finished(request, order_id): orders = Order.objects.filter(queue__gte=fifteen_hours_ago ) return render(request, 'htmx_components/orders/htmx_list_orders.html',{'orders': orders}) +@group_required(groupName='Garçom') def delivered(request, order_id): order = Order.objects.get(id=order_id) order.delivered = timezone.now() diff --git a/gestaoRaul/products/__pycache__/views.cpython-313.pyc b/gestaoRaul/products/__pycache__/views.cpython-313.pyc index 4386db2..da57d99 100644 Binary files a/gestaoRaul/products/__pycache__/views.cpython-313.pyc and b/gestaoRaul/products/__pycache__/views.cpython-313.pyc differ diff --git a/gestaoRaul/products/views.py b/gestaoRaul/products/views.py index a74e3e4..797bd0a 100644 --- a/gestaoRaul/products/views.py +++ b/gestaoRaul/products/views.py @@ -2,19 +2,24 @@ from django.shortcuts import render, redirect from categories.models import Categories from products.models import Product +from gestaoRaul.decorators import group_required + +@group_required(groupName='Garçom') def products(request): protucts = Product.objects.all() categories = Categories.objects.all() return render(request, 'products.html', {'products': protucts, 'categories': categories}) +@group_required(groupName='Garçom') def searchProduct(request): product = request.GET.get("search-product") products = Product.objects.filter(name__icontains=product) return render(request, "htmx_components/products/htmx_search_products.html", {"products": products}) +@group_required(groupName='Gerente') def createProduct(request): name = request.POST.get('name') description = request.POST.get('description') @@ -25,6 +30,8 @@ def createProduct(request): return redirect('/products') + +@group_required(groupName='Gerente') def onOffProduct(request): id = request.POST.get('id-product') product_id = int(id) @@ -35,6 +42,7 @@ def onOffProduct(request): return render(request, "htmx_components/products/htmx_search_products.html", {"products": products}) +@group_required(groupName='Gerente') def editProduct(request, productId): product_id = int(request.POST.get('productId')) # product_id = productId