diff --git a/gestaoRaul/clients/__pycache__/urls.cpython-313.pyc b/gestaoRaul/clients/__pycache__/urls.cpython-313.pyc index 46cd597..d1a44fa 100644 Binary files a/gestaoRaul/clients/__pycache__/urls.cpython-313.pyc and b/gestaoRaul/clients/__pycache__/urls.cpython-313.pyc differ diff --git a/gestaoRaul/clients/__pycache__/views.cpython-313.pyc b/gestaoRaul/clients/__pycache__/views.cpython-313.pyc index 3d3cef1..0355210 100644 Binary files a/gestaoRaul/clients/__pycache__/views.cpython-313.pyc and b/gestaoRaul/clients/__pycache__/views.cpython-313.pyc differ diff --git a/gestaoRaul/clients/templates/clients.html b/gestaoRaul/clients/templates/clients.html index 8459fca..950c372 100644 --- a/gestaoRaul/clients/templates/clients.html +++ b/gestaoRaul/clients/templates/clients.html @@ -33,7 +33,7 @@ Clientes {% for client in clients %} - {{client.name}} + {{client.name}} R$ {{client.debt}} {{client.contact}} {{client.active}} diff --git a/gestaoRaul/clients/templates/viewclient.html b/gestaoRaul/clients/templates/viewclient.html new file mode 100644 index 0000000..454df85 --- /dev/null +++ b/gestaoRaul/clients/templates/viewclient.html @@ -0,0 +1,61 @@ +{% extends "base.html" %} +{% load static %} +{% load custom_filter_tag %} + + +{% block 'title' %} +Comandas +{% endblock %} + +{% block 'head' %} + +{% endblock %} + +{% block 'body' %} + + +
+

{{client.name}}

+
+ +
+ + + + + + + + + + {% for comanda in comandas %} + + + + + + + + + + {% endfor %} + +
NomeAtendenteData aberturaData fechamentoDetalhesValor
{{comanda.name}}{{comanda.user.first_name}} {{comanda.user.last_name}}{{comanda.dt_open}}{{comanda.dt_close}} + + + + + + + + {{ comanda.id | total }} +
+
+ + + + + +{% endblock %} \ No newline at end of file diff --git a/gestaoRaul/clients/urls.py b/gestaoRaul/clients/urls.py index f363f31..ef9ac40 100644 --- a/gestaoRaul/clients/urls.py +++ b/gestaoRaul/clients/urls.py @@ -7,6 +7,7 @@ urlpatterns = [ path('createClient', views.createClient, name='createClient'), path('editClient', views.editClient, name='editClient'), path('payDebt', views.payDebt, name='payDebt'), + path('viewClient/', views.viewClient, name='viewClient'), diff --git a/gestaoRaul/clients/views.py b/gestaoRaul/clients/views.py index 8e3198b..eace8f2 100644 --- a/gestaoRaul/clients/views.py +++ b/gestaoRaul/clients/views.py @@ -1,6 +1,7 @@ from django.shortcuts import render, redirect from django.contrib.auth.models import User +from comandas.models import Comanda from gestaoRaul.decorators import group_required from clients.models import Client @@ -11,6 +12,13 @@ def clients(request): clients = Client.objects.all() return render(request, 'clients.html', {'clients': clients}) +def viewClient(request,clientId): + id = int(clientId) + print(id) + client = Client.objects.get(id=id) + comandas = Comanda.objects.filter(client = client).filter(status = 'FIADO') + return render(request, 'viewclient.html', {'client': client, 'comandas': comandas}) + @group_required(groupName='Gerente') def createClient(request): diff --git a/gestaoRaul/comandas/__pycache__/views.cpython-313.pyc b/gestaoRaul/comandas/__pycache__/views.cpython-313.pyc index b702c5a..4b0829c 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/templates/viewcomanda.html b/gestaoRaul/comandas/templates/viewcomanda.html index 4fa024f..bc8bcb8 100644 --- a/gestaoRaul/comandas/templates/viewcomanda.html +++ b/gestaoRaul/comandas/templates/viewcomanda.html @@ -34,7 +34,7 @@ Detalhes {{comanda.name}} {% endif %} >Fechar Conta - {% if comanda.status == 'PAYING' %} + {% if comanda.status == 'PAYING' or comanda.status == 'FIADO'%} {% else %} @@ -207,9 +207,11 @@ Detalhes {{comanda.name}}
+ {% if comanda.status != 'FIADO' %} + {% endif %}
diff --git a/gestaoRaul/comandas/templatetags/__pycache__/custom_filter_tag.cpython-313.pyc b/gestaoRaul/comandas/templatetags/__pycache__/custom_filter_tag.cpython-313.pyc index 45dcd70..a6d4579 100644 Binary files a/gestaoRaul/comandas/templatetags/__pycache__/custom_filter_tag.cpython-313.pyc and b/gestaoRaul/comandas/templatetags/__pycache__/custom_filter_tag.cpython-313.pyc differ diff --git a/gestaoRaul/comandas/templatetags/custom_filter_tag.py b/gestaoRaul/comandas/templatetags/custom_filter_tag.py index ca70cca..1f86a59 100644 --- a/gestaoRaul/comandas/templatetags/custom_filter_tag.py +++ b/gestaoRaul/comandas/templatetags/custom_filter_tag.py @@ -1,6 +1,8 @@ +from decimal import Decimal from django import template from comandas.models import Comanda, ProductComanda +from payments.models import Payments register = template.Library() @@ -8,10 +10,18 @@ register = template.Library() def filter_total(value): id = value comanda_id = int(id) + totalParcial = Decimal(0) + comanda = Comanda.objects.get(id=comanda_id) consumo = ProductComanda.objects.filter(comanda=comanda_id) - total = 0 + parcial = Payments.objects.filter(comanda=comanda) + for p in parcial: + totalParcial += p.value + + total = Decimal(0) for produto in consumo: total += produto.product.price + taxa = round(total * Decimal(0.1), 2) + total = (total + taxa) - totalParcial return f'R$ {total}' diff --git a/gestaoRaul/comandas/views.py b/gestaoRaul/comandas/views.py index 7a5bb18..221fd5b 100644 --- a/gestaoRaul/comandas/views.py +++ b/gestaoRaul/comandas/views.py @@ -87,12 +87,12 @@ def addContaCliente(request): comandaId = int(request.POST.get('idComanda')) clientId = int(request.POST.get('select-client')) - valor = float(request.POST.get('valor-conta').replace(',','.')) comanda = Comanda.objects.get(id=comandaId) client = Client.objects.get(id=clientId) - client.debt = client.debt + Decimal(valor) + # client.debt = Decimal(0) comanda.client = client - comanda.status = 'CLOSED' + comanda.dt_close = timezone.now() + comanda.status = 'FIADO' client.save() comanda.save() return redirect('comandas') diff --git a/gestaoRaul/db.sqlite3 b/gestaoRaul/db.sqlite3 index 52391b0..89c6f9e 100644 Binary files a/gestaoRaul/db.sqlite3 and b/gestaoRaul/db.sqlite3 differ diff --git a/gestaoRaul/templates/static/midia/icons/details.svg b/gestaoRaul/templates/static/midia/icons/details.svg new file mode 100644 index 0000000..f1071f4 --- /dev/null +++ b/gestaoRaul/templates/static/midia/icons/details.svg @@ -0,0 +1,14 @@ + + + + + + view-list-line + + + + + + + + \ No newline at end of file diff --git a/gestaoRaul/templates/static/midia/icons/view.svg b/gestaoRaul/templates/static/midia/icons/view.svg new file mode 100644 index 0000000..2bb3f2d --- /dev/null +++ b/gestaoRaul/templates/static/midia/icons/view.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file