3601tcart__errorHandler.hide();3602that.renderAddressFields(this);3603if (this.dataset.hashValue) {3604that.setHashInput(this.dataset.hashValue);3605}3606// cashrule3607that.hidePaymentMethod(this);36083609var inputsNeedUpdatePrice = document.querySelectorAll('.t706 input[data-delivery-type]');3610Array.prototype.forEach.call(inputsNeedUpdatePrice, function (el) {3611var price = el.getAttribute('data-static-price') || el.getAttribute('data-delivery-price');
if (price > 0) { el.setAttribute('data-delivery-price', price); } else { el.setAttribute('data-delivery-price', ''); } }); that.hints.deleteAll(); if (that.deliveryState.searchboxes['pickup-searchbox']) { that.deliveryState.searchboxes['pickup-searchbox'] = null; } if (this.getAttribute('data-hint-text')) { that.hints.render(this.getAttribute('data-hint-text')); } tcart__updateDelivery(); }, false ); }); }, /* Hiding the cash payment method if the restriction is set to cash */ hidePaymentMethod: function (control) { var cashControl = document.querySelector('.t706 [data-payment-variant-system="cash"]'); if (!cashControl) return; var cashControlParent = cashControl.parentNode; var paymentWrapper = cashControlParent.closest('.t-radio__wrapper-payment'); var firstControl = paymentWrapper.querySelector( '[data-payment-variant-system]:not([data-payment-variant-system="cash"])' ); // for now its only cash value if (control.dataset.restrictions === 'cash' && cashControl) { cashControlParent.style.display = 'none'; firstControl.checked = true; if (firstControl) { t_triggerEvent(firstControl, 'change'); } } else { cashControlParent.style.display = ''; } }, /* Removing the data-delivery-price attribute (price value) from the radio button */ removePriceValueInRadio: function (deliveryServiceId) { var radioDeliveryService = document.querySelector( '.t706 input.t-radio_delivery[data-service-id="' + deliveryServiceId + '"]' ); if (radioDeliveryService) { radioDeliveryService.removeAttribute('data-delivery-price'); tcart__updateDelivery(); tcart__hideDeliveryPrice(); } }, /* Updating the price value in the radio button */ updatePriceValueInRadio: function (priceValue, deliveryServiceId) { var serviceRadioInput = document.querySelector( '.t706 input.t-radio_delivery[data-service-id="' + deliveryServiceId + '"]' ); var serviceMinimumPrice = document.querySelector( '.t706 input.t-radio_delivery[data-service-id="' + deliveryServiceId + '"] ~ span.delivery-minimum-price' ); if (serviceRadioInput) { serviceRadioInput.setAttribute('data-delivery-price', priceValue); tcart__updateDelivery(); tcart__showDeliveryPrice(); } if (serviceMinimumPrice) { serviceMinimumPrice.innerHTML = t_delivery__showPrice(priceValue); } }, /* Changing the pickup point */ changePickupHandler: function (pickupPointId, name, postalCode, searchbox, pickupAddress, coordinates) { var searchInput = searchbox.querySelector('.searchbox-input'); var serviceId = searchInput.getAttribute('data-service-id'); var that = this; searchInput.setAttribute('data-pickup-id', pickupPointId); searchInput.setAttribute('data-pickup-address', pickupAddress); searchInput.value = name; that.updateDeliveryPrice(postalCode || this.deliveryState.city.postalCode, serviceId, pickupPointId);