// Run when the page ready (before images and other resource) jQuery(function($) {MultiCurrencies.init();ActiveOrderPopup.init();WishList.init();});var MultiCurrencies = function() {var that = {nameSpace: 'multi-currencies',isActive: false,isChangedCurrency: false};that.init = function() {$(document).on('s123.page.ready.multi_currencies', function( event ) {that.settings = tryParseJSON($('.s123-multi-currencies').val());if ( !that.settings ) return;if ( !that.settings.active ) return;that.activeCurrency = tryParseJSON($.cookie($(websiteID).val()+'-'+that.nameSpace));that.defaultCurrency = that.settings.defaultCurrency;that.currencies = that.settings.currencies;that.setActiveCurrency(that.activeCurrency.currency);that.$menuIcon = $('[data-toggle="multiCurrenciesPopup"]');that.isActive = true;$(document).off('build_popup.open.multi_currencies').on('build_popup.open.multi_currencies', function( event ) {handleMenuIcon($('#popupFloatDivMenu [data-toggle="multiCurrenciesPopup"]'),true);});handleMenuIcon(that.$menuIcon,false);that.priceOnlyType.backup();$(document).off('pageLoaded.multi_currencies').on('pageLoaded.multi_currencies', function( event ) {if ( $.isNumeric(S123.QueryString.clientZone) ) {$('.client-zone-orders-table [data-rel="multiCurrency"]').removeAttr('data-rel');} if ( isDefaultCurrency() && that.isChangedCurrency ) {that.reset();} else if ( isDefaultCurrency() && !that.isChangedCurrency ) {$('[data-rel="multiCurrency"]').css({visibility: 'visible'});} else {updateAllPrices();}});if ( $.isNumeric(S123.QueryString.clientZone) ) return;$(document).off('s123.pjax.complete.multi_currencies').on('s123.pjax.complete.multi_currencies', function() {that.$menuIcon = $('[data-toggle="multiCurrenciesPopup"]');handleMenuIcon(that.$menuIcon,false);that.priceOnlyType.backup();$(document).trigger('pageLoaded.multi_currencies');});$(document).off('multi_currencies_price_update').on('multi_currencies_price_update', function( event, settings ) {$.each(settings, function( index, setting ) {if ( !isDefaultCurrency() ) {updatePrice(setting.el,setting.newPrice,true);} else {setting.el.find('[data-rel="multiCurrency"]').css({visibility: 'visible'});}});});$(document).trigger('pageLoaded.multi_currencies');modulesExtraActions();$(document).off('multi_currency_update').on('multi_currency_update', function() {buildPopup_CloseAction('popupFloatDivMenu');});});};that.setActiveCurrency = function( currency ) {that.activeCurrency = that.currencies[currency];if ( !that.activeCurrency ) {that.activeCurrency = that.defaultCurrency;} $.cookie($(websiteID).val()+'-'+that.nameSpace,JSON.stringify(that.activeCurrency),{ expires: 365, path: '/' });};that.reset = function( ) {if ( !that.isActive ) return;if ( getOrderScreen() > 1 ) return;if ( window.czIsLoggedIn ) return;$('[data-rel="multiCurrency"]').each(function( index, el ) {var originalPrice = $(this).find('[data-type="price"]').data(that.nameSpace + '-price');var $price = $(showPrice(that.defaultCurrency.data,originalPrice));$(this).replaceWith($price);$price.css({visibility: 'visible'});backUpPrice($price.find('[data-type="price"]'),$price.find('[data-type="price"]').html(),false);});$('[data-multi-currency-symbol-only="true"]').html(that.defaultCurrency.data.symbol);that.priceOnlyType.update();that.isChangedCurrency = false;};that.geConvertedPrice = function( price ) {if ( !that.isActive ) return price;if ( !$.isNumeric(price) ) return price;if ( isDefaultCurrency() ) return price;if ( getOrderScreen() > 1 ) return price;var result = parseFloat(price) * parseFloat(that.activeCurrency.rate);return result > 0 ? result.toFixed(2) : result;};that.getMobileIconHtml = function() {var $clone = that.$menuIcon.clone();$clone.attr('data-is-mobile',true);return $clone.prop('outerHTML');};function handleMenuIcon( $menuIcon, isMobileMenu ) {setMenuIconCurrency($menuIcon);var html = '';var maxHeight = 160;html += '
';html += '
';html += '';$.each(that.currencies, function( currencyCode, currency ) {html += '';});html += '
';html += '
';$html = $(html);setActiveCurrencyListItem($html);$html.find('.currency-list').on('click.multi_currencies', 'a', function( event ) {event.preventDefault();if ( !isDefaultCurrency() ) {that.isChangedCurrency = true;} else {that.isChangedCurrency = false;} that.setActiveCurrency($(this).parent().data('value'));$(document).trigger('pageLoaded.multi_currencies');modulesExtraActions();setMenuIconCurrency($menuIcon);$menuIcon.popover('hide');setActiveCurrencyListItem($html);$(document).trigger('multi_currency_update',[that.activeCurrency]);});S123.popOver.init({$el: $menuIcon,elSelector: '.multi-currencies-controller',namespace: 'multi_currency_menu_icon',oneTimeUsage: false,popOverSettings: {selector: 'multi-currency',content: $html,html: true,trigger: 'manual',template: '',placementCallBack: function() {if ( isMobileMenu ) return 'top';if ( getWebsiteMenuPosition() === 'top' || getWebsiteMenuPosition() === 'bottom' ) {if ( ($('nav#mainNav').offset().top - $(window).scrollTop()) > maxHeight ) {return 'top';} else {return 'bottom';}} else {if ( $('html').attr('dir') === 'rtl' ) {return 'left';} else {return 'right';}}}}});$(document).on('s123_pop_over_wrapper.show.multi_currency_menu_icon', function() {$menuIcon.addClass('active');}) .on('s123_pop_over_wrapper.hide.multi_currency_menu_icon', function() {$menuIcon.removeClass('active');});$menuIcon.off('click.multi_currencies').on('click.multi_currencies', function() {if ( $(this).hasClass('active') ) {$(this).popover('hide');} else {$(this).popover('show');}});} function setActiveCurrencyListItem( $currencyList ) {$currencyList.find('.currency-list-item').removeClass('active');$currencyList.find('.currency-list-item[data-value="'+that.activeCurrency.currency+'"]').addClass('active');} function setMenuIconCurrency( $menuIcon ) {var html = '';if ( $menuIcon.data('is-mobile') ) {html += '' + that.activeCurrency.currency + '';} else {html += '' + that.activeCurrency.currency + '';html += '' + that.activeCurrency.data.symbol + '';if ( getWebsiteMenuPosition() === 'top' || getWebsiteMenuPosition() === 'bottom' ) {html += S123.s123IconToSvg.getHtml('caret-down','mc-icon','');} else {if ( $('html').attr('dir') === 'rtl' ) {html += S123.s123IconToSvg.getHtml('caret-left','mc-icon','');} else {html += S123.s123IconToSvg.getHtml('caret-right','mc-icon','');}}} $menuIcon.html(html);} function updateAllPrices() {if ( isDefaultCurrency() && that.isChangedCurrency ) {that.reset();} else if ( isDefaultCurrency() && !that.isChangedCurrency ) {$('[data-rel="multiCurrency"]').css({visibility: 'visible'});} else {$('[data-rel="multiCurrency"]').each(function( index, el ) {updatePrice($(this),$(this).find('[data-type="price"]').html(),false);});} $('[data-multi-currency-symbol-only="true"]').html(that.activeCurrency.data.symbol);that.priceOnlyType.update();} function updatePrice( $el, newPrice, force ) {backUpPrice($el.find('[data-type="price"]'),newPrice,force);if ( isReplaceDisabled() ) {$el.css({visibility: 'visible'});} else {var $price = $el.find('[data-type="price"]');var priceAsString = $price.data(that.nameSpace + '-price');var price = parseFloat(priceAsString);var $newEl = $(showPrice(that.activeCurrency.data,(price * parseFloat(that.activeCurrency.rate)).toFixed(2)));backUpPrice($newEl.find('[data-type="price"]'),priceAsString,false);$price.parent().replaceWith($newEl);$newEl.css({visibility: 'visible'});}} function backUpPrice( $el, newPrice, force ) {if ( !that.isActive ) return;if ( !$el.data(that.nameSpace + '-price') || force ) {$el.data(that.nameSpace + '-price',newPrice);}} function modulesExtraActions() {$(document).off('donate_price_update.multi_currencies').on('donate_price_update.multi_currencies', function( event, $el ) {if ( isDefaultCurrency() ) return;var price = $el.val();price = parseFloat(price) * parseFloat(that.activeCurrency.rate);$el.val(price.toFixed(2));});} function isDefaultCurrency() {return that.defaultCurrency.currency === that.activeCurrency.currency;} function isReplaceDisabled() {if ( getOrderScreen() > 1 ) {return true;} else if ( window.czIsLoggedIn ) {return true;} else {return false;} return false;} function getOrderScreen() {var path = window.location.pathname.split("/");var orderScreen = path[path.length - 2];if ( orderScreen == '-order1' ) return 1;if ( orderScreen == '-order2' ) return 2;if ( orderScreen == '-order3' ) return 3;return 0;} that.priceOnlyType = {backup: function() {$('[data-multi-currency-price-only="true"]').each(function( index, el ) {if ( $.isNumeric($(this).data(that.nameSpace + '-price')) ) return;$(this).data(that.nameSpace + '-price',$(this).html());});},update: function() {$('[data-multi-currency-price-only="true"]').each(function( index, el ) {var originalPrice = $(this).data(that.nameSpace + '-price');var newPrice = parseFloat(originalPrice) * parseFloat(that.activeCurrency.rate);if ( newPrice % 1 === 0 ) {$(this).html(newPrice);} else {$(this).html(newPrice.toFixed(2));}});}};return that;}();var ActiveOrderPopup = function() {AO = {};AO.init = function() {$( document ).on( 's123.page.ready.activeOrderPopup', function( event ) {AO.initializeAddToCart();AO.productCallToAction.init();AO.initializeShowCart();});};AO.initializeAddToCart = function() {$('.orderButtonPopup').off('click').on('click', function( event ) {var $this = $(this);if ( $this.hasClass('a-o-out-of-stock') ) {bootbox.dialog({title: translations.activeOrderPopup.messageTitle,message: translations.activeOrderPopup.messageBody,buttons: {cancel: {label: translations.Ok,className: 'btn btn-primary'}}});return;} if ( $this.data('disable-atc-validator') != '1' ) {if ( !AO.atcValidator() ) return;} $this.attr('disabled','');S123.ButtonLoading.start($this);var multiProducts = $this.data('multi-products') ? $this.data('multi-products') : JSON.stringify([$this.data('unique-page')]);var formData = new FormData();formData.append('w',$('#w').val());formData.append('websiteID',$('#websiteID').val());formData.append('moduleID',$this.data('module'));if ( $this.data('product-page') ) {if ( $('#productOptions').prop('type') == 'textarea' ) {formData.append('productOptions',$('#productOptions').length !== 0 ? $('#productOptions').html() : '');} else {formData.append('productOptions',$('#productOptions').length !== 0 ? $('#productOptions').val() : '');} formData.append('customText',$('#customText').length !== 0 ? $('#customText').html() : '');} formData.append('amount',$this.data('quantity-amount') ? $this.data('quantity-amount') : '1');formData.append('multiProducts',multiProducts);$('input[type="file"]').each(function( index, upload ) {if ( upload.files.length > 0 ) {formData.append(upload.id,upload.files[0]);}});if ( $('.product-subscription-pricing').length !== 0 ) {let checkedPricing = $('.product-subscription-pricing').find('input[type="radio"]:checked');if ( checkedPricing.length == 0 ) {$('.product-subscription-error').remove();$('.product-subscription-title').append(`
${translations.productSubscriptionError}
`);S123.ButtonLoading.stop($this);$this.removeAttr('disabled');return;} formData.append('subscriptionTicketID',checkedPricing.val());formData.append('activeProductSubscription',true);} $.ajax({type: "POST",url: "/versions/"+$('#versionNUM').val()+"/wizard/orders/front/addToCart.php",data: formData,cache: false,contentType: false,processData: false,success: function( response ) {response = tryParseJSON(response);showCart_GetContent('/versions/'+$('#versionNUM').val()+'/wizard/orders/front/showCart.php?w='+$('#w').val()+'&websiteID='+$('#websiteID').val()+'&tranW='+websiteLanguageCountryFullCode+'&moduleID='+$this.data('module'),true);CartCounter.updateCartIcon();S123.ButtonLoading.stop($this);$this.removeAttr('disabled');topWindow.eCommerce_cart_lastAdded = response.updatedCartIds ? response.updatedCartIds : false;}});});};AO.initializeShowCart = function() {$('.orderOpenCart').off('click').on('click',function( event ) {AO.showCart();});};AO.showCart = function() {showCart_GetContent('/versions/'+$('#versionNUM').val()+'/wizard/orders/front/showCart.php?w='+$('#w').val()+'&websiteID='+$('#websiteID').val()+'&moduleTypeNUM=37&tranW='+websiteLanguageCountryFullCode+'&cartButton=1',true);};AO.atcValidator = function() {var $ct = $("#product-custom-text");var $po = $('.product-options');if ( $ct.length !== 0 && $ct.data('mandatory') ) {var $ct_fieldTitle = $('#ct_fieldTitle');if ( $ct_fieldTitle.val().length === 0 ) {$ct_fieldTitle.popover({container: 'body',content: translations.productvalidatorPopover,trigger: 'manual',template: '',placement: function(popover, input) {return isMobileDevice.any() ? 'auto' : ($('html').attr('dir') === 'rtl' ? 'left' : 'right');}});$ct_fieldTitle.popover('show').one('input', function(e) {$(this).popover('hide');});$ct_fieldTitle.focus();return false;}} if ( $po.length !== 0 ) {var $options = $po.find('.p-o-container[data-mandatory="1"]');var addToCart = true;var $popoverContainer;var $firstErrorOption;var $errorsOptionsList = [];$.each($options, function( index, option ) {var $option = $(option);var addErrorMsg = false;switch( $option.data('type') ) {case 'color':case 'radio':case 'checkbox':case 'size':case 'list':if ( $option.find('[id*=poi].selected').length === 0 ) {addToCart = false;addErrorMsg = true;} $popoverContainer = $(option);break;default:if ( $option.find('.fake-input').length > 0 ) {var id = $option.find('.fake-input').data('related-id');if ( $option.find('[data-id="'+id+'"]').val().length === 0 ) {addToCart = false;addErrorMsg = true;$popoverContainer = $(option).parent();}} else {if ( $option.find('.form-control').val().length === 0 ) {addToCart = false;addErrorMsg = true;$popoverContainer = $(option).parent();}}} if ( addErrorMsg ) {$errorsOptionsList.push($option);var $popover = $option.find('.p-o-popover-box');if ( $popover.length === 0 ) $popover = $option;$popover.popover({container: 'body',content: translations.productvalidatorPopover,trigger: 'manual',template: '',placement: function(popover, input) {return isMobileDevice.any() ? 'auto' : ($('html').attr('dir') === 'rtl' ? 'right' : 'left');}});}});if ( $errorsOptionsList.length !== 0 ) {var offset = $('#mainNav').outerHeight();if ( !$.isNumeric(offset) ) offset = 0;if ( !elementInViewport($errorsOptionsList[0].get(0)) ) {$('html, body').scrollTop($errorsOptionsList[0].offset().top - offset);} $.each($errorsOptionsList, function( index, $option ) {var $popover = $option.find('.p-o-popover-box');if ( $popover.length === 0 ) $popover = $option;$popover.popover('show');});$po.off('po.update').on('po.update', function( event ) {$('.product-validator-popover').popover('hide');});} return addToCart;} return true;};AO.productCallToAction = function() {var _ = {};_.init = function( settings ) {_.$controllers = $('.orderButtonPopup[data-p-c-t-a]');if ( _.$controllers.length == 0 ) return;_.$controllers.each(function() {var $this = $(this);var callToAction = $this.data('p-c-t-a');if ( callToAction.type == 'externalLink' && callToAction.externalLink.length > 0 ) {$this.off('click').on('click', function( event ) {window.open(callToAction.externalLink,'_blank');});} else if ( callToAction.type == 'contactUs' ) {$this.off('click').on('click', function( event ) {buildPopup('popupFloatDivSearch','',generateContactForm(callToAction),'',true,true,true,'right','') S123.globalContactEmail.submitHandler();fillDescription(callToAction);});}});};function generateContactForm( callToAction ) {var html = '';html += '
';html += '
';html += '

'+translations.productCallToAction.title+'

';html += '

'+translations.productCallToAction.infoBox+'

';html += '
';html += '
';html += '
';html += '
';html += '
';html += '';html += '';html += '
';html += '
';html += '
';html += '
';html += '';html += '';html += '
';html += '
';html += '
';html += '
';html += '';html += '';html += '
';html += '
';html += '
';html += '
';html += '
';html += '';html += '';html += '';html += '';html += '';html += '';html += '
';html += '
';html += '
';html +='
';html += '
';html += '
';html += '';html += '
';html += '
';html += '
';html += '
';html += '';html += '
';html += '
';html += '
';html += '
';return html;} function fillDescription( callToAction ) {var pageURL = window.location.protocol+'//'+domain+callToAction.pageURL; var html = '';html += '
';html += ''+translations.productCallToAction.productName+' ';html += ''+callToAction.title+'';$('#popupFloatDivSearch [name="emailForm_description"]').val(html);} return _;}();return AO;}();var WishList = function() {var WL = {};WL.init = function( settings ) {$( document ).on( 's123.page.ready.wish_list', function( event ) {WL.websiteID = $('#websiteID').val();WL.$menuButton = $('.wishListActionButton');if ( WL.$menuButton.length === 0 ) return;WL.eventRecurring();WL.initilizeMenuButton();WL.initializeLayoutButtons();WL.initializeDataPageButtons();});};WL.markUnMarkIcons = function() {var $container = $('.s123-module-eCommerce');var $items = $container.find('.product-data-obj');var $icons = $items.find('.wish-list-btn');WL.items = tryParseJSON($.cookie(WL.websiteID+'-wishList'));if ( !WL.items || $container.length === 0 ) return;$icons.removeClass('wl-active');$.each(WL.items, function( index, item ) {$items.filter('.product-data-obj[data-unique-id="'+item.uniqueID+'"]').find('.wish-list-btn').addClass('wl-active');});if ( $container.hasClass('s123-page-data-eCommerce') ) {WL.setToolTip($container);}};WL.setToolTip = function( $container ) {var $wishListBtn = $container.find('.wish-list-btn');$wishListBtn.attr('data-original-title',$wishListBtn.data('add-tooltip'));$wishListBtn.filter('.wl-active').attr('data-original-title',$wishListBtn.data('remove-tooltip'));$wishListBtn.tooltip({container: 'body',placement: 'auto'});};WL.eventRecurring = function() {WL.markUnMarkIcons();WL.updateCounterIcon();};WL.refresh = function() {WL.eventRecurring();};WL.initilizeMenuButton = function() {if ( WL.$menuButton.length === 0 ) return;WL.$menuButton.off('click').on('click',function( event ) {var $this = $(this);showCart_GetContent('/versions/'+$('#versionNUM').val()+'/wizard/orders/front/showCart.php?w='+$('#w').val()+'&websiteID='+$('#websiteID').val()+'&moduleTypeNUM=112&tranW='+websiteLanguageCountryFullCode+'&cartButton=1&wishList=true',true);});};WL.initializeLayoutButtons = function() {var $container = $('.s123-module-eCommerce:not(.s123-page-data-eCommerce)');if ( $container.length === 0 ) return;$container.find('.wish-list-btn').off('click.wishList').on('click.wishList',function( event ) {event.stopPropagation();var $this = $(this);var $wishListItem = $this.closest('.product-data-obj');if ( $this.hasClass('disabled') ) return false;if ( $this.hasClass('wl-active') ) {WL.removeItem($this,$wishListItem.data('module'),$wishListItem.data('module-type-num'),$wishListItem.data('unique-id'));} else {WL.addItem($this,$wishListItem.data('module'),$wishListItem.data('unique-id'));}});};WL.initializeDataPageButtons = function() {var $container = $('.s123-module-eCommerce.s123-page-data-eCommerce');if ( $container.length === 0 ) return;$container.find('.wish-list-btn').off('click.wishList').on('click.wishList', function( event ) {var $this = $(this);var $wishListItem = $this.closest('.product-data-obj');if ( $this.hasClass('disabled') ) return false;if ( $this.hasClass('wl-active') ) {WL.removeItem($this,$wishListItem.data('module'),$wishListItem.data('module-type-num'),$wishListItem.data('unique-id'));} else {WL.addItem($this,$wishListItem.data('module'),$wishListItem.data('unique-id'));}});};WL.addItem = function( $item , moduleID, uniqueID ) {$item.addClass('disabled');$.ajax({type: "POST",url: "/versions/"+$('#versionNUM').val()+"/wizard/orders/front/addToCart.php",data: {w: $('#w').val(),websiteID: WL.websiteID,moduleID: moduleID,wishList: true,multiProducts: JSON.stringify(Array(uniqueID)),},success: function( response ) {response = tryParseJSON(response);showCart_GetContent('/versions/'+$('#versionNUM').val()+'/wizard/orders/front/showCart.php?w='+$('#w').val()+'&websiteID='+$('#websiteID').val()+'&tranW='+websiteLanguageCountryFullCode+'&moduleID='+moduleID+'&wishList=true',true);WishList.eventRecurring();$item.removeClass('disabled');topWindow.eCommerce_cart_lastAdded = response.updatedCartIds ? response.updatedCartIds : false;}});};WL.removeItem = function( $item, moduleID, moduleTypeNUM, uniqueID ) {$item.addClass('disabled');$.ajax({type: "POST",url: "/versions/"+$('#versionNUM').val()+"/wizard/orders/front/removeCartItem.php",data: {w: $('#w').val(),websiteID: WL.websiteID,moduleID: moduleID,id: WL.items[uniqueID].id,uniqueID: uniqueID,wishList: true,cartType: moduleTypeNUM,tranW: websiteLanguageCountryFullCode},success: function( response ) {var response = JSON.parse(response);if ( !response.success ) return;WishList.eventRecurring();$item.removeClass('disabled');topWindow.eCommerce_cart_lastAdded = response.updatedCartIds ? response.updatedCartIds : false;}});};WL.updateCounterIcon = function() {var $headerWishListWrapper = $('.header-wish-list');if ( $headerWishListWrapper.length === 0 ) return;var itemsNumber = WL.items ? Object.keys(WL.items).length : 0 ;if ( parseInt(itemsNumber) === 0 ) {if ( !$headerWishListWrapper.hasClass('show-static') ) {$headerWishListWrapper.hide();ResetMoreButton();} $headerWishListWrapper.find('.count').hide();} else {if ( !$headerWishListWrapper.hasClass('show-static') ) {$headerWishListWrapper.show();ResetMoreButton();} $headerWishListWrapper.find('.count').html(itemsNumber).css({ display: 'flex' });}};return WL;}();function showCart_GetContent( url, bsp ) {var window_object = S123.isWebsiteInSlidingWindow ? parent : window;var b_s_p = window_object.buildSmallPopup;$.ajax({type: "GET",url: url,success: function( response ) {if ( bsp ) {b_s_p('popupCart',translations.cart,response,'',true,false,true,'');} else {$('#popupCart .content').html(response);} showCart(window_object);}});} function showCart( current_window ) {var $cartOrderPage = current_window.$('#popupCart').find('.content');init();function init() {eventRecurring();if ( $.isArray(topWindow.eCommerce_cart_lastAdded) ) {$.each(topWindow.eCommerce_cart_lastAdded, function( index, cart_id ) {$cartOrderPage.find('[data-cart-id="'+cart_id+'"]').addClass('last-added-highlight');});topWindow.eCommerce_cart_lastAdded = false;}} function eventRecurring() {current_window.CartCounter.updateCartIcon();var aop_settings = tryParseJSON($cartOrderPage.find('#aopSettings').val());$cartOrderPage.height('auto');$cartOrderPage.find('.quickCart').height($cartOrderPage.height());$cartOrderPage.find('.empty-cart-btn').off('click').on('click','a.empty-cart', function() {$.ajax({type: "GET",url: $(this).data('href')+'&wishList='+aop_settings.wishList,success: function( data ) {$cartOrderPage.closest('#popupCart .content').html(data);eventRecurring();showCart_UpdateCartWasChanged();}});});$cartOrderPage.find('.change-cart').on('click', function() {$.ajax({type: "GET",url: $(this).data('href'),success: function( data ) {$cartOrderPage.closest('#popupCart .content').html(data);eventRecurring();}});});$cartOrderPage.find('.continue-shopping-btn, .closeIcon').click(function() {current_window.buildSmallPopup_CloseAction('popupCart');});$cartOrderPage.find('.edit-quantity').on('click',function() {var $this = $(this);$cartOrderPage.find('#quantity_box_'+$this.data('product-id')+'').toggle();});$cartOrderPage.find('.edit-quantity-minus').on('click',function() {var $this = $(this);var $box = $cartOrderPage.find('#quantity_box_'+$this.data('product-id')+'');$box.find('.quantity_field').val(parseInt($box.find('.quantity_field').val())-1).trigger('input');updateAutomaticCouponMsg();});$cartOrderPage.find('.edit-quantity-plus').on('click',function() {var $this = $(this);var $box = $cartOrderPage.find('#quantity_box_'+$this.data('product-id')+'');$box.find('.quantity_field').val(parseInt($box.find('.quantity_field').val())+1).trigger('input');updateAutomaticCouponMsg();});function updateAutomaticCouponMsg() {$.ajax({type: 'POST',url: '/versions/' + $('#versionNUM').val() + '/wizard/orders/front/getAutomaticCouponMsg.php',data: {w: $('#w').val(),websiteID: $(websiteID).val(),total: $('#cartTotalPrice span[data-type="price"]').html(),cartType: $('.cartBottom').data('cart-type'),couponApplyTo: 'cartOrder',},success: function( response ) {$('.cart-automatic-coupon-container').html('').append(response);showCart_FixCartContentHeight();}});} $cartOrderPage.find('.quantity_field').on('input', function() {var $input = $(this);if ( $input.val().length === 0 ) $input.val(1);if ( !$.isNumeric($input.val()) ) $input.val($input.val().replace(/[^0-9]/g,''));if ( $input.val() <= 0 ) $input.val(1);if ( parseInt($input.val()) > parseInt($input.data('inventory-limit')) ) {$input.val($input.data('inventory-limit'));showCart_QuantityPopover($cartOrderPage.find('[data-cart-id="'+$input.data('product-id')+'"]'),translations.productQuntityLimit.replace('{{units_limitation}}',$input.data('inventory-limit')));} else if ( parseInt($input.val()) > parseInt($input.data('maximum-purchase')) ) {$input.val($input.data('maximum-purchase'));showCart_QuantityPopover($cartOrderPage.find('[data-cart-id="'+$input.data('product-id')+'"]'),translations.productQuntityLimit.replace('{{units_limitation}}',$input.data('maximum-purchase')));} else if ( parseInt($input.val()) < parseInt($input.data('minimum-purchase')) ) {$input.val($input.data('minimum-purchase'));showCart_QuantityPopover($cartOrderPage.find('[data-cart-id="'+$input.data('product-id')+'"]'),translations.productQuntityLimitMin.replace('{{units_limitation}}',$input.data('minimum-purchase')));} showCart_UpdateQuantityTotalPrice();clearTimeout(window.quantityInputFinished);window.quantityInputFinished = setTimeout( function() {$cartOrderPage.find('#q_u_loading_'+$input.data('product-id')).show();$.ajax({type: 'POST',url: '/versions/' + aop_settings.versionNUM + '/wizard/orders/front/quantityUpdate.php',data: {w: aop_settings.w,websiteID: aop_settings.websiteID,tranW: aop_settings.tranW,moduleID: aop_settings.moduleID,cartType: aop_settings.cartType,id: $input.data('product-id'),newQuantity: $input.val()},success: function( response ) {var response = JSON.parse(response);if ( response.success ) {$cartOrderPage.find('#q_u_loading_'+$input.data('product-id')).hide();current_window.CartCounter.updateCartIcon();showCart_UpdateCartWasChanged();}}});},300);});$cartOrderPage.find('.remove-product-btn').off('click').on('click', function() {var $this = $(this);$this.parent().children().hide();$this.parent().append('
'+S123.s123IconToSvg.getHtml('spinner','fa-spin','')+'
');$.ajax({type: 'POST',url: '/versions/' + aop_settings.versionNUM + '/wizard/orders/front/removeCartItem.php',data: {id: $this.data('product-id'),uniqueID: $this.closest('.item').get(0).id,w: aop_settings.w,websiteID: aop_settings.websiteID,tranW: aop_settings.tranW,moduleID: aop_settings.moduleID,cartType: aop_settings.cartType,wishList: aop_settings.wishList},success: function( response ) {var response = tryParseJSON(response);if ( response.success ) {if ( $this.closest('.item').siblings().not('.mix-modules-products-buttons').length == 0 ) {$cartOrderPage.find('.cart-list-container').hide();$cartOrderPage.find('.empty-cart-container').show();} $this.closest('.item').fadeOut(300,function() {$this.closest('.item').remove();showCart_UpdateQuantityTotalPrice();if ( aop_settings.wishList ) {WishList.markUnMarkIcons();WishList.updateCounterIcon();} showCart_UpdateCartWasChanged();updateAutomaticCouponMsg();});} else {$cartOrderPage.find('.r-p-loading').remove();$this.show();showCart_UpdateQuantityTotalPrice();} current_window.CartCounter.updateCartIcon();},error: function(data) {$cartOrderPage.find('.r-p-loading').remove();$this.show();}});});$cartOrderPage.find('#couponWebsite').validate({errorElement: 'div',errorClass: 'help-block',focusInvalid: true,ignore: ":hidden",highlight: function (e) {$(e).closest('.form-group').removeClass('has-info').addClass('has-error');},success: function (e) {$(e).closest('.form-group').removeClass('has-error');$(e).remove();},errorPlacement: function (error, element) {if( element.is('input[type=checkbox]') || element.is('input[type=radio]') ) {var controls = element.closest('div[class*="col-"]');if( controls.find(':checkbox,:radio').length > 1 ) controls.append(error);else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0));} else if( element.is('.select2') ) {error.insertAfter(element.siblings('[class*="select2-container"]:eq(0)'));} else if( element.is('.chosen-select') ) {error.insertAfter(element.siblings('[class*="chosen-container"]:eq(0)'));} else {error.appendTo(element.closest('.form-group'));}},submitHandler: function( form ) {$(form).find('button:submit').prop('disabled', true);return true;}});if ( aop_settings.foodDeliveryCart ) {foodDeliveryEditProductEvent($cartOrderPage);} if ( isMobileDevice.any() ) {adaptCartHeightOnMobile(aop_settings.wishList);} if ( $('html.onlyContent123').length > 0 ) {window.parent.$(window.parent.document).trigger('pageLoaded');} else {$(document).trigger('pageLoaded');} if ( window.location.pathname == '/-order1/' ) {$(document).off('order1.reload').on('order1.reload', function(){if ( typeof window.isCartWasChanged != 'undefined' ) {delete window.isCartWasChanged;window.location.reload();}});} showCart_FixCartContentHeight();} function adaptCartHeightOnMobile( isWishList ) {var offset = isWishList ? '65px' : '280px';$(window).off('resize.touch_device_scrolling').on('resize.touch_device_scrolling',function() {$cartOrderPage.find('.cartList').attr('style','height: calc('+window.innerHeight+'px - '+offset+');');}) .trigger('resize.touch_device_scrolling');$cartOrderPage.find('.continue-shopping-btn, .closeIcon').click(function() {$(window).off('resize.touch_device_scrolling');});} function showCart_QuantityPopover( $input, message ) {$input.popover({container: $cartOrderPage,content: message,trigger: 'manual',template: '',placement: function(popover, input) {return isMobileDevice.any() ? 'auto' : 'bottom';}});$input.popover('show');clearTimeout($input.data('q-p-timeout'));$input.data('q-p-timeout',setTimeout(function(){$input.popover('destroy');},3000));} function showCart_UpdateQuantityTotalPrice() {var cartTotal = 0.00;$cartOrderPage.find('.quantity_field').each(function() {var $quantityInput = $(this);var $info = $quantityInput.closest('.cart-product-info');var $priceBox = $info.find('.cart-product-price');var $price = $info.find('.cart-product-price [data-type="price"]');var $quantityPrice = $info.find('.quantity-total-price');var $fullPrice = $info.find('.cart-product-full-price [data-type="price"]');var $quantityFullPrice = $info.find('.quantity-total-full-price');var total = (parseFloat($price.closest('[data-price]').data('price')) * parseInt($quantityInput.val()));var totalFullPrice = (parseFloat($fullPrice.closest('[data-price]').data('price')) * parseInt($quantityInput.val()));cartTotal += parseFloat(total);$quantityPrice.find('.main_price [data-type="price"]').html(total.toFixed(2));$quantityFullPrice.find('.main_price [data-type="price"]').html(totalFullPrice.toFixed(2));if (parseInt($quantityInput.val()) > 1) {$quantityPrice.show();$priceBox.hide();} else {$quantityPrice.hide();$priceBox.show();} $info.find('.cart-product-quantity .qty_count').html($quantityInput.val());$(document).trigger('multi_currencies_price_update',[[{el: $quantityPrice.find('.main_price'),newPrice: total.toFixed(2)}]]);});$cartOrderPage.find('#cartTotalPrice [data-type="price"]').html(cartTotal.toFixed(2));$(document).trigger('multi_currencies_price_update',[[{el: $cartOrderPage.find('#cartTotalPrice'),newPrice: cartTotal.toFixed(2)}]]);} function showCart_FixCartContentHeight() {var space = $cartOrderPage.find('.quickCart .header').outerHeight() + $cartOrderPage.find('.quickCart .cartBottom').outerHeight();$cartOrderPage.find('.quickCart .cartList').css('height','calc(100vh - '+space+'px)');} function showCart_UpdateCartWasChanged() {window.isCartWasChanged = window.location.pathname == '/-order1/';}}function PricingModuleCarouselInit( $section ) {let sectionID = $section.get(0).id.replace('section-','');let $sectionItemsContainer = $section.find('.pricing-m-container');let displayType = $sectionItemsContainer.data('list-type');let slidesToShow = findBootstrapEnvironment() == 'xs' ? 1 : 3;if ( $sectionItemsContainer.hasClass('slick-initialized') ) {$sectionItemsContainer.css('visibility','none');$sectionItemsContainer.slick('unslick');$sectionItemsContainer.parent().find('.custom-arrow-container').remove();} if ( $sectionItemsContainer.children().length <= slidesToShow ) {displayType = 'standard';} if ( displayType != 'carousel' ) {$sectionItemsContainer.css('visibility','visible');return;} let $prevArrow = $('');let $nextArrow = $('');$sectionItemsContainer.css({ display: 'flex' });$sectionItemsContainer.parent().prepend($prevArrow);$sectionItemsContainer.parent().append($nextArrow);$sectionItemsContainer.on('init', function(event) {$sectionItemsContainer.css('visibility','visible');});$sectionItemsContainer.slick({dots: false,infinite: true,vertical: false,verticalSwiping: false,slidesToShow: slidesToShow,slidesToScroll: 1,adaptiveHeight: true,swipeToSlide: true,rtl: $('html').attr('dir') === 'rtl' ? true : false,prevArrow: '.related-p-c-s-p[data-section-id="'+sectionID+'"]',nextArrow: '.related-p-c-s-n[data-section-id="'+sectionID+'"]'});$(window).off('resize.PricingModuleCarouselInit').on('resize.PricingModuleCarouselInit', function( event ) {clearTimeout(window.PricingModuleCarouselInit_Delay);window.PricingModuleCarouselInit_Delay = setTimeout( function() {PricingModuleCarouselInit($section);},50);});}jQuery(function($) {PricingModuleInitialize_Layout1();});function PricingModuleInitialize_Layout1() {$( document ).on( 's123.page.ready', function( event ) {var $section = $('.s123-module.s123-module-pricing-tables.layout-1');$section.each(function( index ) {var $sectionThis = $(this);var $orderPricingTableBtn = $sectionThis.find('.order-pricing-table-btn');var $prices = $sectionThis.find('.pricing-p');$(document).on('pageLoaded.multi_currencies', function() {pricingUpdateBigNumbers($prices);});pricingUpdateBigNumbers($prices);site123FixText.itemFixText($sectionThis.find('.pricing-price-text'),$sectionThis.find('.pricing-m-box'),5);$orderPricingTableBtn.off('click').on('click',function() {var $this = $(this);$('
' +'' +'' +'' +'' +'' +'' +'' +'
') .appendTo('body') .submit();});$(document).on('click.multi_currencies',function() {site123FixText.itemFixText($sectionThis.find('span[data-rel="multiCurrency"]'),$sectionThis.find('.price'),5);});function pricingUpdateBigNumbers($prices) {$prices.each(function(){var $this = $(this);var $price = $this.find('.pricing-m-price span:not(.pricing-m-price-value,.pricing-m-price-period)');if ( $this.get(0).offsetWidth - $price.get(0).offsetWidth < 199 ) {$prices.addClass('pricing-big-numbers');}});} PricingModuleCarouselInit($section);});});}jQuery(function($) {PricingModuleInitialize_Layout2();});function PricingModuleInitialize_Layout2() {$( document ).on( 's123.page.ready', function( event ) {var $section = $('.s123-module.s123-module-pricing-tables.layout-2');$section.each(function( index ) {var $sectionThis = $(this);var $orderPricingTableBtn = $sectionThis.find('.order-pricing-table-btn');site123FixText.itemFixText($sectionThis.find('span[data-rel="multiCurrency"]'),$sectionThis.find('.price'),5);$orderPricingTableBtn.off('click').on('click',function() {var $this = $(this);$('
' +'' +'' +'' +'' +'' +'' +'' +'
') .appendTo('body') .submit();});$(document).on('click.multi_currencies',function() {site123FixText.itemFixText($sectionThis.find('span[data-rel="multiCurrency"]'),$sectionThis.find('.price'),5);});PricingModuleCarouselInit($section);});});}jQuery(function($) {PricingModuleInitialize_Layout5();});function PricingModuleInitialize_Layout5() {$( document ).on( 's123.page.ready', function( event ) {var $section = $('.s123-module.s123-module-pricing-tables.layout-5, .s123-module.s123-module-pricing-tables.layout-6');$section.each(function( index ) {var $sectionThis = $(this);var $orderPricingTableBtn = $sectionThis.find('.order-pricing-table-btn');var $prices = $sectionThis.find('.pricing-p');$(document).on('pageLoaded.multi_currencies', function() {pricingUpdateBigNumbers($prices);});pricingUpdateBigNumbers($prices);if ( $sectionThis.hasClass('layout-6') ) {site123FixText.itemFixText($sectionThis.find('.pricing-price-text'),$sectionThis.find('.pricing-m-display'),5);} else {site123FixText.itemFixText($sectionThis.find('.pricing-price-text'),$sectionThis.find('.pricing-m-box'),5);} $orderPricingTableBtn.off('click').on('click',function() {var $this = $(this);$('
' +'' +'' +'' +'' +'' +'' +'' +'
') .appendTo('body') .submit();});$(document).on('click.multi_currencies',function() {site123FixText.itemFixText($sectionThis.find('span[data-rel="multiCurrency"]'),$sectionThis.find('.price'),5);});function pricingUpdateBigNumbers($prices) {$prices.each(function(){var $this = $(this);var $price = $this.find('.pricing-m-price span:not(.pricing-m-price-value,.pricing-m-price-period)');if ( $this.get(0).offsetWidth - $price.get(0).offsetWidth < 199 ) {$prices.addClass('pricing-big-numbers');}});} PricingModuleCarouselInit($section);});});}