feat: mudança de etapa do pedido da cozinha

This commit is contained in:
2025-01-10 20:42:14 -03:00
parent bde7014717
commit 5c1188ecde
29 changed files with 155 additions and 10 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -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>

View File

@@ -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'),
]

View File

@@ -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})