mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 21:45:41 +00:00
feat: mudança de etapa do pedido da cozinha
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,7 @@
|
|||||||
from django.shortcuts import render, redirect
|
from django.shortcuts import render, redirect
|
||||||
|
|
||||||
from comandas.models import Comanda, ProductComanda
|
from comandas.models import Comanda, ProductComanda
|
||||||
|
from orders.models import Order
|
||||||
from products.models import Product
|
from products.models import Product
|
||||||
from payments.models import Payments
|
from payments.models import Payments
|
||||||
from typePay.models import TypePay
|
from typePay.models import TypePay
|
||||||
@@ -18,6 +19,12 @@ def listProduct(request, comanda_id):
|
|||||||
def addProduct(request, product_id, comanda_id):
|
def addProduct(request, product_id, comanda_id):
|
||||||
product_comanda = ProductComanda(comanda_id=comanda_id, product_id=product_id)
|
product_comanda = ProductComanda(comanda_id=comanda_id, product_id=product_id)
|
||||||
product_comanda.save()
|
product_comanda.save()
|
||||||
|
product = Product.objects.get(id=product_id)
|
||||||
|
comanda = Comanda.objects.get(id=comanda_id)
|
||||||
|
print(product.cuisine)
|
||||||
|
if product.cuisine == True:
|
||||||
|
order = Order(id_comanda=comanda, id_product=product, productComanda=product_comanda, obs='')
|
||||||
|
order.save()
|
||||||
consumo = ProductComanda.objects.filter(comanda=comanda_id)
|
consumo = ProductComanda.objects.filter(comanda=comanda_id)
|
||||||
total = 0
|
total = 0
|
||||||
for produto in consumo:
|
for produto in consumo:
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -26,7 +26,7 @@ RRB&C - DashBoard
|
|||||||
{% block 'body' %}
|
{% block 'body' %}
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h1>DashBoard Aqui</h1>
|
<h1>DashBoard</h1>
|
||||||
<div class="grid-container">
|
<div class="grid-container">
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
|||||||
Binary file not shown.
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">
|
<div class="tab">
|
||||||
<button class="tablinks" onclick="openTab(event, 'Fila')">Fila</button>
|
<button class="tablinks" onclick="openTab(event, 'Fila')">Fila</button>
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
<div id="Fila" class="tabcontent">
|
<div id="Fila" class="tabcontent">
|
||||||
{% for order in orders %}
|
{% for order in orders %}
|
||||||
{% if order.preparing == None %}
|
{% if order.preparing == None and order.productComanda != Null %}
|
||||||
<div class="m-card"
|
<div class="m-card"
|
||||||
{% if order.productComanda == Null %}
|
{% if order.productComanda == Null %}
|
||||||
style="background-color: rgb(253, 69, 69);"
|
style="background-color: rgb(253, 69, 69);"
|
||||||
@@ -49,12 +49,15 @@
|
|||||||
<h4>{{order.obs}} </h4>
|
<h4>{{order.obs}} </h4>
|
||||||
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </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>
|
<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>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div id="Preparo" class="tabcontent">
|
<div id="Preparo" class="tabcontent">
|
||||||
{% for order in orders %}
|
{% for order in orders %}
|
||||||
{% if order.finished == None and order.preparing != None %}
|
{% if order.finished == None and order.preparing != None %}
|
||||||
@@ -70,7 +73,9 @@
|
|||||||
<h4>{{order.obs}} </h4>
|
<h4>{{order.obs}} </h4>
|
||||||
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </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>
|
<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>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -91,7 +96,9 @@
|
|||||||
<h4>{{order.obs}} </h4>
|
<h4>{{order.obs}} </h4>
|
||||||
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </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>
|
<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>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -112,12 +119,12 @@
|
|||||||
<h4>{{order.obs}} </h4>
|
<h4>{{order.obs}} </h4>
|
||||||
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </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>
|
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
|
||||||
<button>Preparar</button>
|
<!-- <button>Preparar</button> -->
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ from . import views
|
|||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', views.viewsOrders, name='pedidos'),
|
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 django.shortcuts import render
|
||||||
|
|
||||||
from orders.models import Order
|
from orders.models import Order
|
||||||
|
from django.db.models import Q
|
||||||
|
|
||||||
|
|
||||||
def viewsOrders(request):
|
def viewsOrders(request):
|
||||||
orders = Order.objects.all()
|
fifteen_hours_ago = timezone.now() - timezone.timedelta(hours=15)
|
||||||
o = orders[0].id_comanda
|
orders = Order.objects.filter(queue__gte=fifteen_hours_ago )
|
||||||
return render(request, 'orders.html',{'orders': orders})
|
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})
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,99 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="tab">
|
||||||
|
<button class="tablinks" onclick="openTab(event, 'Fila')">Fila</button>
|
||||||
|
<button class="tablinks" onclick="openTab(event, 'Preparo')">Preparo</button>
|
||||||
|
<button class="tablinks" onclick="openTab(event, 'Finalizado')">Finalizado</button>
|
||||||
|
<button class="tablinks" onclick="openTab(event, 'Entregue')">Entregue</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="Fila" class="tabcontent">
|
||||||
|
{% for order in orders %}
|
||||||
|
{% if order.preparing == None and order.productComanda != Null %}
|
||||||
|
<div class="m-card"
|
||||||
|
{% if order.productComanda == Null %}
|
||||||
|
style="background-color: rgb(253, 69, 69);"
|
||||||
|
{% elif order.obs != '' %}
|
||||||
|
style="background-color: rgb(243, 165, 75);"
|
||||||
|
{% endif %}
|
||||||
|
>
|
||||||
|
<h4>{{order.id_product.name}}</h4>
|
||||||
|
<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
|
||||||
|
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 %}
|
||||||
|
|
||||||
|
<div class="m-card"
|
||||||
|
{% if order.productComanda == Null %}
|
||||||
|
style="background-color: rgb(253, 69, 69);"
|
||||||
|
{% elif order.obs != '' %}
|
||||||
|
style="background-color: rgb(243, 165, 75);"
|
||||||
|
{% endif %}
|
||||||
|
>
|
||||||
|
<h4>{{order.id_product.name}}</h4>
|
||||||
|
<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
|
||||||
|
hx-get="{% url 'finished' order.id %} " hx-trigger="click" hx-target="#list-orders"
|
||||||
|
>Finalizar</button>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="Finalizado" class="tabcontent">
|
||||||
|
{% for order in orders %}
|
||||||
|
{% if order.delivered == None and order.finished != None %}
|
||||||
|
|
||||||
|
<div class="m-card"
|
||||||
|
{% if order.productComanda == Null %}
|
||||||
|
style="background-color: rgb(253, 69, 69);"
|
||||||
|
{% elif order.obs != '' %}
|
||||||
|
style="background-color: rgb(243, 165, 75);"
|
||||||
|
{% endif %}
|
||||||
|
>
|
||||||
|
<h4>{{order.id_product.name}}</h4>
|
||||||
|
<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
|
||||||
|
hx-get="{% url 'delivered' order.id %} " hx-trigger="click" hx-target="#list-orders"
|
||||||
|
>Entregar</button>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="Entregue" class="tabcontent">
|
||||||
|
{% for order in orders %}
|
||||||
|
{% if order.delivered != None %}
|
||||||
|
|
||||||
|
<div class="m-card"
|
||||||
|
{% if order.productComanda == Null %}
|
||||||
|
style="background-color: rgb(253, 69, 69);"
|
||||||
|
{% elif order.obs != '' %}
|
||||||
|
style="background-color: rgb(243, 165, 75);"
|
||||||
|
{% endif %}
|
||||||
|
>
|
||||||
|
<h4>{{order.id_product.name}}</h4>
|
||||||
|
<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> -->
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
Binary file not shown.
Reference in New Issue
Block a user