mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
feat: first filter custom | valor total da comanda no card
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,6 @@
|
||||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
{% load custom_filter_tag %}
|
||||
|
||||
|
||||
{% block 'title' %}
|
||||
@@ -14,6 +15,7 @@ Comandas
|
||||
|
||||
<body>
|
||||
<button id="openModal">Abrir Comanda</button>
|
||||
|
||||
<div class="grid-container ">
|
||||
|
||||
{% for comanda in comandas %}
|
||||
@@ -21,17 +23,22 @@ Comandas
|
||||
<a href="{% url 'viewcomanda' %}?parametro={{ comanda.id }}" style="text-decoration: none;">
|
||||
<header
|
||||
{% if comanda.status == 'OPEN' %}
|
||||
style="min-height: 60px;border-radius: 10px 10px 0px 0px; background-color: #036800;"
|
||||
style="padding: 5px; min-height: 60px;border-radius: 5px 5px 0px 0px; background-color: #036800;"
|
||||
{% elif comanda.status == 'PAYING' %}
|
||||
style="min-height: 60px;border-radius: 10px 10px 0px 0px; background-color: rgb(165, 86, 33);"
|
||||
style="padding: 5px; min-height: 60px;border-radius: 5px 5px 0px 0px; background-color: rgb(165, 86, 33);"
|
||||
{% endif %}
|
||||
>
|
||||
{{comanda.name}} | {{comanda.mesa}}
|
||||
<p>{{comanda.name}}</p>
|
||||
<p>{{comanda.mesa}}</p>
|
||||
</header>
|
||||
<br>
|
||||
<div style="padding: 5px;">
|
||||
<p>
|
||||
Aberta ás: {{comanda.dt_open|date:"H:i"}}
|
||||
Hora: {{comanda.dt_open|date:"H:i"}}
|
||||
</p>
|
||||
<p>
|
||||
{{ comanda.id | total }}
|
||||
</p>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
0
gestaoRaul/comandas/templatetags/__init__.py
Normal file
0
gestaoRaul/comandas/templatetags/__init__.py
Normal file
Binary file not shown.
Binary file not shown.
15
gestaoRaul/comandas/templatetags/custom_filter_tag.py
Normal file
15
gestaoRaul/comandas/templatetags/custom_filter_tag.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from django import template
|
||||
|
||||
from comandas.models import Comanda, ProductComanda
|
||||
|
||||
register = template.Library()
|
||||
|
||||
@register.filter(name='total')
|
||||
def filter_total(value):
|
||||
id = value
|
||||
comanda_id = int(id)
|
||||
consumo = ProductComanda.objects.filter(comanda=comanda_id)
|
||||
total = 0
|
||||
for produto in consumo:
|
||||
total += produto.product.price
|
||||
return f'R$ {total}'
|
||||
@@ -47,3 +47,5 @@ def createComanda(request):
|
||||
|
||||
return redirect('comandas')
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 23 KiB |
File diff suppressed because one or more lines are too long
@@ -10,13 +10,14 @@
|
||||
|
||||
.card-comanda {
|
||||
width: 80%;
|
||||
/* gap: 5px; */
|
||||
/* min-width: 220px;
|
||||
min-height: 250px; */
|
||||
background-color: #292929;
|
||||
border-radius: 10px 10px 5px 5px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2);
|
||||
text-align: center;
|
||||
line-height: 30px;
|
||||
line-height: 15px;
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user