Removed console.log debug statements

This commit is contained in:
Yarne Coppens 2024-08-05 18:05:41 +02:00
parent db06ec4504
commit aeef56e663

View file

@ -28,31 +28,34 @@ async function loadProducts() {
barcodeForm.addEventListener("submit", (e) => { barcodeForm.addEventListener("submit", (e) => {
e.preventDefault(); e.preventDefault();
const barcode = document.getElementById('barcode_input').value if (to_fill_product_index < 5) {
var chosen_product
for (index = 0; index < all_products.length; index++) { const barcode = document.getElementById('barcode_input').value
if (all_products[index].barcode == barcode) { var chosen_product
chosen_product = all_products[index] for (index = 0; index < all_products.length; index++) {
if (all_products[index].barcode == barcode) {
chosen_product = all_products[index]
}
} }
barcode_input.value = ""
const product_placeholders = document.getElementsByClassName('product_col')
const chosen_product_placeholder = product_placeholders[to_fill_product_index]
const image_product = chosen_product_placeholder.getElementsByClassName('product_image')[0]
const price_product = chosen_product_placeholder.getElementsByClassName('product_price')[0]
const total_price_holder = document.getElementById("totalprice")
total_price += chosen_product.price
image_product.setAttribute('src', api_url + "/icons/" + chosen_product.image_filename);
price_product.textContent = "\u20AC " + chosen_product.price
total_price_holder.textContent = "\u20AC " + total_price
to_fill_product_index += 1
}else{
barcode_input.value = ""
} }
barcode_input.value = ""
const product_placeholders = document.getElementsByClassName('product_col')
const chosen_product_placeholder = product_placeholders[to_fill_product_index]
const image_product = chosen_product_placeholder.getElementsByClassName('product_image')[0]
const price_product = chosen_product_placeholder.getElementsByClassName('product_price')[0]
const total_price_holder = document.getElementById("totalprice")
total_price += chosen_product.price
console.log(image_product)
image_product.setAttribute('src', api_url + "/icons/" + chosen_product.image_filename);
price_product.textContent = "\u20AC " + chosen_product.price
total_price_holder.textContent = "\u20AC " + total_price
to_fill_product_index += 1
}); });
} }