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