diff --git a/gestaoRaul/db.sqlite3 b/gestaoRaul/db.sqlite3 index 01dda61..9d19f7d 100644 Binary files a/gestaoRaul/db.sqlite3 and b/gestaoRaul/db.sqlite3 differ diff --git a/gestaoRaul/gestaoRaul/__pycache__/urls.cpython-313.pyc b/gestaoRaul/gestaoRaul/__pycache__/urls.cpython-313.pyc index 7c03581..3099b68 100644 Binary files a/gestaoRaul/gestaoRaul/__pycache__/urls.cpython-313.pyc and b/gestaoRaul/gestaoRaul/__pycache__/urls.cpython-313.pyc differ diff --git a/gestaoRaul/gestaoRaul/urls.py b/gestaoRaul/gestaoRaul/urls.py index 3087b77..a25719b 100644 --- a/gestaoRaul/gestaoRaul/urls.py +++ b/gestaoRaul/gestaoRaul/urls.py @@ -27,6 +27,7 @@ urlpatterns = [ path('comandas/', include('comandas.urls')), path('categories/', include('categories.urls')), path('balcao/', include('balcao.urls')), + path('pedidos/', include('orders.urls')), ] diff --git a/gestaoRaul/orders/__pycache__/models.cpython-313.pyc b/gestaoRaul/orders/__pycache__/models.cpython-313.pyc index 9729ab1..a86494c 100644 Binary files a/gestaoRaul/orders/__pycache__/models.cpython-313.pyc and b/gestaoRaul/orders/__pycache__/models.cpython-313.pyc differ diff --git a/gestaoRaul/orders/__pycache__/urls.cpython-313.pyc b/gestaoRaul/orders/__pycache__/urls.cpython-313.pyc new file mode 100644 index 0000000..52aef7f Binary files /dev/null and b/gestaoRaul/orders/__pycache__/urls.cpython-313.pyc differ diff --git a/gestaoRaul/orders/__pycache__/views.cpython-313.pyc b/gestaoRaul/orders/__pycache__/views.cpython-313.pyc new file mode 100644 index 0000000..7895886 Binary files /dev/null and b/gestaoRaul/orders/__pycache__/views.cpython-313.pyc differ diff --git a/gestaoRaul/orders/migrations/0002_order_productcomanda.py b/gestaoRaul/orders/migrations/0002_order_productcomanda.py new file mode 100644 index 0000000..de5670f --- /dev/null +++ b/gestaoRaul/orders/migrations/0002_order_productcomanda.py @@ -0,0 +1,20 @@ +# Generated by Django 5.1.4 on 2025-01-10 19:24 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('comandas', '0003_comanda_status_alter_productcomanda_product'), + ('orders', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='order', + name='productComanda', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='comandas.productcomanda'), + ), + ] diff --git a/gestaoRaul/orders/migrations/__pycache__/0002_order_productcomanda.cpython-313.pyc b/gestaoRaul/orders/migrations/__pycache__/0002_order_productcomanda.cpython-313.pyc new file mode 100644 index 0000000..d72e32b Binary files /dev/null and b/gestaoRaul/orders/migrations/__pycache__/0002_order_productcomanda.cpython-313.pyc differ diff --git a/gestaoRaul/orders/models.py b/gestaoRaul/orders/models.py index daf26e1..46c008b 100644 --- a/gestaoRaul/orders/models.py +++ b/gestaoRaul/orders/models.py @@ -1,10 +1,11 @@ from django.db import models from products.models import Product -from comandas.models import Comanda +from comandas.models import Comanda, ProductComanda class Order(models.Model): + productComanda = models.ForeignKey(ProductComanda, on_delete=models.SET_NULL, null=True) id_product = models.ForeignKey(Product, on_delete=models.CASCADE) id_comanda = models.ForeignKey(Comanda, on_delete=models.CASCADE) obs = models.TextField(blank=True, null=True) diff --git a/gestaoRaul/orders/templates/orders.html b/gestaoRaul/orders/templates/orders.html new file mode 100644 index 0000000..2a0eeac --- /dev/null +++ b/gestaoRaul/orders/templates/orders.html @@ -0,0 +1,131 @@ +{% extends "base.html" %} +{% load static %} + + + + + + + + + + {% block 'head' %} + + {% endblock %} + + {% block 'title' %} + Pedidos Cozinha + {% endblock %} + + + + + {% block 'body' %} + +

Pedidos cozinha

+ + + + + +
+ + + + +
+ +
+ {% for order in orders %} + {% if 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.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 %} +
+ + + + + + + + {% endblock %} + + + + \ No newline at end of file diff --git a/gestaoRaul/orders/urls.py b/gestaoRaul/orders/urls.py new file mode 100644 index 0000000..95e3298 --- /dev/null +++ b/gestaoRaul/orders/urls.py @@ -0,0 +1,9 @@ + +from django.urls import path +from . import views + +urlpatterns = [ + path('', views.viewsOrders, name='pedidos'), + + +] \ No newline at end of file diff --git a/gestaoRaul/orders/views.py b/gestaoRaul/orders/views.py index 91ea44a..53d5cbf 100644 --- a/gestaoRaul/orders/views.py +++ b/gestaoRaul/orders/views.py @@ -1,3 +1,8 @@ from django.shortcuts import render -# Create your views here. +from orders.models import Order + +def viewsOrders(request): + orders = Order.objects.all() + o = orders[0].id_comanda + return render(request, 'orders.html',{'orders': orders}) diff --git a/gestaoRaul/templates/base.html b/gestaoRaul/templates/base.html index d07e3bf..6b10333 100644 --- a/gestaoRaul/templates/base.html +++ b/gestaoRaul/templates/base.html @@ -29,6 +29,7 @@ +
@@ -46,6 +47,7 @@ +
diff --git a/gestaoRaul/templates/static/orders/css/orders.css b/gestaoRaul/templates/static/orders/css/orders.css new file mode 100644 index 0000000..f42ab43 --- /dev/null +++ b/gestaoRaul/templates/static/orders/css/orders.css @@ -0,0 +1,84 @@ +/* .grid-container { + display: grid; + grid-template-columns: repeat(3, 2fr); + gap: 20px; + max-width: 800px; + margin: 0 auto; + } + +.card { + width: 120px; + height: 120px; + background-color: #f2f2f2; + border-radius: 15px; + box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2); + text-align: center; + line-height: 120px; + font-size: 20px; + font-weight: bold; + color: #333; + transition: transform 0.2s; + }*/ +.m-card { + /* width: 50px; */ + height: 100%; + background-color: #f2f2f2; + border-radius: 10px; + box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2); + text-align: center; + line-height: 50px; + font-size: 10px; + font-weight: bold; + color: #000000; + transition: transform 0.2s; + padding: 15px; + margin-top: 15px; + } + + h4{ + color: black; + } + /* + +.card:hover { + transform: scale(1.05); + box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.3); + } +.m-card:hover { + transform: scale(1.05); + box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.3); + }*/ + + + +.tab { + overflow: auto; + margin-bottom: 0px; + /* border: 1px solid #ccc; */ + /* background-color: #f1f1f1; */ +} + +/* Estilo para cada aba */ +.tab button { + width: 23%; + background-color: inherit; + float: left; + border: none; + outline: none; + cursor: pointer; + padding: 10px 10px; + transition: 0.3s; +} + +/* Estilo para a aba ativa */ +.tab button.active { + background-color: #4446d6; +} + +/* Estilo para o conteúdo das abas */ +.tabcontent { + /* display: none; */ + padding: 6px 12px; + /* border: 1px solid #ccc; */ + /* border-top: none; */ +} \ No newline at end of file diff --git a/gestaoRaul/templates/static/orders/js/orders.js b/gestaoRaul/templates/static/orders/js/orders.js new file mode 100644 index 0000000..c9bb8c4 --- /dev/null +++ b/gestaoRaul/templates/static/orders/js/orders.js @@ -0,0 +1,15 @@ +function openTab(evt, cityName) { + // Declarar todas as abas e conteúdos + var i, tabcontent, tablinks; + tabcontent = document.getElementsByClassName("tabcontent"); + for (i = 0; i < tabcontent.length; i++) { + tabcontent[i].style.display = "none"; + } + tablinks = document.getElementsByClassName("tablinks"); + for (i = 0; i < tablinks.length; i++) { + tablinks[i].className = tablinks[i].className.replace(" active", ""); + } + // Mostrar o conteúdo da aba selecionada e marcar a aba como ativa + document.getElementById(cityName).style.display = "block"; + evt.currentTarget.className += " active"; + } \ No newline at end of file