bugfix in send form

master
Gustavo Luigi 2022-09-08 13:14:40 +02:00
parent e4fdf34849
commit 1ad1ed3174
1 changed files with 10 additions and 9 deletions

View File

@ -34,7 +34,15 @@ function updateProducts(){
let elementProduct = createProductElement(objProduct); let elementProduct = createProductElement(objProduct);
$('#list-products').append(elementProduct); $('#list-products').append(elementProduct);
}); });
$('#total-checkout-price').text(numberToEuroFormat(totalPrice)); if(totalPrice > 0){
$('#total-checkout-price').text(numberToEuroFormat(totalPrice));
}else{
$('#form-section').hide();
$('#list-products').parent().parent().parent().parent().parent().find('.modal-footer').hide();
$('#total-checkout-price').parent().parent().parent().hide();
$('#no-products-in-checkout').hide();
$('#cart-error-in-checkout').show();
}
}).fail(function(response){ }).fail(function(response){
$('#form-section').hide(); $('#form-section').hide();
$('#list-products').parent().parent().parent().parent().parent().find('.modal-footer').hide(); $('#list-products').parent().parent().parent().parent().parent().find('.modal-footer').hide();
@ -48,13 +56,6 @@ function updateProducts(){
$('#no-products-in-checkout').hide(); $('#no-products-in-checkout').hide();
$('#cart-error-in-checkout').hide(); $('#cart-error-in-checkout').hide();
} }
else if(totalPrice > 0){
$('#form-section').hide();
$('#list-products').parent().parent().parent().parent().parent().find('.modal-footer').hide();
$('#total-checkout-price').parent().parent().parent().hide();
$('#no-products-in-checkout').hide();
$('#cart-error-in-checkout').show();
}
else{ else{
$('#form-section').hide(); $('#form-section').hide();
$('#list-products').parent().parent().parent().parent().parent().find('.modal-footer').hide(); $('#list-products').parent().parent().parent().parent().parent().find('.modal-footer').hide();
@ -78,7 +79,7 @@ $(window).on('load', function(){
product = calculatePrice(product); product = calculatePrice(product);
return product.quantity+'x '+product.title+' ('+numberToEuroFormat(product.calc_preis)+')'; return product.quantity+'x '+product.title+' ('+numberToEuroFormat(product.calc_preis)+')';
}); });
let cart = products.join("\n")+"\nGesammt: "+numberToEuroFormat(totalPrice); let cart = products.join(" - ")+" - Gesammt: "+numberToEuroFormat(totalPrice);
$('#ccart').val(cart); $('#ccart').val(cart);
objProducts = []; objProducts = [];
localStorage.setItem("products", JSON.stringify(objProducts)); localStorage.setItem("products", JSON.stringify(objProducts));