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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user