mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 05:25:40 +00:00
bug: add product balcao resolved
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -11,6 +11,7 @@ from payments.models import Payments
|
||||
from typePay.models import TypePay
|
||||
|
||||
def listProductBalcao(request, comanda_id, search_product):
|
||||
comanda_id = request.GET.get("id-comanda-balcao")
|
||||
if search_product == '*':
|
||||
produtos_mais_vendidos = list(ProductComanda.objects.values('product').annotate(
|
||||
quantidade=Count('product'),
|
||||
@@ -83,7 +84,3 @@ def paymentBalcao(request, comanda_id):
|
||||
pagamento.save()
|
||||
return redirect('viewBalcao')
|
||||
|
||||
|
||||
|
||||
#"GET /balcao/addProductBalcaoTeclado83/1/1/ HTTP/1.1" 200 747
|
||||
#"GET /balcao/addProductBalcaoTeclado83/13/1/ HTTP/1.1" 500 133103
|
||||
@@ -18,6 +18,7 @@
|
||||
<div class="grid-container">
|
||||
<div style="text-align: center;">
|
||||
<h1>Venda Balcão</h1>
|
||||
<input hidden id="id-comanda-balcao" type="text" name="id-comanda-balcao" value="{{comanda.id}}">
|
||||
<div>
|
||||
|
||||
<button id="pagarComanda" onclick="modal_payment_comanda()"
|
||||
@@ -74,7 +75,7 @@
|
||||
<article
|
||||
name="productBox"
|
||||
id="productId-{{ product.id }}"
|
||||
onclick="addProductClick({{product.id}} , {{comanda.id}})"
|
||||
onclick="addProductClick({{product.id}})"
|
||||
style="background-color: #293552;">
|
||||
<p hidden id="{{forloop.counter0}}">{{product.id}}</p>
|
||||
<p hidden id="comanda{{forloop.counter0}}">{{comanda.id}}</p>
|
||||
@@ -88,7 +89,7 @@
|
||||
<article
|
||||
name="productBox"
|
||||
id="productId-{{ product.id }}"
|
||||
onclick="addProductClick({{product.id}} , {{comanda.id}})"
|
||||
onclick="addProductClick({{product.id}} )"
|
||||
style="background-color: #293552;">
|
||||
{{product.name}} <br>
|
||||
R$ {{product.price}}
|
||||
|
||||
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.
@@ -5,6 +5,7 @@ from mesas.models import Mesa
|
||||
|
||||
|
||||
def mesas(request):
|
||||
|
||||
mesas = Mesa.objects.all()
|
||||
return render(request, 'mesas.html', {'mesas': mesas})
|
||||
|
||||
|
||||
@@ -3,13 +3,12 @@
|
||||
{% for product in products %}
|
||||
|
||||
{% if forloop.counter0 == 0 %}
|
||||
<input hidden type="text" id="idComanda0" value="{{comanda_id}}">
|
||||
|
||||
<article
|
||||
name="productBox"
|
||||
id="productId-{{ product.id }}"
|
||||
style="background-color: #293552;"
|
||||
onclick="addProductClick({{product.id}} , {{comanda_id}})"
|
||||
onclick="addProductClick({{product.id}} )"
|
||||
>
|
||||
<p hidden id="{{forloop.counter0}}" >{{product.id}}</p>
|
||||
<p hidden id="comanda{{forloop.counter0}}" >{{comanda.id}}</p>
|
||||
@@ -23,7 +22,7 @@
|
||||
name="productBox"
|
||||
id="productId-{{ product.id }}"
|
||||
style="background-color: #293552;"
|
||||
onclick="addProductClick({{product.id}} , {{comanda.id}})"
|
||||
onclick="addProductClick({{product.id}})"
|
||||
>
|
||||
{{product.name}} <br>
|
||||
R$ {{product.price}}
|
||||
|
||||
@@ -93,8 +93,9 @@ function updateTotal(){
|
||||
|
||||
function addProductBalcao() {
|
||||
var productId = document.getElementById('0').innerText;
|
||||
var comandaId = document.getElementById('comanda0').innerText;
|
||||
var comandaId = document.getElementById("id-comanda-balcao").value;
|
||||
fieldQtd = document.getElementById('qtd-product');
|
||||
|
||||
var qtd = fieldQtd.value;
|
||||
const url = `/balcao/addProductBalcaoTeclado${productId}/${comandaId}/${qtd}/`;
|
||||
fetch(url, {
|
||||
@@ -150,9 +151,10 @@ function searchProduct() {
|
||||
function time(){
|
||||
var search_product = document.getElementById('search-product').value.trim()
|
||||
var productListElement = document.getElementById("product-list");
|
||||
var comanda_id = document.getElementById("idComanda0").value;
|
||||
var comanda_id = document.getElementsByName("id-comanda-balcao").value;
|
||||
if(search_product.length == 0 ){search_product ='*';}
|
||||
fetch(`/balcao/listProductBalcao/${comanda_id}/${search_product}`, {
|
||||
fetch(`/balcao/listProductBalcao/1/${search_product}`, {
|
||||
// fetch(`/balcao/listProductBalcao/${comanda_id}/${search_product}`, {
|
||||
method: 'GET',}
|
||||
).then(function(response) {
|
||||
return response.text();
|
||||
@@ -162,10 +164,12 @@ function searchProduct() {
|
||||
})}
|
||||
}
|
||||
|
||||
function addProductClick(productId, comandaId) {
|
||||
function addProductClick(productId) {
|
||||
fieldQtd = document.getElementById('qtd-product');
|
||||
var qtd = fieldQtd.value;
|
||||
fetch(`/balcao/addProductBalcaoTeclado${productId}/${comandaId}/${qtd}`, {
|
||||
var comanda_id = document.getElementById("id-comanda-balcao").value;
|
||||
console.log()
|
||||
fetch(`/balcao/addProductBalcaoTeclado${productId}/${comanda_id}/${qtd}`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'}
|
||||
|
||||
Reference in New Issue
Block a user