5301tcart__syncProductsObject__LStoObj();5302}53035304// TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551)5305// @ts-expect-error ST-2949_15306window.tcart.products.splice(cartProductIndex, 1);5307if (productElement.parentNode !== null) {5308productElement.parentNode.removeChild(productElement);5309}5310tcart__updateTotalProductsinCartObj();5311tcart__reDrawCartIcon();5312
tcart__saveLocalObj(); tcart__reDrawProducts(); tcart__reDrawTotal(); // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) // @ts-expect-error ST-2949_1 if (window.tcart.products.length === 0) { if (window.tcart_fullscreen) { tcart__closeCartFullscreen(); tcart__closeCartSidebar(); } else { tcart__closeCart(); } } }}// TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)// @ts-expect-error ST-2949_2function tcart__product__editquantity(buttonElement) { var quantity; if (buttonElement.querySelector('.t706__product-quantity-inp')) { return; } var productElement = buttonElement.closest('.t706__product'); var cartProductIndex = productElement.getAttribute('data-cart-product-i'); var buttonElementText = parseInt(buttonElement.textContent, 10); if (buttonElementText == 0 || buttonElementText > 0) { quantity = buttonElementText; } else { quantity = 1; } var str = '<input type="text" name="tilda-tmp-cart-qnt" class="t706__product-quantity-inp" value="' + quantity + '" style="width:30px">'; buttonElement.innerHTML = str; buttonElement.classList.add('t706__product-quantity_editing'); var quantityInput = buttonElement.querySelector('.t706__product-quantity-inp'); quantityInput.addEventListener('focus', function () { // TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015) // @ts-expect-error ST-2949_2 var inputElement = this; setTimeout(function () { inputElement.selectionStart = 10000; inputElement.selectionEnd = 10000; }, 0); }); quantityInput.focus(); quantityInput.addEventListener('focusout', function () { var quantity; var quantityInputValue = parseInt(quantityInput.value, 10); if (quantityInputValue > 0) { quantity = quantityInputValue; } else { quantity = 1; } tcart__product__updateQuantity(buttonElement, productElement, cartProductIndex, quantity); // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) // @ts-expect-error ST-2949_1 buttonElement.textContent = window.tcart.products[cartProductIndex].quantity; buttonElement.classList.remove('t706__product-quantity_editing'); });}// TODO ST-2949_2: implicit any on params, vars, this, and index access (TS7006, TS7005, TS7008, TS7034, TS2683, TS7053, TS7015)// @ts-expect-error ST-2949_2function tcart__product__updateQuantity(buttonElement, productElement, cartProductIndex, quantity) { var finalQuantity = quantity; if (finalQuantity > 0) { if ( // TODO ST-2949_1: missing properties on Window/DOM/data objects (TS2339, TS2551) // @ts-expect-error ST-2949_1 window.tcart.products[cartProductIndex].inv !== undefined && // @ts-expect-error ST-2949_1 window.tcart.products[cartProductIndex].inv > 0 ) { // @ts-expect-error ST-2949_1 if (finalQuantity > window.tcart.products[cartProductIndex].inv) { alert(tcart_dict('limitReached')); // @ts-expect-error ST-2949_1 finalQuantity = window.tcart.products[cartProductIndex].inv; } }