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" %}
|
{% extends "base.html" %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
{% load custom_filter_tag %}
|
||||||
|
|
||||||
|
|
||||||
{% block 'title' %}
|
{% block 'title' %}
|
||||||
@@ -14,6 +15,7 @@ Comandas
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<button id="openModal">Abrir Comanda</button>
|
<button id="openModal">Abrir Comanda</button>
|
||||||
|
|
||||||
<div class="grid-container ">
|
<div class="grid-container ">
|
||||||
|
|
||||||
{% for comanda in comandas %}
|
{% for comanda in comandas %}
|
||||||
@@ -21,17 +23,22 @@ Comandas
|
|||||||
<a href="{% url 'viewcomanda' %}?parametro={{ comanda.id }}" style="text-decoration: none;">
|
<a href="{% url 'viewcomanda' %}?parametro={{ comanda.id }}" style="text-decoration: none;">
|
||||||
<header
|
<header
|
||||||
{% if comanda.status == 'OPEN' %}
|
{% 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' %}
|
{% 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 %}
|
{% endif %}
|
||||||
>
|
>
|
||||||
{{comanda.name}} | {{comanda.mesa}}
|
<p>{{comanda.name}}</p>
|
||||||
|
<p>{{comanda.mesa}}</p>
|
||||||
</header>
|
</header>
|
||||||
<br>
|
<div style="padding: 5px;">
|
||||||
<p>
|
<p>
|
||||||
Aberta ás: {{comanda.dt_open|date:"H:i"}}
|
Hora: {{comanda.dt_open|date:"H:i"}}
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
{{ comanda.id | total }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% 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')
|
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 {
|
.card-comanda {
|
||||||
width: 80%;
|
width: 80%;
|
||||||
|
/* gap: 5px; */
|
||||||
/* min-width: 220px;
|
/* min-width: 220px;
|
||||||
min-height: 250px; */
|
min-height: 250px; */
|
||||||
background-color: #292929;
|
background-color: #292929;
|
||||||
border-radius: 10px 10px 5px 5px;
|
border-radius: 5px;
|
||||||
box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2);
|
box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2);
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 30px;
|
line-height: 15px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #333;
|
color: #333;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user