bug: add product balcao resolved

This commit is contained in:
2025-01-15 13:42:15 -03:00
parent 43d9cd9c5b
commit 8a13a8806a
14 changed files with 16 additions and 14 deletions

View File

@@ -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}}

View File

@@ -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'}