diff --git a/gestaoRaul/categories/__pycache__/admin.cpython-310.pyc b/gestaoRaul/categories/__pycache__/admin.cpython-310.pyc index 0696802..c93574d 100644 Binary files a/gestaoRaul/categories/__pycache__/admin.cpython-310.pyc and b/gestaoRaul/categories/__pycache__/admin.cpython-310.pyc differ diff --git a/gestaoRaul/clients/__pycache__/admin.cpython-310.pyc b/gestaoRaul/clients/__pycache__/admin.cpython-310.pyc index cd98d29..f5b1a09 100644 Binary files a/gestaoRaul/clients/__pycache__/admin.cpython-310.pyc and b/gestaoRaul/clients/__pycache__/admin.cpython-310.pyc differ diff --git a/gestaoRaul/comandas/__pycache__/admin.cpython-310.pyc b/gestaoRaul/comandas/__pycache__/admin.cpython-310.pyc index 84b1566..4094585 100644 Binary files a/gestaoRaul/comandas/__pycache__/admin.cpython-310.pyc and b/gestaoRaul/comandas/__pycache__/admin.cpython-310.pyc differ diff --git a/gestaoRaul/comandas/__pycache__/htmx_views.cpython-310.pyc b/gestaoRaul/comandas/__pycache__/htmx_views.cpython-310.pyc index a2a96cc..897b583 100644 Binary files a/gestaoRaul/comandas/__pycache__/htmx_views.cpython-310.pyc and b/gestaoRaul/comandas/__pycache__/htmx_views.cpython-310.pyc differ diff --git a/gestaoRaul/comandas/htmx_views.py b/gestaoRaul/comandas/htmx_views.py index f3831c2..fd935b2 100644 --- a/gestaoRaul/comandas/htmx_views.py +++ b/gestaoRaul/comandas/htmx_views.py @@ -1,6 +1,7 @@ from django.shortcuts import render, redirect from comandas.models import Comanda, ProductComanda +from orders.models import Order from products.models import Product from payments.models import Payments from typePay.models import TypePay @@ -18,6 +19,12 @@ def listProduct(request, comanda_id): def addProduct(request, product_id, comanda_id): product_comanda = ProductComanda(comanda_id=comanda_id, product_id=product_id) 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) total = 0 for produto in consumo: diff --git a/gestaoRaul/db.sqlite3 b/gestaoRaul/db.sqlite3 index 9d19f7d..ee86a20 100644 Binary files a/gestaoRaul/db.sqlite3 and b/gestaoRaul/db.sqlite3 differ diff --git a/gestaoRaul/gestaoRaul/__pycache__/settings.cpython-310.pyc b/gestaoRaul/gestaoRaul/__pycache__/settings.cpython-310.pyc index d849a14..eb19c77 100644 Binary files a/gestaoRaul/gestaoRaul/__pycache__/settings.cpython-310.pyc and b/gestaoRaul/gestaoRaul/__pycache__/settings.cpython-310.pyc differ diff --git a/gestaoRaul/gestaoRaul/__pycache__/urls.cpython-310.pyc b/gestaoRaul/gestaoRaul/__pycache__/urls.cpython-310.pyc index 02b3318..b263974 100644 Binary files a/gestaoRaul/gestaoRaul/__pycache__/urls.cpython-310.pyc and b/gestaoRaul/gestaoRaul/__pycache__/urls.cpython-310.pyc differ diff --git a/gestaoRaul/home/templates/home.html b/gestaoRaul/home/templates/home.html index 0d705fd..a9c7719 100644 --- a/gestaoRaul/home/templates/home.html +++ b/gestaoRaul/home/templates/home.html @@ -26,7 +26,7 @@ RRB&C - DashBoard {% block 'body' %} -

DashBoard Aqui

+

DashBoard

diff --git a/gestaoRaul/mesas/__pycache__/admin.cpython-310.pyc b/gestaoRaul/mesas/__pycache__/admin.cpython-310.pyc index 496b963..f80f6fa 100644 Binary files a/gestaoRaul/mesas/__pycache__/admin.cpython-310.pyc and b/gestaoRaul/mesas/__pycache__/admin.cpython-310.pyc differ diff --git a/gestaoRaul/orders/__pycache__/__init__.cpython-310.pyc b/gestaoRaul/orders/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..438e9fa Binary files /dev/null and b/gestaoRaul/orders/__pycache__/__init__.cpython-310.pyc differ diff --git a/gestaoRaul/orders/__pycache__/admin.cpython-310.pyc b/gestaoRaul/orders/__pycache__/admin.cpython-310.pyc new file mode 100644 index 0000000..ba47721 Binary files /dev/null and b/gestaoRaul/orders/__pycache__/admin.cpython-310.pyc differ diff --git a/gestaoRaul/orders/__pycache__/apps.cpython-310.pyc b/gestaoRaul/orders/__pycache__/apps.cpython-310.pyc new file mode 100644 index 0000000..f81099d Binary files /dev/null and b/gestaoRaul/orders/__pycache__/apps.cpython-310.pyc differ diff --git a/gestaoRaul/orders/__pycache__/models.cpython-310.pyc b/gestaoRaul/orders/__pycache__/models.cpython-310.pyc new file mode 100644 index 0000000..cdb1c36 Binary files /dev/null and b/gestaoRaul/orders/__pycache__/models.cpython-310.pyc differ diff --git a/gestaoRaul/orders/__pycache__/urls.cpython-310.pyc b/gestaoRaul/orders/__pycache__/urls.cpython-310.pyc new file mode 100644 index 0000000..46143da Binary files /dev/null and b/gestaoRaul/orders/__pycache__/urls.cpython-310.pyc differ diff --git a/gestaoRaul/orders/__pycache__/views.cpython-310.pyc b/gestaoRaul/orders/__pycache__/views.cpython-310.pyc new file mode 100644 index 0000000..614567e Binary files /dev/null and b/gestaoRaul/orders/__pycache__/views.cpython-310.pyc differ diff --git a/gestaoRaul/orders/migrations/__pycache__/0001_initial.cpython-310.pyc b/gestaoRaul/orders/migrations/__pycache__/0001_initial.cpython-310.pyc new file mode 100644 index 0000000..a3e66b1 Binary files /dev/null and b/gestaoRaul/orders/migrations/__pycache__/0001_initial.cpython-310.pyc differ diff --git a/gestaoRaul/orders/migrations/__pycache__/0002_order_productcomanda.cpython-310.pyc b/gestaoRaul/orders/migrations/__pycache__/0002_order_productcomanda.cpython-310.pyc new file mode 100644 index 0000000..b57a8dc Binary files /dev/null and b/gestaoRaul/orders/migrations/__pycache__/0002_order_productcomanda.cpython-310.pyc differ diff --git a/gestaoRaul/orders/migrations/__pycache__/__init__.cpython-310.pyc b/gestaoRaul/orders/migrations/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..8008505 Binary files /dev/null and b/gestaoRaul/orders/migrations/__pycache__/__init__.cpython-310.pyc differ diff --git a/gestaoRaul/orders/templates/orders.html b/gestaoRaul/orders/templates/orders.html index 2a0eeac..16a35ec 100644 --- a/gestaoRaul/orders/templates/orders.html +++ b/gestaoRaul/orders/templates/orders.html @@ -26,7 +26,7 @@ - +
@@ -37,7 +37,7 @@
{% for order in orders %} - {% if order.preparing == None %} + {% if order.preparing == None and order.productComanda != Null %}
{{order.obs}}

{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}}

{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}

- +
{% endif %} {% endfor %}
+
{% for order in orders %} {% if order.finished == None and order.preparing != None %} @@ -70,7 +73,9 @@

{{order.obs}}

{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}}

{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}

- +
{% endif %} {% endfor %} @@ -91,7 +96,9 @@

{{order.obs}}

{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}}

{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}

- +
{% endif %} {% endfor %} @@ -112,12 +119,12 @@

{{order.obs}}

{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}}

{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}

- +
{% endif %} {% endfor %}
- +
diff --git a/gestaoRaul/orders/urls.py b/gestaoRaul/orders/urls.py index 95e3298..957ecee 100644 --- a/gestaoRaul/orders/urls.py +++ b/gestaoRaul/orders/urls.py @@ -4,6 +4,9 @@ from . import views urlpatterns = [ path('', views.viewsOrders, name='pedidos'), + path('preparing//', views.preparing, name='preparing'), + path('finished//', views.finished, name='finished'), + path('delivered//', views.delivered, name='delivered'), ] \ No newline at end of file diff --git a/gestaoRaul/orders/views.py b/gestaoRaul/orders/views.py index 53d5cbf..9fc814f 100644 --- a/gestaoRaul/orders/views.py +++ b/gestaoRaul/orders/views.py @@ -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}) diff --git a/gestaoRaul/payments/__pycache__/admin.cpython-310.pyc b/gestaoRaul/payments/__pycache__/admin.cpython-310.pyc index 6536302..a1a0a51 100644 Binary files a/gestaoRaul/payments/__pycache__/admin.cpython-310.pyc and b/gestaoRaul/payments/__pycache__/admin.cpython-310.pyc differ diff --git a/gestaoRaul/payments/__pycache__/models.cpython-310.pyc b/gestaoRaul/payments/__pycache__/models.cpython-310.pyc index ed96c1b..d7901bd 100644 Binary files a/gestaoRaul/payments/__pycache__/models.cpython-310.pyc and b/gestaoRaul/payments/__pycache__/models.cpython-310.pyc differ diff --git a/gestaoRaul/products/__pycache__/admin.cpython-310.pyc b/gestaoRaul/products/__pycache__/admin.cpython-310.pyc index f25bb6d..c9bf6ca 100644 Binary files a/gestaoRaul/products/__pycache__/admin.cpython-310.pyc and b/gestaoRaul/products/__pycache__/admin.cpython-310.pyc differ diff --git a/gestaoRaul/products/__pycache__/models.cpython-310.pyc b/gestaoRaul/products/__pycache__/models.cpython-310.pyc index 2009b5c..6515a55 100644 Binary files a/gestaoRaul/products/__pycache__/models.cpython-310.pyc and b/gestaoRaul/products/__pycache__/models.cpython-310.pyc differ diff --git a/gestaoRaul/products/migrations/__pycache__/0003_product_cuisine.cpython-310.pyc b/gestaoRaul/products/migrations/__pycache__/0003_product_cuisine.cpython-310.pyc new file mode 100644 index 0000000..8f5ec73 Binary files /dev/null and b/gestaoRaul/products/migrations/__pycache__/0003_product_cuisine.cpython-310.pyc differ diff --git a/gestaoRaul/templates/htmx_components/orders/htmx_list_orders.html b/gestaoRaul/templates/htmx_components/orders/htmx_list_orders.html new file mode 100644 index 0000000..4729b86 --- /dev/null +++ b/gestaoRaul/templates/htmx_components/orders/htmx_list_orders.html @@ -0,0 +1,99 @@ + + + +
+ + + + +
+ +
+ {% for order in orders %} + {% if order.preparing == None and order.productComanda != Null %} +
+

{{order.id_product.name}}

+

{{order.obs}}

+

{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}}

+

{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}

+ +
+ {% endif %} + {% endfor %} +
+ + +
+ {% for order in orders %} + {% if order.finished == None and order.preparing != None %} + +
+

{{order.id_product.name}}

+

{{order.obs}}

+

{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}}

+

{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}

+ +
+ {% endif %} + {% endfor %} +
+ +
+ {% for order in orders %} + {% if order.delivered == None and order.finished != None %} + +
+

{{order.id_product.name}}

+

{{order.obs}}

+

{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}}

+

{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}

+ +
+ {% endif %} + {% endfor %} +
+ +
+ {% for order in orders %} + {% if order.delivered != None %} + +
+

{{order.id_product.name}}

+

{{order.obs}}

+

{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}}

+

{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}

+ +
+ {% endif %} + {% endfor %} +
\ No newline at end of file diff --git a/gestaoRaul/typePay/__pycache__/admin.cpython-310.pyc b/gestaoRaul/typePay/__pycache__/admin.cpython-310.pyc index e765bc0..256446a 100644 Binary files a/gestaoRaul/typePay/__pycache__/admin.cpython-310.pyc and b/gestaoRaul/typePay/__pycache__/admin.cpython-310.pyc differ