mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
feat: create home page
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
|
|
||||||
{% block 'head' %}
|
{% block 'head' %}
|
||||||
<link rel="stylesheet" href="{% static 'mesas/css/mesas.css' %}">
|
<link rel="stylesheet" href="{% static 'home/css/home.css' %}">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block 'title' %}
|
{% block 'title' %}
|
||||||
@@ -14,15 +14,35 @@ RRB&C - DashBoard
|
|||||||
{% block 'body' %}
|
{% block 'body' %}
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<h1>DashBoard Aqui</h1>
|
||||||
<div class="grid-container">
|
<div class="grid-container">
|
||||||
|
|
||||||
<h1>DashBoard Aqui</h1>
|
<div class="card">
|
||||||
|
<h4> Valor Total de Pagamentos </h4>
|
||||||
|
<h4>R$ {{total_pagamentos |floatformat:2 }} </h4>
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<h4> Quantidade de Pagamentos </h4>
|
||||||
|
<h4> {{ qdt_pagamentos }} </h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% comment %} {% for mesa in mesas %}
|
<div class="card">
|
||||||
|
<h4> Mais Vendidos </h4>
|
||||||
|
<table >
|
||||||
|
<tr>
|
||||||
|
<th style="text-align: left;">Produto</th>
|
||||||
|
<th style="text-align: left;">Quantidade</th>
|
||||||
|
</tr>
|
||||||
|
{% for produto in produtos_mais_vendidos %}
|
||||||
|
<tr>
|
||||||
|
<td> {{ produto.nome }} </td>
|
||||||
|
<td> {{ produto.quantidade }} </td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<div class="card">{{mesa.name}}</div>
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% endfor %} {% endcomment %}
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,18 @@
|
|||||||
from django.shortcuts import render
|
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):
|
def home(request):
|
||||||
return render(request, 'home.html')
|
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})
|
||||||
|
|||||||
27
gestaoRaul/templates/static/home/css/home.css
Normal file
27
gestaoRaul/templates/static/home/css/home.css
Normal file
@@ -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);
|
||||||
|
}
|
||||||
0
gestaoRaul/templates/static/home/js/home.js
Normal file
0
gestaoRaul/templates/static/home/js/home.js
Normal file
Reference in New Issue
Block a user