diff --git a/gestaoRaul/balcao/__pycache__/htmx_views.cpython-313.pyc b/gestaoRaul/balcao/__pycache__/htmx_views.cpython-313.pyc index a6a8066..0271363 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 e387b81..4a6bfb8 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 7c5b768..567e7ac 100644 --- a/gestaoRaul/balcao/htmx_views.py +++ b/gestaoRaul/balcao/htmx_views.py @@ -1,6 +1,8 @@ from django.shortcuts import render, redirect from django.views.decorators.csrf import csrf_exempt from django.db.models import Count, F +from django.contrib.auth.models import User + @@ -70,19 +72,20 @@ def removeProductBalcao(request, productComanda_id): def paymentBalcao(request, comanda_id): typePayment = TypePay.objects.get(id=1) consumo = ProductComanda.objects.filter(comanda=comanda_id) + user = User.objects.get(id=request.user.id) try: vendasBalcao = Comanda.objects.get(name='VENDAS BALCAO') except: mesa = Mesa.objects.get(id=1) vendasBalcao = Comanda(name='VENDAS BALCAO', mesa=mesa, user=request.user, status='CLOSED') vendasBalcao.save() - comanda = Comanda.objects.get(name='VENDA BALCÃO') + comanda = Comanda.objects.get(name=f'{user.id} - BALCÃO - {user.first_name}') total = 0 for produto in consumo: total += produto.product.price produto.comanda = vendasBalcao produto.save() - pagamento = Payments(value=total, comanda=comanda, type_pay=typePayment,description='VENDA BALCÃO') + pagamento = Payments(value=total, comanda=comanda, type_pay=typePayment,description=f'{user.id} - BALCÃO - {user.first_name}') pagamento.save() return redirect('viewBalcao') diff --git a/gestaoRaul/balcao/views.py b/gestaoRaul/balcao/views.py index 7924892..0969051 100644 --- a/gestaoRaul/balcao/views.py +++ b/gestaoRaul/balcao/views.py @@ -12,11 +12,11 @@ from gestaoRaul.decorators import group_required @group_required(groupName='Garçom') def viewBalcao(request): try: - comanda = Comanda.objects.get(name='VENDA BALCÃO') + comanda = Comanda.objects.get(name=f'{user.id} - BALCÃO - {user.first_name}') except: user = User.objects.get(id=request.user.id) mesa = Mesa.objects.get(id=1) - comanda = Comanda(name='VENDA BALCÃO', mesa=mesa, user=user,status='CLOSED') + comanda = Comanda(name=f'{user.id} - BALCÃO - {user.first_name}', mesa=mesa, user=user,status='CLOSED') comanda.save() consumo = ProductComanda.objects.filter(comanda=comanda.id) diff --git a/gestaoRaul/db.sqlite3 b/gestaoRaul/db.sqlite3 index 901e973..2b0630c 100644 Binary files a/gestaoRaul/db.sqlite3 and b/gestaoRaul/db.sqlite3 differ