mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 21:45:41 +00:00
feat: create app orders and makemigrations
This commit is contained in:
@@ -1,30 +0,0 @@
|
|||||||
# Generated by Django 5.1.4 on 2024-12-10 01:19
|
|
||||||
|
|
||||||
import django.db.models.deletion
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
initial = True
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('clients', '0001_initial'),
|
|
||||||
('mesas', '0001_initial'),
|
|
||||||
('typePay', '0001_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='Comanda',
|
|
||||||
fields=[
|
|
||||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
|
||||||
('dt_open', models.DateTimeField(auto_now_add=True)),
|
|
||||||
('dt_close', models.DateTimeField(blank=True, null=True)),
|
|
||||||
('name', models.CharField(max_length=255)),
|
|
||||||
('client', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='clients.client')),
|
|
||||||
('mesa', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mesas.mesa')),
|
|
||||||
('type_pay', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='typePay.typepay')),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
# Generated by Django 5.1.4 on 2024-12-10 01:20
|
|
||||||
|
|
||||||
import django.db.models.deletion
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('comandas', '0001_initial'),
|
|
||||||
('products', '0001_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='ProductComanda',
|
|
||||||
fields=[
|
|
||||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
|
||||||
('data_time', models.DateTimeField(auto_now_add=True)),
|
|
||||||
('applicant', models.CharField(blank=True, max_length=255, null=True)),
|
|
||||||
('comanda', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='comandas.comanda')),
|
|
||||||
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='products.product')),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
# Generated by Django 5.1.4 on 2024-12-20 12:36
|
|
||||||
|
|
||||||
import django.db.models.deletion
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('comandas', '0002_productcomanda'),
|
|
||||||
('products', '0002_product_image_product_quantity'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='comanda',
|
|
||||||
name='status',
|
|
||||||
field=models.CharField(default='OPEN', max_length=255),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='productcomanda',
|
|
||||||
name='product',
|
|
||||||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='products.product'),
|
|
||||||
),
|
|
||||||
]
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,3 +1,6 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
# Register your models here.
|
from categories.models import Categories
|
||||||
|
|
||||||
|
|
||||||
|
admin.site.register(Categories)
|
||||||
|
|||||||
Binary file not shown.
@@ -1,3 +1,6 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
# Register your models here.
|
from clients.models import Client
|
||||||
|
|
||||||
|
|
||||||
|
admin.site.register(Client)
|
||||||
|
|||||||
Binary file not shown.
@@ -1,3 +1,7 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
# Register your models here.
|
from comandas.models import Comanda, ProductComanda
|
||||||
|
|
||||||
|
admin.site.register(Comanda)
|
||||||
|
admin.site.register(ProductComanda)
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -53,6 +53,7 @@ INSTALLED_APPS = [
|
|||||||
'home',
|
'home',
|
||||||
'payments',
|
'payments',
|
||||||
'balcao',
|
'balcao',
|
||||||
|
'orders',
|
||||||
]
|
]
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
|
|||||||
Binary file not shown.
@@ -1,19 +1,7 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from categories.models import Categories
|
|
||||||
from clients.models import Client
|
|
||||||
from comandas.models import Comanda, ProductComanda
|
|
||||||
from typePay.models import TypePay
|
|
||||||
from products.models import Product
|
|
||||||
from mesas.models import Mesa
|
from mesas.models import Mesa
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(Mesa)
|
admin.site.register(Mesa)
|
||||||
admin.site.register(Product)
|
|
||||||
admin.site.register(Categories)
|
|
||||||
admin.site.register(Client)
|
|
||||||
admin.site.register(Comanda)
|
|
||||||
admin.site.register(TypePay)
|
|
||||||
admin.site.register(ProductComanda)
|
|
||||||
|
|
||||||
# Register your models here.
|
|
||||||
|
|||||||
BIN
gestaoRaul/orders/__pycache__/__init__.cpython-313.pyc
Normal file
BIN
gestaoRaul/orders/__pycache__/__init__.cpython-313.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/orders/__pycache__/admin.cpython-313.pyc
Normal file
BIN
gestaoRaul/orders/__pycache__/admin.cpython-313.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/orders/__pycache__/apps.cpython-313.pyc
Normal file
BIN
gestaoRaul/orders/__pycache__/apps.cpython-313.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/orders/__pycache__/models.cpython-313.pyc
Normal file
BIN
gestaoRaul/orders/__pycache__/models.cpython-313.pyc
Normal file
Binary file not shown.
6
gestaoRaul/orders/admin.py
Normal file
6
gestaoRaul/orders/admin.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
from orders.models import Order
|
||||||
|
|
||||||
|
|
||||||
|
admin.site.register(Order)
|
||||||
6
gestaoRaul/orders/apps.py
Normal file
6
gestaoRaul/orders/apps.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class OrdersConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'orders'
|
||||||
31
gestaoRaul/orders/migrations/0001_initial.py
Normal file
31
gestaoRaul/orders/migrations/0001_initial.py
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# Generated by Django 5.1.4 on 2025-01-10 16:28
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('comandas', '0003_comanda_status_alter_productcomanda_product'),
|
||||||
|
('products', '0003_product_cuisine'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Order',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('obs', models.TextField(blank=True, null=True)),
|
||||||
|
('queue', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('preparing', models.DateTimeField(blank=True, null=True)),
|
||||||
|
('finished', models.DateTimeField(blank=True, null=True)),
|
||||||
|
('delivered', models.DateTimeField(blank=True, null=True)),
|
||||||
|
('canceled', models.DateTimeField(blank=True, null=True)),
|
||||||
|
('id_comanda', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='comandas.comanda')),
|
||||||
|
('id_product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='products.product')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
0
gestaoRaul/orders/migrations/__init__.py
Normal file
0
gestaoRaul/orders/migrations/__init__.py
Normal file
Binary file not shown.
Binary file not shown.
18
gestaoRaul/orders/models.py
Normal file
18
gestaoRaul/orders/models.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
from django.db import models
|
||||||
|
|
||||||
|
from products.models import Product
|
||||||
|
from comandas.models import Comanda
|
||||||
|
|
||||||
|
|
||||||
|
class Order(models.Model):
|
||||||
|
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)
|
||||||
|
queue = models.DateTimeField(auto_now_add=True)
|
||||||
|
preparing = models.DateTimeField(null=True, blank=True)
|
||||||
|
finished = models.DateTimeField(null=True, blank=True)
|
||||||
|
delivered = models.DateTimeField(null=True, blank=True)
|
||||||
|
canceled = models.DateTimeField(null=True, blank=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"Pedido {self.id} - Produto: {self.id_product} - Comanda: {self.id_comanda.name}"
|
||||||
3
gestaoRaul/orders/tests.py
Normal file
3
gestaoRaul/orders/tests.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
||||||
3
gestaoRaul/orders/views.py
Normal file
3
gestaoRaul/orders/views.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
# Create your views here.
|
||||||
Binary file not shown.
Binary file not shown.
@@ -1,3 +1,6 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
# Register your models here.
|
from payments.models import Payments
|
||||||
|
|
||||||
|
admin.site.register(Payments)
|
||||||
|
|
||||||
|
|||||||
@@ -15,4 +15,4 @@ class Payments(models.Model):
|
|||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.value
|
return self.comanda.name
|
||||||
Binary file not shown.
Binary file not shown.
@@ -1,3 +1,6 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
# Register your models here.
|
from products.models import Product
|
||||||
|
|
||||||
|
|
||||||
|
admin.site.register(Product)
|
||||||
|
|||||||
18
gestaoRaul/products/migrations/0003_product_cuisine.py
Normal file
18
gestaoRaul/products/migrations/0003_product_cuisine.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 5.1.4 on 2025-01-10 16:24
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('products', '0002_product_image_product_quantity'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='product',
|
||||||
|
name='cuisine',
|
||||||
|
field=models.BooleanField(default=False),
|
||||||
|
),
|
||||||
|
]
|
||||||
Binary file not shown.
@@ -11,6 +11,7 @@ class Product(models.Model):
|
|||||||
price = models.DecimalField(max_digits=10, decimal_places=2)
|
price = models.DecimalField(max_digits=10, decimal_places=2)
|
||||||
quantity = models.IntegerField(null=False, default=0)
|
quantity = models.IntegerField(null=False, default=0)
|
||||||
category = models.ForeignKey(Categories, on_delete=models.CASCADE)
|
category = models.ForeignKey(Categories, on_delete=models.CASCADE)
|
||||||
|
cuisine = models.BooleanField(default=False)
|
||||||
active = models.BooleanField(default=True)
|
active = models.BooleanField(default=True)
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th style="text-align: left;">Produto</th>
|
<th style="text-align: left;">Produto</th>
|
||||||
<th style="text-align: left;width: 20%;">Preço</th>
|
<th style="text-align: left;width: 20%;">Preço</th>
|
||||||
<th style="text-align: left;">Quantidade</th>
|
<th class="hide-on-mobile" style="text-align: left;">Quantidade</th>
|
||||||
<th style="text-align: left;">Categoria</th>
|
<th class="hide-on-mobile" style="text-align: left;">Categoria</th>
|
||||||
<th style="text-align: left;width: 20%;">Ações</th>
|
<th style="text-align: left;width: 20%;">Ações</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@@ -14,8 +14,8 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td id="name-{{product.id}}" >{{product.name}}</td>
|
<td id="name-{{product.id}}" >{{product.name}}</td>
|
||||||
<td id="price-{{product.id}}" >R$ {{product.price}}</td>
|
<td id="price-{{product.id}}" >R$ {{product.price}}</td>
|
||||||
<td id="quantity-{{product.id}}" >{{product.quantity}}</td>
|
<td class="hide-on-mobile" id="quantity-{{product.id}}" >{{product.quantity}}</td>
|
||||||
<td id="category-{{product.id}}" >{{product.category.name}}</td>
|
<td class="hide-on-mobile" id="category-{{product.id}}" >{{product.category.name}}</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="grid-buttons">
|
<div class="grid-buttons">
|
||||||
<img
|
<img
|
||||||
|
|||||||
Binary file not shown.
@@ -1,3 +1,5 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
# Register your models here.
|
from typePay.models import TypePay
|
||||||
|
|
||||||
|
admin.site.register(TypePay)
|
||||||
|
|||||||
Reference in New Issue
Block a user