mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
feat: mudança de etapa do pedido da cozinha
This commit is contained in:
BIN
gestaoRaul/orders/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
gestaoRaul/orders/__pycache__/__init__.cpython-310.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/orders/__pycache__/admin.cpython-310.pyc
Normal file
BIN
gestaoRaul/orders/__pycache__/admin.cpython-310.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/orders/__pycache__/apps.cpython-310.pyc
Normal file
BIN
gestaoRaul/orders/__pycache__/apps.cpython-310.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/orders/__pycache__/models.cpython-310.pyc
Normal file
BIN
gestaoRaul/orders/__pycache__/models.cpython-310.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/orders/__pycache__/urls.cpython-310.pyc
Normal file
BIN
gestaoRaul/orders/__pycache__/urls.cpython-310.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/orders/__pycache__/views.cpython-310.pyc
Normal file
BIN
gestaoRaul/orders/__pycache__/views.cpython-310.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -26,7 +26,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="list-orders">
|
||||
|
||||
<div class="tab">
|
||||
<button class="tablinks" onclick="openTab(event, 'Fila')">Fila</button>
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
<div id="Fila" class="tabcontent">
|
||||
{% for order in orders %}
|
||||
{% if order.preparing == None %}
|
||||
{% if order.preparing == None and order.productComanda != Null %}
|
||||
<div class="m-card"
|
||||
{% if order.productComanda == Null %}
|
||||
style="background-color: rgb(253, 69, 69);"
|
||||
@@ -49,12 +49,15 @@
|
||||
<h4>{{order.obs}} </h4>
|
||||
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </h4>
|
||||
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
|
||||
<button>Preparar</button>
|
||||
<button
|
||||
hx-get="{% url 'preparing' order.id %} " hx-trigger="click" hx-target="#list-orders"
|
||||
>Preparar</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
|
||||
<div id="Preparo" class="tabcontent">
|
||||
{% for order in orders %}
|
||||
{% if order.finished == None and order.preparing != None %}
|
||||
@@ -70,7 +73,9 @@
|
||||
<h4>{{order.obs}} </h4>
|
||||
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </h4>
|
||||
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
|
||||
<button>Preparar</button>
|
||||
<button
|
||||
hx-get="{% url 'finished' order.id %} " hx-trigger="click" hx-target="#list-orders"
|
||||
>Finalizar</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
@@ -91,7 +96,9 @@
|
||||
<h4>{{order.obs}} </h4>
|
||||
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </h4>
|
||||
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
|
||||
<button>Preparar</button>
|
||||
<button
|
||||
hx-get="{% url 'delivered' order.id %} " hx-trigger="click" hx-target="#list-orders"
|
||||
>Entregar</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
@@ -112,12 +119,12 @@
|
||||
<h4>{{order.obs}} </h4>
|
||||
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </h4>
|
||||
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
|
||||
<button>Preparar</button>
|
||||
<!-- <button>Preparar</button> -->
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@ from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.viewsOrders, name='pedidos'),
|
||||
path('preparing/<int:order_id>/', views.preparing, name='preparing'),
|
||||
path('finished/<int:order_id>/', views.finished, name='finished'),
|
||||
path('delivered/<int:order_id>/', views.delivered, name='delivered'),
|
||||
|
||||
|
||||
]
|
||||
@@ -1,8 +1,37 @@
|
||||
# from datetime import timezone
|
||||
from django.utils import timezone
|
||||
from django.shortcuts import render
|
||||
|
||||
from orders.models import Order
|
||||
from django.db.models import Q
|
||||
|
||||
|
||||
def viewsOrders(request):
|
||||
orders = Order.objects.all()
|
||||
o = orders[0].id_comanda
|
||||
fifteen_hours_ago = timezone.now() - timezone.timedelta(hours=15)
|
||||
orders = Order.objects.filter(queue__gte=fifteen_hours_ago )
|
||||
return render(request, 'orders.html',{'orders': orders})
|
||||
|
||||
def preparing(request, order_id):
|
||||
order = Order.objects.get(id=order_id)
|
||||
order.preparing = timezone.now()
|
||||
order.save()
|
||||
fifteen_hours_ago = timezone.now() - timezone.timedelta(hours=15)
|
||||
orders = Order.objects.filter(queue__gte=fifteen_hours_ago )
|
||||
return render(request, 'htmx_components/orders/htmx_list_orders.html',{'orders': orders})
|
||||
|
||||
|
||||
def finished(request, order_id):
|
||||
order = Order.objects.get(id=order_id)
|
||||
order.finished = timezone.now()
|
||||
order.save()
|
||||
fifteen_hours_ago = timezone.now() - timezone.timedelta(hours=15)
|
||||
orders = Order.objects.filter(queue__gte=fifteen_hours_ago )
|
||||
return render(request, 'htmx_components/orders/htmx_list_orders.html',{'orders': orders})
|
||||
|
||||
def delivered(request, order_id):
|
||||
order = Order.objects.get(id=order_id)
|
||||
order.delivered = timezone.now()
|
||||
order.save()
|
||||
fifteen_hours_ago = timezone.now() - timezone.timedelta(hours=15)
|
||||
orders = Order.objects.filter(queue__gte=fifteen_hours_ago )
|
||||
return render(request, 'htmx_components/orders/htmx_list_orders.html',{'orders': orders})
|
||||
|
||||
Reference in New Issue
Block a user