chore: Delete numerous application modules, templates, static assets, documentation, and build files.

This commit is contained in:
2026-02-25 17:09:27 -03:00
parent 7ddaa2d1f9
commit 2fc4fafed7
562 changed files with 17 additions and 6810 deletions

0
payments/__init__.py Normal file
View File

6
payments/admin.py Normal file
View File

@@ -0,0 +1,6 @@
from django.contrib import admin
from payments.models import Payments
admin.site.register(Payments)

12
payments/api_views.py Normal file
View File

@@ -0,0 +1,12 @@
from rest_framework import viewsets, permissions
from .models import Payments
from .serializers import PaymentsSerializer
class PaymentsViewSet(viewsets.ModelViewSet):
queryset = Payments.objects.all()
serializer_class = PaymentsSerializer
permission_classes = [permissions.IsAuthenticated]
def get_queryset(self):
# Opcionalmente filtrar pagamentos recentes
return Payments.objects.all().order_by('-datetime')

6
payments/apps.py Normal file
View File

@@ -0,0 +1,6 @@
from django.apps import AppConfig
class PaymentsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'payments'

View File

@@ -0,0 +1,30 @@
# Generated by Django 5.1.4 on 2024-12-20 17:33
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('clients', '0001_initial'),
('comandas', '0003_comanda_status_alter_productcomanda_product'),
('typePay', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Payments',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('value', models.DecimalField(decimal_places=2, max_digits=10)),
('description', models.CharField(max_length=255)),
('datetime', models.DateTimeField(auto_now_add=True)),
('client', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='clients.client')),
('comanda', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='comandas.comanda')),
('type_pay', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='typePay.typepay')),
],
),
]

View File

38
payments/models.py Normal file
View File

@@ -0,0 +1,38 @@
from django.db import models
from decimal import Decimal
from typePay.models import TypePay
from comandas.models import Comanda, ProductComanda
from clients.models import Client
class Payments(models.Model):
id = models.AutoField(primary_key=True)
value = models.DecimalField(max_digits=10, decimal_places=2)
type_pay = models.ForeignKey(TypePay, on_delete=models.PROTECT)
comanda = models.ForeignKey(Comanda, on_delete=models.PROTECT)
client = models.ForeignKey(Client, null=True , on_delete=models.PROTECT)
description = models.CharField(max_length=255)
datetime = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.comanda.name
def somar(consumo:ProductComanda, comanda:Comanda):
parcial = Payments.objects.filter(comanda=comanda)
totalParcial = Decimal(0)
total:Decimal = Decimal(0)
for p in parcial:
totalParcial += p.value
for produto in consumo:
total += Decimal(produto.product.price)
valores = {
'total':total,
'parcial':totalParcial,
'taxa': round(total * Decimal(0.1), 2),
'totalSemTaxa':total - totalParcial,
'totalComTaxa': round((total - totalParcial)+(total * Decimal(0.1)),2)
}
return valores

15
payments/serializers.py Normal file
View File

@@ -0,0 +1,15 @@
from rest_framework import serializers
from .models import Payments
class PaymentsSerializer(serializers.ModelSerializer):
type_pay_name = serializers.ReadOnlyField(source='type_pay.name')
comanda_name = serializers.ReadOnlyField(source='comanda.name')
client_name = serializers.ReadOnlyField(source='client.name')
class Meta:
model = Payments
fields = [
'id', 'value', 'type_pay', 'type_pay_name',
'comanda', 'comanda_name', 'client', 'client_name',
'description', 'datetime'
]

3
payments/tests.py Normal file
View File

@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

3
payments/views.py Normal file
View File

@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.