mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
feat: acossiar comandas fiados a conta client
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -33,7 +33,7 @@ Clientes
|
|||||||
{% for client in clients %}
|
{% for client in clients %}
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td id="name-{{client.id}}" >{{client.name}}</td>
|
<td ><a id="name-{{client.id}}" href="{% url 'viewClient' client.id %}">{{client.name}}</a></td>
|
||||||
<td id="debt-{{client.id}}" >R$ {{client.debt}}</td>
|
<td id="debt-{{client.id}}" >R$ {{client.debt}}</td>
|
||||||
<td class="hide-on-mobile" id="contact-{{client.id}}" >{{client.contact}}</td>
|
<td class="hide-on-mobile" id="contact-{{client.id}}" >{{client.contact}}</td>
|
||||||
<td hidden id="active-{{client.id}}" >{{client.active}}</td>
|
<td hidden id="active-{{client.id}}" >{{client.active}}</td>
|
||||||
|
|||||||
61
gestaoRaul/clients/templates/viewclient.html
Normal file
61
gestaoRaul/clients/templates/viewclient.html
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% load static %}
|
||||||
|
{% load custom_filter_tag %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block 'title' %}
|
||||||
|
Comandas
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block 'head' %}
|
||||||
|
<link rel="stylesheet" href="{% static 'comandas/css/comandas.css' %}">
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block 'body' %}
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div style="justify-self: center;">
|
||||||
|
<h4>{{client.name}}</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class=" ">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th style="text-align: left;"><b>Nome</b></th>
|
||||||
|
<th style="text-align: left;"><b>Atendente</b></th>
|
||||||
|
<th style="text-align: left;"><b>Data abertura</b></th>
|
||||||
|
<th style="text-align: left;"><b>Data fechamento</b></th>
|
||||||
|
<th style="text-align: left;"><b>Detalhes</b></th>
|
||||||
|
<th style="text-align: left;"><b>Valor</b></th>
|
||||||
|
</tr>
|
||||||
|
{% for comanda in comandas %}
|
||||||
|
<tr>
|
||||||
|
<td>{{comanda.name}}</td>
|
||||||
|
<td>{{comanda.user.first_name}} {{comanda.user.last_name}}</td>
|
||||||
|
<td>{{comanda.dt_open}}</td>
|
||||||
|
<td>{{comanda.dt_close}}</td>
|
||||||
|
<td>
|
||||||
|
<span data-tooltip="Visualizar Comanda" data-flow="top">
|
||||||
|
<a href="{% url 'viewcomanda' %}?parametro={{ comanda.id }}">
|
||||||
|
<img
|
||||||
|
src="{% static 'midia/icons/view.svg' %}"
|
||||||
|
style="height: 35px; cursor: pointer;">
|
||||||
|
</img>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ comanda.id | total }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
<script src="{% static 'comandas/js/comandas.js' %}"></script>
|
||||||
|
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
@@ -7,6 +7,7 @@ urlpatterns = [
|
|||||||
path('createClient', views.createClient, name='createClient'),
|
path('createClient', views.createClient, name='createClient'),
|
||||||
path('editClient', views.editClient, name='editClient'),
|
path('editClient', views.editClient, name='editClient'),
|
||||||
path('payDebt', views.payDebt, name='payDebt'),
|
path('payDebt', views.payDebt, name='payDebt'),
|
||||||
|
path('viewClient/<int:clientId>', views.viewClient, name='viewClient'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
from django.shortcuts import render, redirect
|
from django.shortcuts import render, redirect
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
|
from comandas.models import Comanda
|
||||||
from gestaoRaul.decorators import group_required
|
from gestaoRaul.decorators import group_required
|
||||||
from clients.models import Client
|
from clients.models import Client
|
||||||
|
|
||||||
@@ -11,6 +12,13 @@ def clients(request):
|
|||||||
clients = Client.objects.all()
|
clients = Client.objects.all()
|
||||||
return render(request, 'clients.html', {'clients': clients})
|
return render(request, 'clients.html', {'clients': clients})
|
||||||
|
|
||||||
|
def viewClient(request,clientId):
|
||||||
|
id = int(clientId)
|
||||||
|
print(id)
|
||||||
|
client = Client.objects.get(id=id)
|
||||||
|
comandas = Comanda.objects.filter(client = client).filter(status = 'FIADO')
|
||||||
|
return render(request, 'viewclient.html', {'client': client, 'comandas': comandas})
|
||||||
|
|
||||||
|
|
||||||
@group_required(groupName='Gerente')
|
@group_required(groupName='Gerente')
|
||||||
def createClient(request):
|
def createClient(request):
|
||||||
|
|||||||
Binary file not shown.
@@ -34,7 +34,7 @@ Detalhes {{comanda.name}}
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
>Fechar Conta</button>
|
>Fechar Conta</button>
|
||||||
|
|
||||||
{% if comanda.status == 'PAYING' %}
|
{% if comanda.status == 'PAYING' or comanda.status == 'FIADO'%}
|
||||||
<button class="btn-secondary" id="pagarComanda" onclick="modal_payment_comanda()">Receber</button>
|
<button class="btn-secondary" id="pagarComanda" onclick="modal_payment_comanda()">Receber</button>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
@@ -207,9 +207,11 @@ Detalhes {{comanda.name}}
|
|||||||
<div style="display: flex;gap: 10px;">
|
<div style="display: flex;gap: 10px;">
|
||||||
|
|
||||||
<button type="submit" class="btn-secondary" onclick="backPage()">Receber</button>
|
<button type="submit" class="btn-secondary" onclick="backPage()">Receber</button>
|
||||||
|
{% if comanda.status != 'FIADO' %}
|
||||||
<button type="button" class="btn-primary" onclick=" modal_conta_client()">
|
<button type="button" class="btn-primary" onclick=" modal_conta_client()">
|
||||||
Conta
|
Conta
|
||||||
</button>
|
</button>
|
||||||
|
{% endif %}
|
||||||
<button type="button" class="btn-cancel" onclick="close_modal_payment_comanda()">Cancelar</button>
|
<button type="button" class="btn-cancel" onclick="close_modal_payment_comanda()">Cancelar</button>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|||||||
Binary file not shown.
@@ -1,6 +1,8 @@
|
|||||||
|
from decimal import Decimal
|
||||||
from django import template
|
from django import template
|
||||||
|
|
||||||
from comandas.models import Comanda, ProductComanda
|
from comandas.models import Comanda, ProductComanda
|
||||||
|
from payments.models import Payments
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
@@ -8,10 +10,18 @@ register = template.Library()
|
|||||||
def filter_total(value):
|
def filter_total(value):
|
||||||
id = value
|
id = value
|
||||||
comanda_id = int(id)
|
comanda_id = int(id)
|
||||||
|
totalParcial = Decimal(0)
|
||||||
|
comanda = Comanda.objects.get(id=comanda_id)
|
||||||
consumo = ProductComanda.objects.filter(comanda=comanda_id)
|
consumo = ProductComanda.objects.filter(comanda=comanda_id)
|
||||||
total = 0
|
parcial = Payments.objects.filter(comanda=comanda)
|
||||||
|
for p in parcial:
|
||||||
|
totalParcial += p.value
|
||||||
|
|
||||||
|
total = Decimal(0)
|
||||||
for produto in consumo:
|
for produto in consumo:
|
||||||
total += produto.product.price
|
total += produto.product.price
|
||||||
|
taxa = round(total * Decimal(0.1), 2)
|
||||||
|
total = (total + taxa) - totalParcial
|
||||||
return f'R$ {total}'
|
return f'R$ {total}'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -87,12 +87,12 @@ def addContaCliente(request):
|
|||||||
|
|
||||||
comandaId = int(request.POST.get('idComanda'))
|
comandaId = int(request.POST.get('idComanda'))
|
||||||
clientId = int(request.POST.get('select-client'))
|
clientId = int(request.POST.get('select-client'))
|
||||||
valor = float(request.POST.get('valor-conta').replace(',','.'))
|
|
||||||
comanda = Comanda.objects.get(id=comandaId)
|
comanda = Comanda.objects.get(id=comandaId)
|
||||||
client = Client.objects.get(id=clientId)
|
client = Client.objects.get(id=clientId)
|
||||||
client.debt = client.debt + Decimal(valor)
|
# client.debt = Decimal(0)
|
||||||
comanda.client = client
|
comanda.client = client
|
||||||
comanda.status = 'CLOSED'
|
comanda.dt_close = timezone.now()
|
||||||
|
comanda.status = 'FIADO'
|
||||||
client.save()
|
client.save()
|
||||||
comanda.save()
|
comanda.save()
|
||||||
return redirect('comandas')
|
return redirect('comandas')
|
||||||
|
|||||||
Binary file not shown.
14
gestaoRaul/templates/static/midia/icons/details.svg
Normal file
14
gestaoRaul/templates/static/midia/icons/details.svg
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
|
||||||
|
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Transformed by: SVG Repo Mixer Tools -->
|
||||||
|
<svg fill="#ffa500" width="96px" height="96px" viewBox="0 0 36 36" version="1.1" preserveAspectRatio="xMidYMid meet" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
|
||||||
|
<g id="SVGRepo_bgCarrier" stroke-width="0"/>
|
||||||
|
|
||||||
|
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
|
||||||
|
<g id="SVGRepo_iconCarrier"> <title>view-list-line</title> <rect class="clr-i-outline clr-i-outline-path-1" x="2" y="8" width="2" height="2"/>
|
||||||
|
|
||||||
|
<path class="clr-i-outline clr-i-outline-path-2" d="M7,10H31a1,1,0,0,0,0-2H7a1,1,0,0,0,0,2Z"/>
|
||||||
|
|
||||||
|
<rect class="clr-i-outline clr-i-outline-path-3" x="2" y="14" width="2" height="2"/>
|
||||||
|
After Width: | Height: | Size: 1.3 KiB |
9
gestaoRaul/templates/static/midia/icons/view.svg
Normal file
9
gestaoRaul/templates/static/midia/icons/view.svg
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
|
||||||
|
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Transformed by: SVG Repo Mixer Tools -->
|
||||||
|
<svg width="800px" height="800px" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" fill="#ffa500">
|
||||||
|
|
||||||
|
<g id="SVGRepo_bgCarrier" stroke-width="0"/>
|
||||||
|
|
||||||
|
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
|
||||||
|
After Width: | Height: | Size: 865 B |
Reference in New Issue
Block a user