mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
add permissoes as views
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -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)
|
||||
|
||||
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user