diff --git a/gestaoRaul/balcao/__pycache__/htmx_views.cpython-312.pyc b/gestaoRaul/balcao/__pycache__/htmx_views.cpython-312.pyc index 539cf43..2762430 100644 Binary files a/gestaoRaul/balcao/__pycache__/htmx_views.cpython-312.pyc and b/gestaoRaul/balcao/__pycache__/htmx_views.cpython-312.pyc differ diff --git a/gestaoRaul/balcao/__pycache__/views.cpython-312.pyc b/gestaoRaul/balcao/__pycache__/views.cpython-312.pyc index 82fab5a..e5fe050 100644 Binary files a/gestaoRaul/balcao/__pycache__/views.cpython-312.pyc and b/gestaoRaul/balcao/__pycache__/views.cpython-312.pyc differ diff --git a/gestaoRaul/balcao/htmx_views.py b/gestaoRaul/balcao/htmx_views.py index 567e7ac..9b608e0 100644 --- a/gestaoRaul/balcao/htmx_views.py +++ b/gestaoRaul/balcao/htmx_views.py @@ -16,23 +16,13 @@ from gestaoRaul.decorators import group_required def listProductBalcao(request, comanda_id, search_product): comanda_id = request.GET.get("id-comanda-balcao") if search_product == '*': - produtos_mais_vendidos = list(ProductComanda.objects.values('product').annotate( - quantidade=Count('product'), - nome=F('product__name') ).order_by('-quantidade')) - products = Product.objects.all() - products_ordenados = [] - - for produto in produtos_mais_vendidos: - for p in products: - if p.active == True and p.name == produto['nome']: - products_ordenados.append(p) - + products_ordenados = ProductComanda.maisVendidos() return render(request, "htmx_components/htmx_list_products_balcao.html", {"products": products_ordenados,'comanda_id':comanda_id}) else: product = search_product products = Product.objects.filter(name__icontains=product, active=True) - return render(request, "htmx_components/htmx_list_products_balcao.html", {"products": products,'comanda_id':comanda_id}) + return render(request, "htmx_components/htmx_list_products_balcao.html", {"products": products[:15],'comanda_id':comanda_id}) @group_required(groupName='Garçom') diff --git a/gestaoRaul/balcao/views.py b/gestaoRaul/balcao/views.py index 7d6c6f7..13b02ad 100644 --- a/gestaoRaul/balcao/views.py +++ b/gestaoRaul/balcao/views.py @@ -20,17 +20,7 @@ def viewBalcao(request): comanda.save() consumo = ProductComanda.objects.filter(comanda=comanda.id) - produtos_mais_vendidos = list(ProductComanda.objects.values('product').annotate( - quantidade=Count('product'), - nome=F('product__name') ).order_by('-quantidade')) - products = Product.objects.all() - products_ordenados = [] - - for produto in produtos_mais_vendidos: - for p in products: - if p.name == produto['nome'] and p.active == True: - products_ordenados.append(p) - + products_ordenados = ProductComanda.maisVendidos() total = 0 for produto in consumo: total += produto.product.price diff --git a/gestaoRaul/comandas/__pycache__/models.cpython-312.pyc b/gestaoRaul/comandas/__pycache__/models.cpython-312.pyc index ccdf436..f02c04a 100644 Binary files a/gestaoRaul/comandas/__pycache__/models.cpython-312.pyc and b/gestaoRaul/comandas/__pycache__/models.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/__pycache__/views.cpython-312.pyc b/gestaoRaul/comandas/__pycache__/views.cpython-312.pyc index 7480791..ba5220e 100644 Binary files a/gestaoRaul/comandas/__pycache__/views.cpython-312.pyc and b/gestaoRaul/comandas/__pycache__/views.cpython-312.pyc differ diff --git a/gestaoRaul/comandas/models.py b/gestaoRaul/comandas/models.py index 4b853c0..6e6bf59 100644 --- a/gestaoRaul/comandas/models.py +++ b/gestaoRaul/comandas/models.py @@ -1,5 +1,6 @@ from django.db import models from django.contrib.auth.models import User +from django.db.models import Count, F @@ -7,7 +8,6 @@ from clients.models import Client from products.models import Product from mesas.models import Mesa from typePay.models import TypePay -# from payments.models import Payments class Comanda(models.Model): id = models.AutoField(primary_key=True) @@ -32,3 +32,15 @@ class ProductComanda(models.Model): return self.comanda.name + " - " + self.product.name + def maisVendidos(): + produtos_mais_vendidos = list(ProductComanda.objects.values('product').annotate( + quantidade=Count('product'), + nome=F('product__name') ).order_by('-quantidade')) + + products = Product.objects.all() + products_ordenados = [] + for produto in produtos_mais_vendidos: + for p in products: + if p.name == produto['nome'] and p.active == True: + products_ordenados.append(p) + return products_ordenados[:15] \ No newline at end of file diff --git a/gestaoRaul/comandas/views.py b/gestaoRaul/comandas/views.py index 7e36336..caba609 100644 --- a/gestaoRaul/comandas/views.py +++ b/gestaoRaul/comandas/views.py @@ -32,24 +32,12 @@ def viewComanda(request): comanda_id = int(id) comanda = Comanda.objects.get(id=comanda_id) consumo = ProductComanda.objects.filter(comanda=comanda_id) - # consumo[0].product. parcial = Payments.objects.filter(comanda=comanda_id) mesas = Mesa.objects.all() clients = Client.objects.filter(active=True) - - produtos_mais_vendidos = list(ProductComanda.objects.values('product').annotate( - quantidade=Count('product'), - nome=F('product__name') ).order_by('-quantidade')) - - products = Product.objects.all() - products_ordenados = [] - for produto in produtos_mais_vendidos: - for p in products: - if p.name == produto['nome'] and p.active == True: - products_ordenados.append(p) + products_ordenados = ProductComanda.maisVendidos() valores = somar(consumo,comanda) - - return render(request, 'viewcomanda.html', {'config':config, 'valores':valores,'parcials':parcial,'clients':clients,'comanda': comanda, 'consumo': consumo, 'products': products_ordenados,'mesas':mesas}) + return render(request, 'viewcomanda.html', {'config':config, 'valores':valores,'parcials':parcial,'clients':clients,'comanda': comanda, 'consumo': consumo, 'products': products_ordenados[:15],'mesas':mesas}) @group_required(groupName='Garçom') @@ -202,9 +190,12 @@ def addProduct(request, product_id, comanda_id): def listProduct(request, comanda_id, product): - allProducts = Product.objects.filter(name__icontains=product) + if product == '*': + allProducts = ProductComanda.maisVendidos() + else: + allProducts = Product.objects.filter(name__icontains=product) products = [] for p in allProducts: if p.active == True: products.append(p) - return render(request, "htmx_components/comandas/htmx_list_products.html", {"products": products,'comanda_id':comanda_id}) \ No newline at end of file + return render(request, "htmx_components/comandas/htmx_list_products.html", {"products": products[:15],'comanda_id':comanda_id}) \ No newline at end of file diff --git a/gestaoRaul/db.sqlite3 b/gestaoRaul/db.sqlite3 index 7321690..fc36ff8 100644 Binary files a/gestaoRaul/db.sqlite3 and b/gestaoRaul/db.sqlite3 differ diff --git a/gestaoRaul/products/__pycache__/models.cpython-312.pyc b/gestaoRaul/products/__pycache__/models.cpython-312.pyc index b059136..08d5592 100644 Binary files a/gestaoRaul/products/__pycache__/models.cpython-312.pyc and b/gestaoRaul/products/__pycache__/models.cpython-312.pyc differ diff --git a/gestaoRaul/products/models.py b/gestaoRaul/products/models.py index a4b6574..eaa822f 100644 --- a/gestaoRaul/products/models.py +++ b/gestaoRaul/products/models.py @@ -2,6 +2,7 @@ from django.db import models from categories.models import Categories + # Create your models here. class Product(models.Model): id = models.AutoField(primary_key=True) @@ -15,4 +16,4 @@ class Product(models.Model): active = models.BooleanField(default=True) def __str__(self) -> str: - return f"{self.id} - {self.name} - {self.price} - {self.category} - {self.cuisine} - {self.active} " \ No newline at end of file + return f"{self.id} - {self.name} - {self.price} - {self.category} - {self.cuisine} - {self.active} " diff --git a/gestaoRaul/products/templates/products.html b/gestaoRaul/products/templates/products.html index 8eabdbb..faae47f 100644 --- a/gestaoRaul/products/templates/products.html +++ b/gestaoRaul/products/templates/products.html @@ -19,6 +19,7 @@ Produtos + Cardápio Digital diff --git a/gestaoRaul/templates/static/base.css b/gestaoRaul/templates/static/base.css index cd2420b..8bf7652 100644 --- a/gestaoRaul/templates/static/base.css +++ b/gestaoRaul/templates/static/base.css @@ -154,8 +154,8 @@ input, textarea, select { align-content: center; text-align: center; line-height: 1.5; - background: var(--main-gradient); - box-shadow: 3px 3px 10px rgba(2, 2, 2, 0.678); + /* background: var(--main-gradient); */ + /* box-shadow: 3px 3px 10px rgba(2, 2, 2, 0.678); */ border-radius: 5px; transition: transform 0.4s, box-shadow 0.4s; background-size: cover; @@ -168,9 +168,9 @@ input, textarea, select { position: absolute; top: 0; left: 0; - width: 150px; - height: 130px; - background-color: rgba(0, 0, 0, 0.737); + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.595); } .card-product-p { @@ -186,6 +186,14 @@ input, textarea, select { box-shadow: 0px 0px 10px rgba(86, 187, 255, 0.815); } + +@media screen and (max-width: 1028px) { + .card-product { + background-size: cover !important; + } + +} + .p-header { background-color: #24252a; box-shadow: 0px 3px 10px #464646; diff --git a/gestaoRaul/templates/static/products/css/products.css b/gestaoRaul/templates/static/products/css/products.css index dab1f11..38dbe28 100644 --- a/gestaoRaul/templates/static/products/css/products.css +++ b/gestaoRaul/templates/static/products/css/products.css @@ -31,9 +31,9 @@ } .modal-product{ - /* position: relative; */ + position: relative; width: 100%; - /* height: 400px; */ + /* height: 750; */ background-image: url('https://placehold.co/600x800/efc7b8/49291c?text=Sem_Imagem'); /* URL da imagem */ background-size: cover; background-position: center;