mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 21:45:41 +00:00
chore: Delete numerous application modules, templates, static assets, documentation, and build files.
This commit is contained in:
18
gestaoRaul/.gitignore
vendored
18
gestaoRaul/.gitignore
vendored
@@ -1,18 +0,0 @@
|
||||
.venv/
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
.env
|
||||
db.sqlite3
|
||||
media/
|
||||
static/
|
||||
.python-version
|
||||
uv.lock
|
||||
pyproject.toml
|
||||
GUIA_POSTMAN_API.md
|
||||
brain/
|
||||
logs/
|
||||
walkthrough.md
|
||||
task.md
|
||||
implementation_plan*.md
|
||||
*.webp
|
||||
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.
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.
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 +0,0 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
@@ -1,6 +0,0 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class ComandasConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'balcao'
|
||||
@@ -1,125 +0,0 @@
|
||||
from django.shortcuts import render, redirect
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.db.models import Count, F
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
|
||||
|
||||
|
||||
from comandas.models import Comanda, ProductComanda, StockMovementType, StockMovement
|
||||
from mesas.models import Mesa
|
||||
from products.models import Product
|
||||
from payments.models import Payments
|
||||
from typePay.models import TypePay
|
||||
from gestaoRaul.decorators import group_required
|
||||
|
||||
def listProductBalcao(request, comanda_id, search_product):
|
||||
comanda_id = request.GET.get("id-comanda-balcao")
|
||||
if search_product == '*':
|
||||
products_ordenados = ProductComanda.maisVendidos()
|
||||
|
||||
return render(request, "htmx_components/htmx_list_products_balcao.html", {"products": products_ordenados,'comanda_id':comanda_id})
|
||||
else:
|
||||
product = search_product
|
||||
products = Product.objects.filter(name__icontains=product, active=True)
|
||||
return render(request, "htmx_components/htmx_list_products_balcao.html", {"products": products[:15],'comanda_id':comanda_id})
|
||||
|
||||
|
||||
@group_required(groupName='Garçom')
|
||||
def addProductBalcao(request, product_id, comanda_id, qtd):
|
||||
for i in range(qtd):
|
||||
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)
|
||||
user = User.objects.get(id=request.user.id)
|
||||
typeMovement = StockMovementType.objects.get(name="Venda - Balcao")
|
||||
|
||||
StockMovement.subTransactionStock(
|
||||
product=product,
|
||||
movement_type=typeMovement,
|
||||
comanda=comanda,
|
||||
user=user,
|
||||
qtd=1,
|
||||
obs= "Vendido no balcão"
|
||||
)
|
||||
|
||||
consumo = ProductComanda.objects.filter(comanda=comanda_id)
|
||||
total = 0
|
||||
for produto in consumo:
|
||||
total += produto.product.price
|
||||
return render(request, "htmx_components/htmx_list_products_in_balcao.html",{'consumo': consumo, 'total': total})
|
||||
|
||||
@group_required(groupName='Garçom')
|
||||
@csrf_exempt
|
||||
def addProductBalcaoTeclado(request, product_id, comanda_id, qtd):
|
||||
for i in range(qtd):
|
||||
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)
|
||||
user = User.objects.get(id=request.user.id)
|
||||
typeMovement = StockMovementType.objects.get(name="Venda - Balcao")
|
||||
|
||||
StockMovement.subTransactionStock(
|
||||
product=product,
|
||||
movement_type=typeMovement,
|
||||
comanda=comanda,
|
||||
user=user,
|
||||
qtd=1,
|
||||
obs= "Vendido no balcão"
|
||||
)
|
||||
|
||||
consumo = ProductComanda.objects.filter(comanda=comanda_id)
|
||||
total = 0
|
||||
for produto in consumo:
|
||||
total += produto.product.price
|
||||
return render(request, "htmx_components/htmx_list_products_in_balcao.html",{'consumo': consumo, 'total': total})
|
||||
|
||||
@group_required(groupName='Garçom')
|
||||
def removeProductBalcao(request, productComanda_id):
|
||||
product_comanda = ProductComanda.objects.get(id=productComanda_id)
|
||||
comanda = product_comanda.comanda
|
||||
product = product_comanda.product
|
||||
user = User.objects.get(id=request.user.id)
|
||||
typeMovement = StockMovementType.objects.get(name="Estorno")
|
||||
|
||||
consumo = ProductComanda.objects.filter(comanda=product_comanda.comanda)
|
||||
StockMovement.sumTransactionStock(
|
||||
product=product,
|
||||
movement_type=typeMovement,
|
||||
comanda=comanda,
|
||||
user=user,
|
||||
qtd=1,
|
||||
obs= "Excluido do balcão"
|
||||
)
|
||||
|
||||
|
||||
product_comanda.delete()
|
||||
|
||||
total = 0
|
||||
for produto in consumo:
|
||||
total += produto.product.price
|
||||
return render(request, "htmx_components/htmx_list_products_in_balcao.html",{'consumo': consumo, 'total': total})
|
||||
|
||||
@group_required(groupName='Garçom')
|
||||
def paymentBalcao(request, comanda_id):
|
||||
typePayment = TypePay.objects.get(id=1)
|
||||
consumo = ProductComanda.objects.filter(comanda=comanda_id)
|
||||
user = User.objects.get(id=request.user.id)
|
||||
try:
|
||||
vendasBalcao = Comanda.objects.get(name='VENDAS BALCAO')
|
||||
except:
|
||||
mesa = Mesa.objects.get(id=1)
|
||||
vendasBalcao = Comanda(name='VENDAS BALCAO', mesa=mesa, user=request.user, status='CLOSED')
|
||||
vendasBalcao.save()
|
||||
comanda = Comanda.objects.get(name=f'{user.id} - BALCÃO - {user.first_name}')
|
||||
total = 0
|
||||
for produto in consumo:
|
||||
total += produto.product.price
|
||||
produto.comanda = vendasBalcao
|
||||
produto.save()
|
||||
pagamento = Payments(value=total, comanda=comanda, type_pay=typePayment,description=f'{user.id} - BALCÃO - {user.first_name}')
|
||||
pagamento.save()
|
||||
return redirect('viewBalcao')
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
# from django.db import models
|
||||
|
||||
# from clients.models import Client
|
||||
# from products.models import Product
|
||||
# from mesas.models import Mesa
|
||||
# from typePay.models import TypePay
|
||||
|
||||
# class Comanda(models.Model):
|
||||
# id = models.AutoField(primary_key=True)
|
||||
# mesa = models.ForeignKey(Mesa, on_delete=models.CASCADE)
|
||||
# type_pay = models.ForeignKey(TypePay, on_delete=models.SET_NULL, null=True)
|
||||
# dt_open = models.DateTimeField(auto_now_add=True)
|
||||
# dt_close = models.DateTimeField(null=True, blank=True)
|
||||
# client = models.ForeignKey(Client, on_delete=models.SET_NULL, null=True, blank=True)
|
||||
# name = models.CharField(max_length=255)
|
||||
# status = models.CharField(max_length=255, default="OPEN")
|
||||
# def __str__(self) -> str:
|
||||
# return self.name
|
||||
|
||||
# class ProductComanda(models.Model):
|
||||
# id = models.AutoField(primary_key=True)
|
||||
# comanda = models.ForeignKey(Comanda, on_delete=models.CASCADE)
|
||||
# data_time = models.DateTimeField(auto_now_add=True)
|
||||
# product = models.ForeignKey(Product, on_delete=models.PROTECT)
|
||||
# applicant = models.CharField(max_length=255, null=True, blank=True)
|
||||
# def __str__(self) -> str:
|
||||
# return self.comanda.name + " - " + self.product.name
|
||||
@@ -1,142 +0,0 @@
|
||||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block 'title' %}
|
||||
|
||||
{{comanda.name}}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block 'head' %}
|
||||
<link rel="stylesheet" href="{% static 'comandas/css/viewbalcao.css' %}">
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block 'body' %}
|
||||
|
||||
<body>
|
||||
<div class="grid-container">
|
||||
<div style="text-align: center;">
|
||||
<h1>Venda Balcão</h1>
|
||||
<input hidden type="text" name="id-comanda-balcao" id="id-comanda-balcao" value="{{comanda.id}}">
|
||||
<div>
|
||||
|
||||
<button id="pagarComanda" class="btn-secondary" onclick="modal_payment_comanda()"
|
||||
{% if total == 0 %}
|
||||
disabled
|
||||
{% endif %}>Receber</button>
|
||||
|
||||
<button class="btn-primary" id="imprimirFichas" onclick="imprimirFichas()"
|
||||
{% if total == 0 %}
|
||||
disabled
|
||||
{% endif %}
|
||||
>Imprimir Fichas</button>
|
||||
|
||||
</div>
|
||||
|
||||
<table id="list-products-balcao">
|
||||
<tr>
|
||||
<th style="text-align: left;"><b>Produto</b></th>
|
||||
<th style="text-align: left;"><b>Preço</b></th>
|
||||
</tr>
|
||||
{% for item in consumo%}
|
||||
|
||||
<tr>
|
||||
<td>{{item.product.name}}</td>
|
||||
<td>R$ {{item.product.price}} </td>
|
||||
<td><button class="btn-cancel" onclick="removeProductBalcao({{item.id}})">Excluir</button></td>
|
||||
</tr>
|
||||
|
||||
{% endfor %}
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: center;">Total R$ {{total}}</td>
|
||||
</tr>
|
||||
<tr hidden>
|
||||
<td hidden id="total">{{total}}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="add-produto">
|
||||
<form id="productForm">
|
||||
<h2 style="text-align: center;">Buscar Produto </h2>
|
||||
<div class="grid-container">
|
||||
<input id="search-product" name="search-product" type="text" oninput="searchProduct()" autofocus
|
||||
placeholder="Buscar Produto">
|
||||
<input type="number" id="qtd-product" name="qtd-product" value="1" required min="1"><br>
|
||||
</div>
|
||||
<div id="product-list" class="grid-list-products">
|
||||
{% for product in products %}
|
||||
{% if forloop.counter0 == 0 %}
|
||||
|
||||
<article
|
||||
style="background-image: url('{{product.image}}');"
|
||||
name="productBox"
|
||||
id="productId-{{ product.id }}"
|
||||
class="card-product"
|
||||
onclick="addProductClick({{product.id}} )"
|
||||
>
|
||||
<p hidden id="{{forloop.counter0}}" >{{product.id}}</p>
|
||||
<p hidden id="comanda{{forloop.counter0}}" >{{comanda.id}}</p>
|
||||
<p class="card-product-p"> {{product.name}}</p>
|
||||
<p id="{{product.id}}"></p>
|
||||
<p class="card-product-p"> R$ {{product.price}}</p>
|
||||
</article >
|
||||
|
||||
{% else %}
|
||||
|
||||
<article
|
||||
style="background-image: url('{{product.image}}');"
|
||||
name="productBox"
|
||||
id="productId-{{ product.id }}"
|
||||
class="card-product"
|
||||
onclick="addProductClick({{product.id}})"
|
||||
>
|
||||
<p class="card-product-p"> {{product.name}}</p>
|
||||
<p class="card-product-p"> R$ {{product.price}}</p>
|
||||
</article >
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<dialog id="payment-comanda" style="display: none;">
|
||||
<article>
|
||||
<h2>Pagamento</h2>
|
||||
<h1 id="first-total">R$ {{ total }}</h1>
|
||||
<div>
|
||||
<p>Recebido:</p> <input id="recebido" type="number">
|
||||
<h4 id="troco">Troco: </h4>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<button class="btn-secondary" hx-get="{% url 'paymentBalcao' comanda.id %} " hx-trigger="click" hx-swap="none"
|
||||
onclick="reloadPage()">
|
||||
Receber
|
||||
</button>
|
||||
|
||||
<button class="btn-cancel" onclick="close_modal_payment_comanda()">Cancelar</button>
|
||||
</footer>
|
||||
</article>
|
||||
</dialog>
|
||||
|
||||
|
||||
<script src="{% static 'comandas/js/viewbalcao.js' %}"></script>
|
||||
</body>
|
||||
|
||||
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,3 +0,0 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
@@ -1,21 +0,0 @@
|
||||
|
||||
from django.urls import path
|
||||
|
||||
from balcao import htmx_views
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.viewBalcao, name='viewBalcao'),
|
||||
|
||||
]
|
||||
|
||||
|
||||
htmx_urlpatterns = [
|
||||
path('listProductBalcao/<int:comanda_id>/<str:search_product>/', htmx_views.listProductBalcao, name='listProductBalcao'),
|
||||
path('addProductBalcao<int:product_id>/<int:comanda_id>/<int:qtd>/', htmx_views.addProductBalcao, name='addProductBalcao'),
|
||||
path('addProductBalcaoTeclado<int:product_id>/<int:comanda_id>/<int:qtd>/', htmx_views.addProductBalcaoTeclado, name='addProductBalcaoTeclado'),
|
||||
path('removeProductBalcao<int:productComanda_id>/', htmx_views.removeProductBalcao, name='removeProductBalcao'),
|
||||
path('paymentBalcao<int:comanda_id>/', htmx_views.paymentBalcao, name='paymentBalcao'),
|
||||
]
|
||||
|
||||
urlpatterns += htmx_urlpatterns
|
||||
@@ -1,30 +0,0 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
from comandas.models import Comanda, ProductComanda
|
||||
from products.models import Product
|
||||
from mesas.models import Mesa
|
||||
from django.db.models import Count, F
|
||||
from django.contrib.auth.models import User
|
||||
from gestaoRaul.decorators import group_required
|
||||
|
||||
|
||||
|
||||
@group_required(groupName='Garçom')
|
||||
def viewBalcao(request):
|
||||
user = User.objects.get(id=request.user.id)
|
||||
try:
|
||||
comanda = Comanda.objects.get(name=f'{user.id} - BALCÃO - {user.first_name}')
|
||||
except:
|
||||
mesa = Mesa.objects.get(id=1)
|
||||
comanda = Comanda(name=f'{user.id} - BALCÃO - {user.first_name}', mesa=mesa, user=user,status='CLOSED')
|
||||
comanda.save()
|
||||
|
||||
consumo = ProductComanda.objects.filter(comanda=comanda.id)
|
||||
products_ordenados = ProductComanda.maisVendidos()
|
||||
total = 0
|
||||
for produto in consumo:
|
||||
total += produto.product.price
|
||||
|
||||
return render(request, 'viewBalcao.html', {'comanda': comanda, 'consumo': consumo, 'total': total, 'products': products_ordenados})
|
||||
|
||||
|
||||
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.
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.
Binary file not shown.
@@ -1,6 +0,0 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from categories.models import Categories
|
||||
|
||||
|
||||
admin.site.register(Categories)
|
||||
@@ -1,8 +0,0 @@
|
||||
from rest_framework import viewsets, permissions
|
||||
from .models import Categories
|
||||
from .serializers import CategoriesSerializer
|
||||
|
||||
class CategoriesViewSet(viewsets.ModelViewSet):
|
||||
queryset = Categories.objects.all()
|
||||
serializer_class = CategoriesSerializer
|
||||
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
|
||||
@@ -1,6 +0,0 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class CategoriesConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'categories'
|
||||
@@ -1,21 +0,0 @@
|
||||
# Generated by Django 5.1.4 on 2024-12-10 00:52
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Category',
|
||||
fields=[
|
||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('name', models.CharField(max_length=255)),
|
||||
],
|
||||
),
|
||||
]
|
||||
@@ -1,17 +0,0 @@
|
||||
# Generated by Django 5.1.4 on 2024-12-10 01:01
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('categories', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameModel(
|
||||
old_name='Category',
|
||||
new_name='Categories',
|
||||
),
|
||||
]
|
||||
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,10 +0,0 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
class Categories(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
name = models.CharField(max_length=255)
|
||||
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.name
|
||||
@@ -1,7 +0,0 @@
|
||||
from rest_framework import serializers
|
||||
from .models import Categories
|
||||
|
||||
class CategoriesSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = Categories
|
||||
fields = '__all__'
|
||||
@@ -1,11 +0,0 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
|
||||
|
||||
|
||||
{% block 'title' %}
|
||||
Categorias{% endblock %}
|
||||
|
||||
{% block 'body' %}
|
||||
Body Type Pay
|
||||
{% endblock %}
|
||||
@@ -1,3 +0,0 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
@@ -1,10 +0,0 @@
|
||||
|
||||
from django.urls import path
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.categories, name='categories'),
|
||||
|
||||
|
||||
|
||||
]
|
||||
@@ -1,6 +0,0 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
|
||||
|
||||
def categories(request):
|
||||
return render(request, 'categories.html')
|
||||
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.
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.
Binary file not shown.
@@ -1,6 +0,0 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from clients.models import Client
|
||||
|
||||
|
||||
admin.site.register(Client)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user