diff --git a/gestaoRaul/db.sqlite3 b/gestaoRaul/db.sqlite3 index 1f69c3a..5264031 100644 Binary files a/gestaoRaul/db.sqlite3 and b/gestaoRaul/db.sqlite3 differ diff --git a/gestaoRaul/home/__pycache__/views.cpython-310.pyc b/gestaoRaul/home/__pycache__/views.cpython-310.pyc index 323ebb9..c48a68e 100644 Binary files a/gestaoRaul/home/__pycache__/views.cpython-310.pyc and b/gestaoRaul/home/__pycache__/views.cpython-310.pyc differ diff --git a/gestaoRaul/home/templates/home.html b/gestaoRaul/home/templates/home.html index 60e28e0..fe04cab 100644 --- a/gestaoRaul/home/templates/home.html +++ b/gestaoRaul/home/templates/home.html @@ -4,7 +4,7 @@ {% block 'head' %} - + {% endblock %} {% block 'title' %} @@ -14,15 +14,35 @@ RRB&C - DashBoard {% block 'body' %} +

DashBoard Aqui

-

DashBoard Aqui

+
+

Valor Total de Pagamentos

+

R$ {{total_pagamentos |floatformat:2 }}

+
+
+

Quantidade de Pagamentos

+

{{ qdt_pagamentos }}

+
- {% comment %} {% for mesa in mesas %} +
+

Mais Vendidos

+ + + + + + {% for produto in produtos_mais_vendidos %} + + + + + + {% endfor %} +
ProdutoQuantidade
{{ produto.nome }} {{ produto.quantidade }}
+
-
{{mesa.name}}
- - {% endfor %} {% endcomment %}
diff --git a/gestaoRaul/home/views.py b/gestaoRaul/home/views.py index 35fb3dc..f41cdd7 100644 --- a/gestaoRaul/home/views.py +++ b/gestaoRaul/home/views.py @@ -1,5 +1,18 @@ from django.shortcuts import render +from django.db.models import Sum +from django.db.models import Count, F + +from comandas.models import ProductComanda +from products.models import Product +from payments.models import Payments -# Create your views here. def home(request): - return render(request, 'home.html') \ No newline at end of file + total_pagamentos = Payments.objects.aggregate(total=Sum('value'))['total'] + qdt_pagamentos = Payments.objects.aggregate(total=Count('value'))['total'] + pagamentos = Payments.objects.all() + + produtos_mais_vendidos = ProductComanda.objects.values('product').annotate( + quantidade=Count('product'), + nome=F('product__name') ).order_by('-quantidade')[:5] + + return render(request, 'home.html', {'total_pagamentos': total_pagamentos, 'pagamentos': pagamentos, 'qdt_pagamentos': qdt_pagamentos, 'produtos_mais_vendidos': produtos_mais_vendidos}) diff --git a/gestaoRaul/templates/static/home/css/home.css b/gestaoRaul/templates/static/home/css/home.css new file mode 100644 index 0000000..48d860e --- /dev/null +++ b/gestaoRaul/templates/static/home/css/home.css @@ -0,0 +1,27 @@ +.grid-container { + display: grid; + grid-template-columns: repeat(4, 2fr); + gap: 20px; + max-width: 1200px; /* Define a largura máxima do grid */ + margin: 0 auto; /* Centraliza o grid na página */ + } + +.card { + width: 420px; + height: 420px; + background-color: #2b376e; + border-radius: 15px; + box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2); + text-align: center; + line-height: 30px; /* Centraliza o texto verticalmente */ + font-size: 20px; + font-weight: bold; + padding: 10px; + color: #333; + transition: transform 0.2s; + } + +.card:hover { + transform: scale(1.05); + box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.3); + } \ No newline at end of file diff --git a/gestaoRaul/templates/static/home/js/home.js b/gestaoRaul/templates/static/home/js/home.js new file mode 100644 index 0000000..e69de29