%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 3.16.68.121
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64
User : www-root ( 1010)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/sale/install/components/bitrix/sale.order.ajax/templates/bootstrap_v4/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/sale/install/components/bitrix/sale.order.ajax/templates/bootstrap_v4/order_ajax.min.js
BX.namespace("BX.Sale.OrderAjaxComponent");(function(){"use strict";if(BX.Sale&&BX.Sale.Input&&BX.Sale.Input.Utils){BX.Sale.Input.Utils.asMultiple=function(e){if(e===undefined||e===null||e===""){return[]}else if(e.constructor===Array){var t=0,i=e.length,s;for(;t<i;){s=e[t];if(s===undefined||s===null||s===""){e.splice(t,1);--i}else{++t}}return e.length?e:[""]}else{return[e]}}}BX.Sale.OrderAjaxComponent={initializePrimaryFields:function(){this.BXFormPosting=false;this.regionBlockNotEmpty=false;this.locationsInitialized=false;this.locations={};this.cleanLocations={};this.locationsTemplate="";this.pickUpMapFocused=false;this.options={};this.activeSectionId="";this.firstLoad=true;this.initialized={};this.mapsReady=false;this.lastSelectedDelivery=0;this.deliveryLocationInfo={};this.deliveryPagination={};this.deliveryCachedInfo=[];this.paySystemPagination={};this.validation={};this.hasErrorSection={};this.pickUpPagination={};this.timeOut={};this.isMobile=BX.browser.IsMobile();this.isHttps=window.location.protocol==="https:";this.orderSaveAllowed=false;this.socServiceHiddenNode=false},init:function(e){this.initializePrimaryFields();this.result=e.result||{};this.prepareLocations(e.locations);this.params=e.params||{};this.signedParamsString=e.signedParamsString||"";this.siteId=e.siteID||"";this.ajaxUrl=e.ajaxUrl||"";this.templateFolder=e.templateFolder||"";this.defaultBasketItemLogo=this.templateFolder+"/images/product_logo.png";this.defaultStoreLogo=this.templateFolder+"/images/pickup_logo.png";this.defaultDeliveryLogo=this.templateFolder+"/images/delivery_logo.png";this.defaultPaySystemLogo=this.templateFolder+"/images/pay_system_logo.png";this.orderBlockNode=BX(e.orderBlockId);this.totalBlockNode=BX(e.totalBlockId);this.mobileTotalBlockNode=BX(e.totalBlockId+"-mobile");this.savedFilesBlockNode=BX("bx-soa-saved-files");this.orderSaveBlockNode=BX("bx-soa-orderSave");this.mainErrorsNode=BX("bx-soa-main-notifications");this.authBlockNode=BX(e.authBlockId);this.authHiddenBlockNode=BX(e.authBlockId+"-hidden");this.basketBlockNode=BX(e.basketBlockId);this.basketHiddenBlockNode=BX(e.basketBlockId+"-hidden");this.regionBlockNode=BX(e.regionBlockId);this.regionHiddenBlockNode=BX(e.regionBlockId+"-hidden");this.paySystemBlockNode=BX(e.paySystemBlockId);this.paySystemHiddenBlockNode=BX(e.paySystemBlockId+"-hidden");this.deliveryBlockNode=BX(e.deliveryBlockId);this.deliveryHiddenBlockNode=BX(e.deliveryBlockId+"-hidden");this.pickUpBlockNode=BX(e.pickUpBlockId);this.pickUpHiddenBlockNode=BX(e.pickUpBlockId+"-hidden");this.propsBlockNode=BX(e.propsBlockId);this.propsHiddenBlockNode=BX(e.propsBlockId+"-hidden");if(this.result.SHOW_AUTH){this.authBlockNode.style.display="";BX.addClass(this.authBlockNode,"bx-active");this.authGenerateUser=this.result.AUTH.new_user_registration_email_confirmation!=="Y"&&this.result.AUTH.new_user_phone_required!=="Y"}if(this.totalBlockNode){this.totalInfoBlockNode=this.totalBlockNode.querySelector(".bx-soa-cart-total");this.totalGhostBlockNode=this.totalBlockNode.querySelector(".bx-soa-cart-total-ghost")}this.options.deliveriesPerPage=parseInt(e.params.DELIVERIES_PER_PAGE);this.options.paySystemsPerPage=parseInt(e.params.PAY_SYSTEMS_PER_PAGE);this.options.pickUpsPerPage=parseInt(e.params.PICKUPS_PER_PAGE);this.options.showWarnings=!!e.showWarnings;this.options.propertyValidation=!!e.propertyValidation;this.options.priceDiffWithLastTime=false;this.options.pickUpMap=e.pickUpMap;this.options.propertyMap=e.propertyMap;this.options.totalPriceChanged=false;if(!this.result.IS_AUTHORIZED||typeof this.result.LAST_ORDER_DATA.FAIL!=="undefined")this.initFirstSection();this.initOptions();this.editOrder();this.bindEvents();this.orderBlockNode.removeAttribute("style");this.basketBlockScrollCheck();if(this.params.USE_ENHANCED_ECOMMERCE==="Y"){this.setAnalyticsDataLayer("checkout")}if(this.params.USER_CONSENT==="Y"){this.initUserConsent()}},sendRequest:function(e,t){var i;if(!this.startLoader())return;this.firstLoad=false;e=BX.type.isNotEmptyString(e)?e:"refreshOrderAjax";var s={action:e,actionData:t,cancel:false};BX.Event.EventEmitter.emit("BX.Sale.OrderAjaxComponent:onBeforeSendRequest",s);if(s.cancel){this.endLoader();return}if(e==="saveOrderAjax"){i=BX("bx-soa-order-form");if(i){i.querySelector("input[type=hidden][name=sessid]").value=BX.bitrix_sessid()}BX.ajax.submitAjax(BX("bx-soa-order-form"),{url:this.ajaxUrl,method:"POST",dataType:"json",data:{via_ajax:"Y",action:"saveOrderAjax",sessid:BX.bitrix_sessid(),SITE_ID:this.siteId,signedParamsString:this.signedParamsString},onsuccess:BX.proxy(this.saveOrderWithJson,this),onfailure:BX.proxy(this.handleNotRedirected,this)})}else{BX.ajax({method:"POST",dataType:"json",url:this.ajaxUrl,data:this.getData(s.action,s.actionData),onsuccess:BX.delegate(function(e){if(e.redirect&&e.redirect.length)document.location.href=e.redirect;this.saveFiles();switch(s.action){case"refreshOrderAjax":this.refreshOrder(e);break;case"confirmSmsCode":case"showAuthForm":this.firstLoad=true;this.refreshOrder(e);break;case"enterCoupon":if(e&&e.order){this.deliveryCachedInfo=[];this.refreshOrder(e)}else{this.addCoupon(e)}break;case"removeCoupon":if(e&&e.order){this.deliveryCachedInfo=[];this.refreshOrder(e)}else{this.removeCoupon(e)}break}BX.cleanNode(this.savedFilesBlockNode);this.endLoader()},this),onfailure:BX.delegate(function(){this.endLoader()},this)})}},getData:function(e,t){var i={order:this.getAllFormData(),sessid:BX.bitrix_sessid(),via_ajax:"Y",SITE_ID:this.siteId,signedParamsString:this.signedParamsString};i[this.params.ACTION_VARIABLE]=e;if(e==="enterCoupon"||e==="removeCoupon")i.coupon=t;return i},getAllFormData:function(){var e=BX("bx-soa-order-form"),t=BX.ajax.prepareForm(e),i;for(i in t.data){if(t.data.hasOwnProperty(i)&&i==""){delete t.data[i]}}return!!t&&t.data?t.data:{}},refreshOrder:function(e){if(e.error){this.showError(this.mainErrorsNode,e.error);this.animateScrollTo(this.mainErrorsNode,800,20)}else if(e.order.SHOW_AUTH){var t;if(e.order.OK_MESSAGE&&e.order.OK_MESSAGE.length||e.order.SMS_AUTH&&e.order.SMS_AUTH.TYPE==="OK"){t="bx-step-good"}else{t="bx-step-bad"}this.addAnimationEffect(this.authBlockNode,t);BX.merge(this.result,e.order);this.editAuthBlock();this.showAuthBlock();this.showErrors(e.order.ERROR,false);this.animateScrollTo(this.authBlockNode)}else{this.isPriceChanged(e);if(this.activeSectionId!==this.deliveryBlockNode.id)this.deliveryCachedInfo=[];this.result=e.order;this.prepareLocations(e.locations);this.locationsInitialized=false;this.maxWaitTimeExpired=false;this.pickUpMapFocused=false;this.deliveryLocationInfo={};this.initialized={};this.clearHiddenBlocks();this.initOptions();this.editOrder();this.mapsReady&&this.initMaps();BX.saleOrderAjax&&BX.saleOrderAjax.initDeferredControl()}return true},saveOrderWithJson:function(e){var t=false;if(e&&e.order){e=e.order;if(e.REDIRECT_URL){if(this.params.USE_ENHANCED_ECOMMERCE==="Y"){this.setAnalyticsDataLayer("purchase",e.ID)}(window.b24order=window.b24order||[]).push({id:e.ID,sum:this.result.TOTAL.ORDER_PRICE});t=true;location.href=e.REDIRECT_URL}else if(e.SHOW_AUTH){this.result.SHOW_AUTH=e.SHOW_AUTH;this.result.AUTH=e.AUTH;this.result.SMS_AUTH=e.SMS_AUTH;this.editAuthBlock();this.showAuthBlock();this.animateScrollTo(this.authBlockNode)}else{this.showErrors(e.ERROR,true,true)}}if(!t){this.handleNotRedirected()}},handleNotRedirected:function(){this.endLoader();this.disallowOrderSave()},startLoader:function(){if(this.BXFormPosting===true)return false;this.BXFormPosting=true;if(!this.loadingScreen){this.loadingScreen=new BX.PopupWindow("loading_screen",null,{overlay:{backgroundColor:"white",opacity:1},events:{onAfterPopupShow:BX.delegate(function(){BX.cleanNode(this.loadingScreen.popupContainer);BX.removeClass(this.loadingScreen.popupContainer,"popup-window");this.loadingScreen.popupContainer.appendChild(BX.create("IMG",{props:{src:this.templateFolder+"/images/loader.gif"}}));this.loadingScreen.popupContainer.removeAttribute("style");this.loadingScreen.popupContainer.style.display="block"},this)}});BX.addClass(this.loadingScreen.overlay.element,"bx-step-opacity")}this.loadingScreen.overlay.element.style.opacity="0";this.loadingScreen.show();this.loadingScreen.overlay.element.style.opacity="0.6";return true},endLoader:function(){this.BXFormPosting=false;if(this.loadingScreen&&this.loadingScreen.isShown()){this.loadingScreen.close()}},htmlspecialcharsEx:function(e){return e.replace(/&amp;/g,"&amp;amp;").replace(/&lt;/g,"&amp;lt;").replace(/&gt;/g,"&amp;gt;").replace(/&quot;/g,"&amp;quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")},saveFiles:function(){if(this.result.ORDER_PROP&&this.result.ORDER_PROP.properties){var e=this.result.ORDER_PROP.properties,t,i;for(t=0;t<e.length;t++){if(e[t].TYPE=="FILE"){i=this.orderBlockNode.querySelector('div[data-property-id-row="'+e[t].ID+'"]');if(i)this.savedFilesBlockNode.appendChild(i)}}}},animateScrollTo:function(e,t,i){if(!e)return;var s=BX.GetWindowScrollPos().scrollTop,a=BX.pos(this.orderBlockNode),r=BX.pos(e).top-(this.isMobile?50:0);if(i)r-=parseInt(i);if(r+window.innerHeight>a.bottom)r=a.bottom-window.innerHeight+17;new BX.easing({duration:t||800,start:{scroll:s},finish:{scroll:r},transition:BX.easing.makeEaseOut(BX.easing.transitions.quad),step:BX.delegate(function(e){window.scrollTo(0,e.scroll)},this)}).animate()},checkKeyPress:function(e){if(e.keyCode==13){var t=e.target||e.srcElement,i=t.getAttribute("data-send"),s,a;if(!i){s=t.getAttribute("data-next");if(s){a=this.orderBlockNode.querySelector("input[name="+s+"]");a&&a.focus()}return BX.PreventDefault(e)}}},getSizeString:function(e,t){var i=1024*1024*1024,s=1024*1024,a=1024,r;e=parseInt(e);t=parseInt(t);if(e>i)r=parseFloat(e/i).toFixed(t)+" Gb";else if(e>s)r=parseFloat(e/s).toFixed(t)+" Mb";else if(e>a)r=parseFloat(e/a).toFixed(t)+" Kb";else r=e+" B";return r},getFileAccepts:function(e){var t=[],i=e.split(","),s,a;var r={json:"application/json",javascript:"application/javascript","octet-stream":"application/octet-stream",ogg:"application/ogg",pdf:"application/pdf",zip:"application/zip",gzip:"application/gzip",aac:"audio/aac",mp3:"audio/mpeg",gif:"image/gif",jpeg:"image/jpeg",png:"image/png",svg:"image/svg+xml",tiff:"image/tiff",css:"text/css",csv:"text/csv",html:"text/html",plain:"text/plain",php:"text/php",xml:"text/xml",mpeg:"video/mpeg",mp4:"video/mp4",quicktime:"video/quicktime",flv:"video/x-flv",doc:"application/msword",docx:"application/msword",xls:"application/vnd.ms-excel",xlsx:"application/vnd.ms-excel"};for(s=0;s<i.length;s++){a=BX.util.trim(i[s]);a=r[a]||a;t.push(a)}return t.join(",")},uniqueText:function(e,t){var i,s,a=[];e=e||"";t=t||"<br>";i=e.split(t);i=BX.util.array_unique(i);for(s=0;s<i.length;s++){if(i[s]=="")continue;a.push(BX.util.trim(i[s]))}return a.join(t)},getImageSources:function(e,t){if(!e||!t||!e[t])return false;return{src_1x:e[t+"_SRC"],src_2x:e[t+"_SRC_2X"],src_orig:e[t+"_SRC_ORIGINAL"]}},getErrorContainer:function(e){if(!e)return;e.appendChild(BX.create("DIV",{props:{className:"alert alert-danger"},style:{display:"none"}}))},showError:function(e,t,i){if(BX.type.isArray(t))t=t.join("<br>");var s=e.querySelector(".alert.alert-danger"),a;if(s&&t.length){BX.cleanNode(s);s.appendChild(BX.create("DIV",{html:t}));a=!this.hasErrorSection[e.id];if(a){s.style.opacity=0;s.style.display="";new BX.easing({duration:300,start:{opacity:0},finish:{opacity:100},transition:BX.easing.makeEaseOut(BX.easing.transitions.quad),step:function(e){s.style.opacity=e.opacity/100},complete:function(){s.removeAttribute("style")}}).animate()}else s.style.display="";if(!!i)BX.addClass(e,"bx-step-error")}},showErrors:function(e,t,i){var s=this.orderBlockNode.querySelectorAll("div.alert.alert-danger"),a,r,o;for(r=0;r<s.length;r++){a=BX.findParent(s[r],{className:"bx-soa-section"});BX.removeClass(a,"bx-step-error");s[r].style.display="none";BX.cleanNode(s[r])}if(!e||BX.util.object_keys(e).length<1)return;for(r in e){if(!e.hasOwnProperty(r))continue;o=e[r];switch(r.toUpperCase()){case"MAIN":this.showError(this.mainErrorsNode,o);this.animateScrollTo(this.mainErrorsNode,800,20);t=false;break;case"AUTH":if(this.authBlockNode.style.display=="none"){this.showError(this.mainErrorsNode,o,true);this.animateScrollTo(this.mainErrorsNode,800,20);t=false}else this.showError(this.authBlockNode,o,true);break;case"REGION":if(i||this.regionBlockNode.getAttribute("data-visited")==="true"){this.showError(this.regionBlockNode,o,true);this.showError(this.regionHiddenBlockNode,o)}break;case"DELIVERY":if(i||this.deliveryBlockNode.getAttribute("data-visited")==="true"){this.showError(this.deliveryBlockNode,o,true);this.showError(this.deliveryHiddenBlockNode,o)}break;case"PAY_SYSTEM":if(i||this.paySystemBlockNode.getAttribute("data-visited")==="true"){this.showError(this.paySystemBlockNode,o,true);this.showError(this.paySystemHiddenBlockNode,o)}break;case"PROPERTY":if(i||this.propsBlockNode.getAttribute("data-visited")==="true"){this.showError(this.propsBlockNode,o,true);this.showError(this.propsHiddenBlockNode,o)}break}}!!t&&this.scrollToError()},showBlockErrors:function(e){var t=e.querySelector("div.alert.alert-danger"),i,s;if(!t)return;BX.removeClass(e,"bx-step-error");t.style.display="none";BX.cleanNode(t);switch(e.id){case this.regionBlockNode.id:i=this.regionHiddenBlockNode;s=this.result.ERROR.REGION;break;case this.deliveryBlockNode.id:i=this.deliveryHiddenBlockNode;s=this.result.ERROR.DELIVERY;break;case this.paySystemBlockNode.id:i=this.paySystemHiddenBlockNode;s=this.result.ERROR.PAY_SYSTEM;break;case this.propsBlockNode.id:i=this.propsHiddenBlockNode;s=this.result.ERROR.PROPERTY;break}if(s&&BX.util.object_keys(s).length){this.showError(e,s,true);this.showError(i,s)}},checkNotifications:function(){var e=this.mainErrorsNode.querySelector('[data-type="informer"]'),t,i,s,a,r,o;if(e){if(this.firstLoad&&this.result.IS_AUTHORIZED&&typeof this.result.LAST_ORDER_DATA.FAIL==="undefined"){i=this.orderBlockNode.querySelectorAll(".bx-soa-section.bx-active");t=i.length&&i[i.length-1].getAttribute("data-visited")=="true";s=t?"success":"warning";a=(t?this.params.MESS_SUCCESS_PRELOAD_TEXT:this.params.MESS_FAIL_PRELOAD_TEXT).split("#ORDER_BUTTON#").join(this.params.MESS_ORDER);e.appendChild(BX.create("DIV",{style:{paddingLeft:"48px"},children:[BX.create("DIV",{props:{className:"icon-"+s}}),BX.create("p",{props:{className:"pb-0 mb-0"},html:a})]}));BX.addClass(e,"alert alert-"+s);e.style.display=""}else if(BX.hasClass(e,"alert")){r=BX.GetWindowScrollPos().scrollTop;o=BX.pos(e);new BX.easing({duration:300,start:{opacity:100},finish:{opacity:0},transition:BX.easing.transitions.linear,step:function(t){e.style.opacity=t.opacity/100},complete:function(){if(r>o.top)window.scrollBy(0,-(o.height+20));e.style.display="none";BX.cleanNode(e);e.removeAttribute("class");e.removeAttribute("style")}}).animate()}}},checkPreload:function(e){var t;switch(e.id){case this.regionBlockNode.id:t=this.result.LAST_ORDER_DATA&&this.result.LAST_ORDER_DATA.PERSON_TYPE;break;case this.paySystemBlockNode.id:t=this.result.LAST_ORDER_DATA&&this.result.LAST_ORDER_DATA.PAY_SYSTEM;break;case this.deliveryBlockNode.id:t=this.result.LAST_ORDER_DATA&&this.result.LAST_ORDER_DATA.DELIVERY;break;case this.pickUpBlockNode.id:t=this.result.LAST_ORDER_DATA&&this.result.LAST_ORDER_DATA.PICK_UP;break;default:t=true}return t},checkBlockErrors:function(e){var t,i,s,a,r,o;if(t=BX(e.id+"-hidden")){i=t.querySelector("div.alert.alert-danger");s=i&&i.style.display!="none";a=t.querySelector("div.alert.alert-warning.alert-show");if(!s){r=t.querySelectorAll("div.tooltip");for(o=0;o<r.length;o++){if(r[o].getAttribute("data-state")=="opened"){s=true;break}}}}if(s)BX.addClass(e,"bx-step-error");else if(a)BX.addClass(e,"bx-step-warning");else BX.removeClass(e,"bx-step-error bx-step-warning");return!s},scrollToError:function(){var e=this.orderBlockNode.querySelectorAll("div.bx-soa-section.bx-active"),t,i;for(t in e){if(e.hasOwnProperty(t)){i=e[t].querySelector(".alert.alert-danger");if(i&&i.style.display!="none"){this.animateScrollTo(e[t]);break}}}},showWarnings:function(){var e=this.orderBlockNode.querySelectorAll("div.bx-soa-section.bx-active"),t=this.getSelectedDelivery(),i,s;for(i=0;i<e.length;i++){BX.removeClass(e[i],"bx-step-warning");if(e[i].getAttribute("data-visited")=="false")BX.removeClass(e[i],"bx-step-completed")}if(t&&t.CALCULATE_ERRORS){BX.addClass(this.deliveryBlockNode,"bx-step-warning");s="<strong>"+this.params.MESS_DELIVERY_CALC_ERROR_TITLE+"</strong>";if(this.params.MESS_DELIVERY_CALC_ERROR_TEXT.length)s+="<br><small>"+this.params.MESS_DELIVERY_CALC_ERROR_TEXT+"</small>";this.showBlockWarning(this.deliveryBlockNode,s);this.showBlockWarning(this.deliveryHiddenBlockNode,s);if(this.activeSectionId!=this.deliveryBlockNode.id){BX.addClass(this.deliveryBlockNode,"bx-step-completed");BX.bind(this.deliveryBlockNode.querySelector(".alert.alert-warning"),"click",BX.proxy(this.showByClick,this))}}else if(BX.hasClass(this.deliveryBlockNode,"bx-step-warning")&&this.activeSectionId!=this.deliveryBlockNode.id){BX.removeClass(this.deliveryBlockNode,"bx-step-warning")}if(!this.result.WARNING||!this.options.showWarnings)return;for(i in this.result.WARNING){if(this.result.WARNING.hasOwnProperty(i)){switch(i.toUpperCase()){case"DELIVERY":if(this.deliveryBlockNode.getAttribute("data-visited")==="true"){this.showBlockWarning(this.deliveryBlockNode,this.result.WARNING[i],true);this.showBlockWarning(this.deliveryHiddenBlockNode,this.result.WARNING[i],true)}break;case"PAY_SYSTEM":if(this.paySystemBlockNode.getAttribute("data-visited")==="true"){this.showBlockWarning(this.paySystemBlockNode,this.result.WARNING[i],true);this.showBlockWarning(this.paySystemHiddenBlockNode,this.result.WARNING[i],true)}break}}}},notifyAboutWarnings:function(e){if(!BX.type.isDomNode(e))return;switch(e.id){case this.deliveryBlockNode.id:this.showBlockWarning(this.deliveryBlockNode,this.result.WARNING.DELIVERY,true);break;case this.paySystemBlockNode.id:this.showBlockWarning(this.paySystemBlockNode,this.result.WARNING.PAY_SYSTEM,true);break}},showBlockWarning:function(e,t,i){var s=e.querySelector(".alert.alert-danger"),a="",r,o,l;if(s){if(BX.type.isString(t)){a=t}else{for(r in t){if(t.hasOwnProperty(r)&&t[r]){a+=t[r]+"<br>"}}}if(!a){return}l=e.querySelectorAll(".alert.alert-warning");for(r in l){if(l.hasOwnProperty(r)&&BX.type.isDomNode(l[r])){if(l[r].innerHTML.indexOf(a)!==-1){return}}}o=BX.create("DIV",{props:{className:"alert alert-warning"+(!!i?" alert-hide":" alert-show")},html:a});BX.prepend(o,s.parentNode);BX.addClass(e,"bx-step-warning")}},showPagination:function(e,t){if(!t||!e)return;var i,s=[],a,r,o,l,n;switch(e){case"delivery":i=this.deliveryPagination;break;case"paySystem":i=this.paySystemPagination;break;case"pickUp":i=this.pickUpPagination;break}if(i.pages.length>1){s.push(BX.create("LI",{attrs:{"data-action":"prev","data-entity":e},props:{className:"bx-pag-prev"},html:i.pageNumber==1?"<span>"+this.params.MESS_NAV_BACK+"</span>":'<a href=""><span>'+this.params.MESS_NAV_BACK+"</span></a>",events:{click:BX.proxy(this.doPagination,this)}}));for(a=0;a<i.pages.length;a++){r=parseInt(a)+1;o=r==i.pageNumber?"bx-active":"";s.push(BX.create("LI",{attrs:{"data-action":r,"data-entity":e},props:{className:o},html:'<a href=""><span>'+r+"</span></a>",events:{click:BX.proxy(this.doPagination,this)}}))}s.push(BX.create("LI",{attrs:{"data-action":"next","data-entity":e},props:{className:"bx-pag-next"},html:i.pageNumber==i.pages.length?"<span>"+this.params.MESS_NAV_FORWARD+"</span>":'<a href=""><span>'+this.params.MESS_NAV_FORWARD+"</span></a>",events:{click:BX.proxy(this.doPagination,this)}}));l=this.params.TEMPLATE_THEME||"";n=BX.create("DIV",{props:{className:"bx-pagination"+(l?" bx-"+l:"")},children:[BX.create("DIV",{props:{className:"bx-pagination-container"},children:[BX.create("UL",{children:s})]})]});t.appendChild(BX.create("DIV",{style:{clear:"both"}}));t.appendChild(n)}},doPagination:function(e){var t=e.target||e.srcElement,i=t.tagName=="LI"?t:BX.findParent(t,{tagName:"LI"}),s=i.getAttribute("data-action"),a=i.getAttribute("data-entity"),r;if(BX.hasClass(i,"bx-active"))return BX.PreventDefault(e);if(s=="prev"||s=="next"){r=parseInt(BX.findParent(i).querySelector(".bx-active").getAttribute("data-action"));s=s=="next"?++r:--r}if(a=="delivery")this.showDeliveryItemsPage(s);else if(a=="paySystem")this.showPaySystemItemsPage(s);else if(a=="pickUp")this.showPickUpItemsPage(s);return BX.PreventDefault(e)},showDeliveryItemsPage:function(e){this.getCurrentPageItems("delivery",e);var t=this.getSelectedDelivery(),i,s,a,r;if(t&&t.ID){i=this.deliveryBlockNode.querySelector("input[type=hidden][name=DELIVERY_ID]");if(!i){i=BX.create("INPUT",{props:{type:"hidden",name:"DELIVERY_ID",value:t.ID}})}}s=this.deliveryBlockNode.querySelector(".bx-soa-pp-item-container");BX.cleanNode(s);if(BX.type.isDomNode(i))BX.prepend(i,BX.findParent(s));var o=BX.create("div",{props:{className:"row"}});for(a=0;a<this.deliveryPagination.currentPage.length;a++){r=this.createDeliveryItem(this.deliveryPagination.currentPage[a]);o.appendChild(r)}s.appendChild(o);this.showPagination("delivery",s)},showPaySystemItemsPage:function(e){this.getCurrentPageItems("paySystem",e);var t=this.getSelectedPaySystem(),i,s,a,r;if(t&&t.ID){i=this.paySystemBlockNode.querySelector("input[type=hidden][name=PAY_SYSTEM_ID]");if(!i){i=BX.create("INPUT",{props:{type:"hidden",name:"PAY_SYSTEM_ID",value:t.ID}})}}s=this.paySystemBlockNode.querySelector(".bx-soa-pp-item-container");BX.cleanNode(s);if(BX.type.isDomNode(i))BX.prepend(i,BX.findParent(s));var o=BX.create("div",{props:{className:"row"}});for(a=0;a<this.paySystemPagination.currentPage.length;a++){r=this.createPaySystemItem(this.paySystemPagination.currentPage[a]);o.appendChild(r)}s.appendChild(o);this.showPagination("paySystem",s)},showPickUpItemsPage:function(e){this.getCurrentPageItems("pickUp",e);this.editPickUpList(false)},getCurrentPageItems:function(e,t){if(!e||typeof t==="undefined")return;var i,s;switch(e){case"delivery":i=this.deliveryPagination;s=this.options.deliveriesPerPage;break;case"paySystem":i=this.paySystemPagination;s=this.options.paySystemsPerPage;break;case"pickUp":i=this.pickUpPagination;s=this.options.pickUpsPerPage;break}if(i&&s>0){if(t<=0||t>i.pages.length)return;i.pageNumber=t;i.currentPage=i.pages.slice(i.pageNumber-1,i.pageNumber)[0]}},initPropsListForLocation:function(){if(BX.saleOrderAjax&&this.result.ORDER_PROP&&this.result.ORDER_PROP.properties){var e,t,i,s;BX.saleOrderAjax.cleanUp();for(e=0;e<this.result.ORDER_PROP.properties.length;e++){i=this.result.ORDER_PROP.properties[e];if(i.TYPE=="LOCATION"&&i.MULTIPLE=="Y"&&i.IS_LOCATION!="Y"){for(t=0;t<this.locations[i.ID].length;t++){BX.saleOrderAjax.addPropertyDesc({id:i.ID+"_"+t,attributes:{id:i.ID+"_"+t,type:i.TYPE,valueSource:i.SOURCE=="DEFAULT"?"default":"form"}})}}else{s={id:i.ID,type:i.TYPE,valueSource:i.SOURCE=="DEFAULT"?"default":"form"};if(!this.deliveryLocationInfo.city&&parseInt(i.INPUT_FIELD_LOCATION)>0){s.altLocationPropId=parseInt(i.INPUT_FIELD_LOCATION);this.deliveryLocationInfo.city=i.INPUT_FIELD_LOCATION}if(!this.deliveryLocationInfo.loc&&i.IS_LOCATION=="Y")this.deliveryLocationInfo.loc=i.ID;if(!this.deliveryLocationInfo.zip&&i.IS_ZIP=="Y"){s.isZip=true;this.deliveryLocationInfo.zip=i.ID}BX.saleOrderAjax.addPropertyDesc({id:i.ID,attributes:s})}}}},bindEvents:function(){BX.bind(this.orderSaveBlockNode.querySelector("[data-save-button]"),"click",BX.proxy(this.clickOrderSaveAction,this));BX.bind(window,"scroll",BX.proxy(this.totalBlockScrollCheck,this));BX.bind(window,"resize",BX.throttle(function(){this.totalBlockResizeCheck();this.alignBasketColumns();this.basketBlockScrollCheck();this.mapsReady&&this.resizeMapContainers()},50,this));BX.addCustomEvent("onDeliveryExtraServiceValueChange",BX.proxy(this.sendRequest,this))},initFirstSection:function(){var e=this.orderBlockNode.querySelector(".bx-soa-section.bx-active");BX.addClass(e,"bx-selected");this.activeSectionId=e.id},initOptions:function(){var e,t,i;this.initPropsListForLocation();this.propertyCollection=new BX.Sale.PropertyCollection(BX.merge({publicMode:true},this.result.ORDER_PROP));this.fadedPropertyCollection=new BX.Sale.PropertyCollection(BX.merge({publicMode:true},this.result.ORDER_PROP));if(this.options.propertyValidation)this.initValidation();this.initPagination();this.options.showPreviewPicInBasket=false;this.options.showDetailPicInBasket=false;this.options.showPropsInBasket=false;this.options.showPriceNotesInBasket=false;if(this.result.GRID&&this.result.GRID.HEADERS){e=this.result.GRID.HEADERS;for(t=0;t<e.length;t++){if(e[t].id==="PREVIEW_PICTURE")this.options.showPreviewPicInBasket=true;if(e[t].id==="DETAIL_PICTURE")this.options.showDetailPicInBasket=true;if(e[t].id==="PROPS")this.options.showPropsInBasket=true;if(e[t].id==="NOTES")this.options.showPriceNotesInBasket=true}}if(this.result.TOTAL){i=this.result.TOTAL;this.options.showOrderWeight=i.ORDER_WEIGHT&&parseFloat(i.ORDER_WEIGHT)>0;this.options.showPriceWithoutDiscount=parseFloat(i.ORDER_PRICE)<parseFloat(i.PRICE_WITHOUT_DISCOUNT_VALUE);this.options.showDiscountPrice=i.DISCOUNT_PRICE&&parseFloat(i.DISCOUNT_PRICE)>0;this.options.showTaxList=i.TAX_LIST&&i.TAX_LIST.length;this.options.showPayedFromInnerBudget=i.PAYED_FROM_ACCOUNT_FORMATED&&i.PAYED_FROM_ACCOUNT_FORMATED.length}},reachGoal:function(e,t){var i=this.params.YM_GOALS_COUNTER||"",s=this.params.USE_YM_GOALS=="Y"&&typeof window["yaCounter"+i]!=="undefined",a;if(s){a=this.getGoalId(e,t);window["yaCounter"+i].reachGoal(a)}},getGoalId:function(e,t){if(!e)return"";if(e=="initialization")return this.params.YM_GOALS_INITIALIZE;if(e=="order")return this.params.YM_GOALS_SAVE_ORDER;var i="",s=e=="edit";if(!t||!t.id)return"";switch(t.id){case this.basketBlockNode.id:i=s?this.params.YM_GOALS_EDIT_BASKET:this.params.YM_GOALS_NEXT_BASKET;break;case this.regionBlockNode.id:i=s?this.params.YM_GOALS_EDIT_REGION:this.params.YM_GOALS_NEXT_REGION;break;case this.paySystemBlockNode.id:i=s?this.params.YM_GOALS_EDIT_PAY_SYSTEM:this.params.YM_GOALS_NEXT_PAY_SYSTEM;break;case this.deliveryBlockNode.id:i=s?this.params.YM_GOALS_EDIT_DELIVERY:this.params.YM_GOALS_NEXT_DELIVERY;break;case this.pickUpBlockNode.id:i=s?this.params.YM_GOALS_EDIT_PICKUP:this.params.YM_GOALS_NEXT_PICKUP;break;case this.propsBlockNode.id:i=s?this.params.YM_GOALS_EDIT_PROPERTIES:this.params.YM_GOALS_NEXT_PROPERTIES;break}return i},isPriceChanged:function(e){var t=this.result.TOTAL.ORDER_TOTAL_LEFT_TO_PAY===null||this.result.TOTAL.ORDER_TOTAL_LEFT_TO_PAY===""?this.result.TOTAL.ORDER_TOTAL_PRICE:this.result.TOTAL.ORDER_TOTAL_LEFT_TO_PAY,i=e.order.TOTAL.ORDER_TOTAL_LEFT_TO_PAY===null?e.order.TOTAL.ORDER_TOTAL_PRICE:e.order.TOTAL.ORDER_TOTAL_LEFT_TO_PAY;this.options.totalPriceChanged=parseFloat(t)!=parseFloat(i)},initValidation:function(){if(!this.result.ORDER_PROP||!this.result.ORDER_PROP.properties)return;var e=this.result.ORDER_PROP.properties,t={},i;for(i in e){if(e.hasOwnProperty(i))t[e[i].ID]=e[i]}this.validation.properties=t},initPagination:function(){var e,t,i,s;if(this.result.DELIVERY){this.result.DELIVERY=this.getDeliverySortedArray(this.result.DELIVERY);if(this.options.deliveriesPerPage>0&&this.result.DELIVERY.length>this.options.deliveriesPerPage){e=this.result.DELIVERY.slice();t=Math.ceil(e.length/this.options.deliveriesPerPage);i=[];for(s=0;s<t;s++){i.push(e.splice(0,this.options.deliveriesPerPage))}this.deliveryPagination.pages=i;for(s=0;s<this.result.DELIVERY.length;s++){if(this.result.DELIVERY[s].CHECKED=="Y"){this.deliveryPagination.pageNumber=Math.ceil(++s/this.options.deliveriesPerPage);break}}this.deliveryPagination.pageNumber=this.deliveryPagination.pageNumber||1;this.deliveryPagination.currentPage=i.slice(this.deliveryPagination.pageNumber-1,this.deliveryPagination.pageNumber)[0];this.deliveryPagination.show=true}else{this.deliveryPagination.pageNumber=1;this.deliveryPagination.currentPage=this.result.DELIVERY;this.deliveryPagination.show=false}}if(this.result.PAY_SYSTEM){if(this.options.paySystemsPerPage>0&&this.result.PAY_SYSTEM.length>this.options.paySystemsPerPage){e=this.result.PAY_SYSTEM.slice();t=Math.ceil(e.length/this.options.paySystemsPerPage);i=[];for(s=0;s<t;s++){i.push(e.splice(0,this.options.paySystemsPerPage))}this.paySystemPagination.pages=i;for(s=0;s<this.result.PAY_SYSTEM.length;s++){if(this.result.PAY_SYSTEM[s].CHECKED=="Y"){this.paySystemPagination.pageNumber=Math.ceil(++s/this.options.paySystemsPerPage);break}}this.paySystemPagination.pageNumber=this.paySystemPagination.pageNumber||1;this.paySystemPagination.currentPage=i.slice(this.paySystemPagination.pageNumber-1,this.paySystemPagination.pageNumber)[0];this.paySystemPagination.show=true}else{this.paySystemPagination.pageNumber=1;this.paySystemPagination.currentPage=this.result.PAY_SYSTEM;this.paySystemPagination.show=false}}},initPickUpPagination:function(){var e=false,t=false,i,s=0,a,r,o;if(this.options.pickUpsPerPage>=0&&this.result.DELIVERY){for(s=0;s<this.result.DELIVERY.length;s++){if(this.result.DELIVERY[s].CHECKED==="Y"&&this.result.DELIVERY[s].STORE_MAIN){t=this.result.DELIVERY[s].STORE_MAIN.length>0;e=this.result.DELIVERY[s].STORE_MAIN.length>this.options.pickUpsPerPage;if(t)i=this.getPickUpInfoArray(this.result.DELIVERY[s].STORE_MAIN);break}}}if(t){if(this.options.pickUpsPerPage>0&&e){a=i.slice();r=Math.ceil(a.length/this.options.pickUpsPerPage);o=[];for(s=0;s<r;s++)o.push(a.splice(0,this.options.pickUpsPerPage));this.pickUpPagination.pages=o;for(s=0;s<i.length;s++){if(!this.result.BUYER_STORE||i[s].ID==this.result.BUYER_STORE){this.pickUpPagination.pageNumber=Math.ceil(++s/this.options.pickUpsPerPage);break}}if(!this.pickUpPagination.pageNumber)this.pickUpPagination.pageNumber=1;this.pickUpPagination.currentPage=o.slice(this.pickUpPagination.pageNumber-1,this.pickUpPagination.pageNumber)[0];this.pickUpPagination.show=true}else{this.pickUpPagination.pageNumber=1;this.pickUpPagination.currentPage=i;this.pickUpPagination.show=false}}},prepareLocations:function(e){this.locations={};this.cleanLocations={};var t,i,s,a;if(BX.util.object_keys(e).length){for(i in e){if(!e.hasOwnProperty(i))continue;this.locationsTemplate=e[i].template||"";t=[];a=e[i].output;if(a.clean){this.cleanLocations[i]=BX.processHTML(a.clean,false);delete a.clean}for(s in a){if(a.hasOwnProperty(s)){t.push({output:BX.processHTML(a[s],false),showAlt:e[i].showAlt,lastValue:e[i].lastValue,coordinates:e[i].coordinates||false})}}this.locations[i]=t}}},locationsCompletion:function(){var e,t,i,s,a,r,o,l;this.locationsInitialized=true;this.fixLocationsStyle(this.regionBlockNode,this.regionHiddenBlockNode);this.fixLocationsStyle(this.propsBlockNode,this.propsHiddenBlockNode);for(e in this.locations){if(!this.locations.hasOwnProperty(e))continue;t=this.orderBlockNode.querySelector('div[data-property-id-row="'+e+'"]');if(!t)continue;i=t.querySelector("div.bx-ui-sls-clear");s=t.querySelector("div.bx-ui-slst-pool");a=t.querySelector("input.bx-ui-sls-fake[type=text]");t.removeAttribute("style");this.bindValidation(e,t);if(i){BX.bind(i,"click",function(e){var t=e.target||e.srcElement,i=BX.findParent(t,{tagName:"DIV",className:"form-group"}),s;if(i)s=i.querySelector("input.bx-ui-sls-fake[type=text]");if(s)BX.fireEvent(s,"keyup")})}if(!this.firstLoad&&this.options.propertyValidation){if(s){r=this.validation.properties[e];o=this.getValidationData(r,t);l=BX.findParent(t,{className:"bx-soa-section"});if(l&&l.getAttribute("data-visited")=="true")this.isValidProperty(o)}if(a)BX.fireEvent(a,"keyup")}}if(this.firstLoad&&this.result.IS_AUTHORIZED&&typeof this.result.LAST_ORDER_DATA.FAIL==="undefined"){this.showActualBlock()}else if(!this.result.SHOW_AUTH){this.changeVisibleContent()}this.checkNotifications();if(this.activeSectionId!==this.regionBlockNode.id)this.editFadeRegionContent(this.regionBlockNode.querySelector(".bx-soa-section-content"));if(this.activeSectionId!=this.propsBlockNode.id)this.editFadePropsContent(this.propsBlockNode.querySelector(".bx-soa-section-content"))},fixLocationsStyle:function(e,t){if(!e||!t)return;var i=this.activeSectionId==e.id?e:t,s,a,r;s=i.querySelectorAll("div.bx-sls div.dropdown-block.bx-ui-sls-input-block");a=i.querySelectorAll("div.bx-slst div.dropdown-block.bx-ui-slst-input-block");if(s.length)for(r=0;r<s.length;r++)BX.addClass(s[r],"form-control");if(a.length)for(r=0;r<a.length;r++)BX.addClass(a[r],"form-control")},clickOrderSaveAction:function(e){if(this.isValidForm()){this.allowOrderSave();if(this.params.USER_CONSENT==="Y"&&BX.UserConsent){BX.onCustomEvent("bx-soa-order-save",[])}else{this.doSaveAction()}}return BX.PreventDefault(e)},doSaveAction:function(){if(this.isOrderSaveAllowed()){this.reachGoal("order");this.sendRequest("saveOrderAjax")}},clickNextAction:function(e){var t=e.target||e.srcElement,i=BX.findParent(t,{className:"bx-active"}),s=this.getNextSection(i),a,r,o;this.reachGoal("next",i);if((!this.result.IS_AUTHORIZED||typeof this.result.LAST_ORDER_DATA.FAIL!=="undefined")&&s.next.getAttribute("data-visited")=="false"){r=s.next.querySelector(".bx-soa-section-title-container");BX.bind(r,"click",BX.proxy(this.showByClick,this));o=s.next.querySelector(".bx-soa-editstep");if(o)o.style.display="";a=this.orderBlockNode.querySelectorAll(".bx-soa-section.bx-active");if(s.next.id==a[a.length-1].id)this.switchOrderSaveButtons(true)}this.fade(i,s.next);this.show(s.next);return BX.PreventDefault(e)},clickPrevAction:function(e){var t=e.target||e.srcElement,i=BX.findParent(t,{className:"bx-active"}),s=this.getPrevSection(i);this.fade(i);this.show(s.next);this.animateScrollTo(s.next,800);return BX.PreventDefault(e)},showAuthBlock:function(){var e=this.authBlockNode,t=BX(this.activeSectionId);if(!e||BX.hasClass(e,"bx-selected"))return;t&&this.fade(t);this.show(e)},closeAuthBlock:function(){var e=this.authBlockNode,t=this.getNextSection(e).next;this.fade(e);BX.cleanNode(BX(t.id+"-hidden"));this.show(t)},shouldSkipSection:function(e){var t=false;if(this.params.SKIP_USELESS_BLOCK==="Y"){if(e.id===this.pickUpBlockNode.id){var i=this.getSelectedDelivery();if(i){t=this.getPickUpInfoArray(i.STORE).length===1}}if(e.id===this.deliveryBlockNode.id){t=this.result.DELIVERY&&this.result.DELIVERY.length===1&&this.result.DELIVERY[0].EXTRA_SERVICES.length===0&&!this.result.DELIVERY[0].CALCULATE_ERRORS}if(e.id===this.paySystemBlockNode.id){t=this.result.PAY_SYSTEM&&this.result.PAY_SYSTEM.length===1&&this.result.PAY_FROM_ACCOUNT!=="Y"}}return t},getNextSection:function(e,t){if(!this.orderBlockNode||!e)return{};var i=this.orderBlockNode.querySelectorAll(".bx-soa-section.bx-active"),s,a;for(a=0;a<i.length;a++){if(i[a].id===e.id&&i[a+1]){s=i[a+1];if(this.shouldSkipSection(s)){this.markSectionAsCompleted(s);return this.getNextSection(s,s)}return{prev:e,next:s,skip:t}}}return{next:e}},markSectionAsCompleted:function(e){var t;if((!this.result.IS_AUTHORIZED||typeof this.result.LAST_ORDER_DATA.FAIL!=="undefined")&&e.getAttribute("data-visited")==="false"){this.changeVisibleSection(e,true);t=e.querySelector(".bx-soa-section-title-container");BX.bind(t,"click",BX.proxy(this.showByClick,this))}e.setAttribute("data-visited","true");BX.addClass(e,"bx-step-completed");BX.remove(e.querySelector(".alert.alert-warning.alert-hide"));this.checkBlockErrors(e)},getPrevSection:function(e){if(!this.orderBlockNode||!e)return{};var t=this.orderBlockNode.querySelectorAll(".bx-soa-section.bx-active"),i,s;for(s=0;s<t.length;s++){if(t[s].id===e.id&&t[s-1]){i=t[s-1];if(this.shouldSkipSection(i)){this.markSectionAsCompleted(i);return this.getPrevSection(i)}return{prev:e,next:i}}}return{next:e}},addAnimationEffect:function(e,t,i){if(!e||!t)return;if(this.timeOut[e.id]){clearTimeout(this.timeOut[e.id].timer);BX.removeClass(e,this.timeOut[e.id].className)}setTimeout(function(){BX.addClass(e,t)},10);this.timeOut[e.id]={className:t,timer:setTimeout(BX.delegate(function(){BX.removeClass(e,t);delete this.timeOut[e.id]},this),i||5e3)}},fade:function(e,t){if(!e||!e.id||this.activeSectionId!=e.id)return;this.hasErrorSection[e.id]=false;var i=e.offsetHeight,s;switch(e.id){case this.authBlockNode.id:this.authBlockNode.style.display="none";BX.removeClass(this.authBlockNode,"bx-active");break;case this.basketBlockNode.id:this.editFadeBasketBlock();break;case this.regionBlockNode.id:this.editFadeRegionBlock();break;case this.paySystemBlockNode.id:BX.remove(this.paySystemBlockNode.querySelector(".alert.alert-warning.alert-hide"));this.editFadePaySystemBlock();break;case this.deliveryBlockNode.id:BX.remove(this.deliveryBlockNode.querySelector(".alert.alert-warning.alert-hide"));this.editFadeDeliveryBlock();break;case this.pickUpBlockNode.id:this.editFadePickUpBlock();break;case this.propsBlockNode.id:this.editFadePropsBlock();break}BX.addClass(e,"bx-step-completed");BX.removeClass(e,"bx-selected");s=e.offsetHeight;e.style.height=i+"px";if(t){var a=BX.GetWindowScrollPos().scrollTop,r=BX.pos(this.orderBlockNode),o=BX.pos(e),l,n,c,p,h,d;h=BX(t.id+"-hidden");h.style.left="-10000";h.style.position="absolute";this.orderBlockNode.appendChild(h);c=t.offsetHeight;p=h.offsetHeight+57;BX(e.id+"-hidden").parentNode.appendChild(h);h.removeAttribute("style");l=s+p-i-c;d=window.innerHeight-r.height-l;if(d>0)n=r.top-d/2;else{if(o.top>a)n=o.top;else n=o.bottom+6-i+s;if(n+window.innerHeight>r.bottom+25+l)n=r.bottom+25+l-window.innerHeight}n-=this.isMobile?50:0}new BX.easing({duration:t?800:600,start:{height:i,scrollTop:a},finish:{height:s,scrollTop:n},transition:BX.easing.makeEaseOut(BX.easing.transitions.quad),step:function(i){e.style.height=i.height+"px";if(t)window.scrollTo(0,i.scrollTop)},complete:function(){e.style.height=""}}).animate();this.checkBlockErrors(e)},show:function(e){if(!e||!e.id||this.activeSectionId==e.id)return;this.activeSectionId=e.id;BX.removeClass(e,"bx-step-error bx-step-warning");switch(e.id){case this.authBlockNode.id:this.authBlockNode.style.display="";BX.addClass(this.authBlockNode,"bx-active");break;case this.basketBlockNode.id:this.editActiveBasketBlock(true);this.alignBasketColumns();break;case this.regionBlockNode.id:this.editActiveRegionBlock(true);break;case this.deliveryBlockNode.id:this.editActiveDeliveryBlock(true);break;case this.paySystemBlockNode.id:this.editActivePaySystemBlock(true);break;case this.pickUpBlockNode.id:this.editActivePickUpBlock(true);break;case this.propsBlockNode.id:this.editActivePropsBlock(true);break}if(e.getAttribute("data-visited")==="false"){this.showBlockErrors(e);this.notifyAboutWarnings(e)}e.setAttribute("data-visited","true");BX.addClass(e,"bx-selected");BX.removeClass(e,"bx-step-completed")},showByClick:function(e){var t=e.target||e.srcElement,i=BX.findParent(t,{className:"bx-active"}),s=BX(this.activeSectionId),a=BX.GetWindowScrollPos().scrollTop;if(!i||BX.hasClass(i,"bx-selected"))return BX.PreventDefault(e);this.reachGoal("edit",i);s&&this.fade(s);this.show(i);setTimeout(BX.delegate(function(){if(BX.pos(i).top<a)this.animateScrollTo(i,300)},this),320);return BX.PreventDefault(e)},showActualBlock:function(){var e=this.orderBlockNode.querySelectorAll(".bx-soa-section.bx-active"),t=0;while(e[t]){if(e[t].id===this.regionBlockNode.id)this.isValidRegionBlock();if(e[t].id===this.propsBlockNode.id)this.isValidPropertiesBlock();if(!this.checkBlockErrors(e[t])||!this.checkPreload(e[t])){if(this.activeSectionId!==e[t].id){BX(this.activeSectionId)&&this.fade(BX(this.activeSectionId));this.show(e[t])}break}BX.addClass(e[t],"bx-step-completed");e[t].setAttribute("data-visited","true");t++}},getBlockFooter:function(e){var t=this.orderBlockNode.querySelectorAll(".bx-soa-section.bx-active"),i=t[0],s=t[t.length-1],a=BX.findParent(e,{className:"bx-soa-section"}),r=false,o=[];if(a&&a.id.indexOf(i.id)=="-1"){o.push(BX.create("button",{props:{href:"javascript:void(0)",className:"btn btn-outline-secondary pl-3 pr-3"},html:this.params.MESS_BACK,events:{click:BX.proxy(this.clickPrevAction,this)}}))}if(a&&a.id.indexOf(s.id)!="-1")r=true;if(!r){o.push(BX.create("button",{props:{href:"javascript:void(0)",className:"pull-right btn btn-primary pl-3 pr-3"},html:this.params.MESS_FURTHER,events:{click:BX.proxy(this.clickNextAction,this)}}))}e.appendChild(BX.create("DIV",{props:{className:"row bx-soa-more"},children:[BX.create("DIV",{props:{className:"bx-soa-more-btn col"},children:o})]}))},getNewContainer:function(e){return BX.create("DIV",{props:{className:"bx-soa-section-content"+(!!e?"":" container-fluid")}})},switchOrderSaveButtons:function(e){var t=this.orderSaveBlockNode,i=this.totalBlockNode.querySelector(".bx-soa-cart-total-button-container"),s=this.mobileTotalBlockNode.querySelector(".bx-soa-cart-total-button-container"),a=this.orderSaveBlockNode.style.display=="";if(a!=e){if(e){t.style.opacity=0;t.style.display="";if(i){i.style.opacity=0;i.style.display=""}if(s){s.style.opacity=0;s.style.display=""}new BX.easing({duration:500,start:{opacity:0},finish:{opacity:100},transition:BX.easing.transitions.linear,step:function(e){t.style.opacity=e.opacity/100;if(i)i.style.opacity=e.opacity/100;if(s)s.style.opacity=e.opacity/100},complete:function(){t.removeAttribute("style");i&&i.removeAttribute("style");s&&s.removeAttribute("style")}}).animate()}else{t.style.display="none";if(i)i.setAttribute("style","display: none !important");if(s)s.setAttribute("style","display: none !important")}}},shouldBeSectionVisible:function(e,t){var i=false,s;if(!e||!e.length)return i;for(;t<e.length;t++){if(e[t].getAttribute("data-visited")=="true"){i=true;break}if(!this.firstLoad){s=e[t].querySelector(".bx-soa-editstep");if(s&&s.style.display!=="none"){i=true;break}}}return i},changeVisibleContent:function(){var e=this.orderBlockNode.querySelectorAll(".bx-soa-section.bx-active"),t,i;var s=!!this.result.IS_AUTHORIZED&&this.params.USE_PRELOAD==="Y"&&this.result.LAST_ORDER_DATA.FAIL!==true,a=true;for(t=0;t<e.length;t++){i=this.firstLoad&&s;i=i||this.shouldBeSectionVisible(e,t);this.changeVisibleSection(e[t],i);if(this.firstLoad&&a){if(i&&e[t+1]&&this.checkBlockErrors(e[t])&&(s&&this.checkPreload(e[t])||!s&&this.shouldSkipSection(e[t]))){this.fade(e[t]);this.markSectionAsCompleted(e[t]);this.show(e[t+1])}else{a=false}}}if((!this.result.IS_AUTHORIZED||typeof this.result.LAST_ORDER_DATA.FAIL!=="undefined")&&this.params.SHOW_ORDER_BUTTON==="final_step"){this.switchOrderSaveButtons(this.shouldBeSectionVisible(e,e.length-1))}},changeVisibleSection:function(e,t){var i,s,a;if(e.id!==this.basketBlockNode.id){s=e.querySelector(".bx-soa-section-content");if(s)s.style.display=t?"":"none"}a=e.querySelector(".bx-soa-editstep");if(a)a.style.display=t?"":"none";i=e.querySelector(".bx-soa-section-title-container");if(i&&!t)BX.unbindAll(i)},clearHiddenBlocks:function(){BX.remove(BX.lastChild(this.authHiddenBlockNode));BX.remove(BX.lastChild(this.basketHiddenBlockNode));BX.remove(BX.lastChild(this.regionHiddenBlockNode));BX.remove(BX.lastChild(this.paySystemHiddenBlockNode));BX.remove(BX.lastChild(this.deliveryHiddenBlockNode));BX.remove(BX.lastChild(this.pickUpHiddenBlockNode));BX.remove(BX.lastChild(this.propsHiddenBlockNode))},editOrder:function(){if(!this.orderBlockNode||!this.result)return;if(this.result.DELIVERY.length>0){BX.addClass(this.deliveryBlockNode,"bx-active");this.deliveryBlockNode.removeAttribute("style")}else{BX.removeClass(this.deliveryBlockNode,"bx-active");this.deliveryBlockNode.style.display="none"}this.orderSaveBlockNode.style.display=this.result.SHOW_AUTH?"none":"";this.mobileTotalBlockNode.style.display=this.result.SHOW_AUTH?"none":"";this.checkPickUpShow();var e=this.orderBlockNode.querySelectorAll(".bx-soa-section.bx-active"),t;for(t in e){if(e.hasOwnProperty(t)){this.editSection(e[t])}}this.editTotalBlock();this.totalBlockFixFont();this.showErrors(this.result.ERROR,false);this.showWarnings()},editSection:function(e){if(!e||!e.id)return;if(this.result.SHOW_AUTH&&e.id!=this.authBlockNode.id&&e.id!=this.basketBlockNode.id)e.style.display="none";else if(e.id!=this.pickUpBlockNode.id)e.style.display="";var t=e.id==this.activeSectionId,i=e.querySelector(".bx-soa-section-title-container"),s,a;BX.unbindAll(i);if(this.result.SHOW_AUTH){BX.bind(i,"click",BX.delegate(function(){this.animateScrollTo(this.authBlockNode);this.addAnimationEffect(this.authBlockNode,"bx-step-good")},this))}else{BX.bind(i,"click",BX.proxy(this.showByClick,this));s=i.querySelector(".bx-soa-editstep");s&&BX.bind(s,"click",BX.proxy(this.showByClick,this))}a=e.querySelector(".alert.alert-danger");this.hasErrorSection[e.id]=a&&a.style.display!="none";switch(e.id){case this.authBlockNode.id:this.editAuthBlock();break;case this.basketBlockNode.id:this.editBasketBlock(t);break;case this.regionBlockNode.id:this.editRegionBlock(t);break;case this.paySystemBlockNode.id:this.editPaySystemBlock(t);break;case this.deliveryBlockNode.id:this.editDeliveryBlock(t);break;case this.pickUpBlockNode.id:this.editPickUpBlock(t);break;case this.propsBlockNode.id:this.editPropsBlock(t);break}if(t)e.setAttribute("data-visited","true")},editAuthBlock:function(){if(!this.authBlockNode)return;var e=this.authBlockNode.querySelector(".bx-soa-section-content"),t,i;if(BX.hasClass(e,"reg")){t=e;e=BX.firstChild(this.authHiddenBlockNode)}else t=BX.firstChild(this.authHiddenBlockNode);BX.cleanNode(e);BX.cleanNode(t);if(this.result.SHOW_AUTH){this.getErrorContainer(e);this.editAuthorizeForm(e);this.editSocialContent(e);this.getAuthReference(e);this.getErrorContainer(t);this.editRegistrationForm(t);this.getAuthReference(t)}else{BX.onCustomEvent("OnBasketChange");this.closeAuthBlock()}if(this.result.OK_MESSAGE&&this.result.OK_MESSAGE.length){this.toggleAuthForm({target:this.authBlockNode.querySelector("input[type=submit]")});i=BX.create("DIV",{props:{className:"alert alert-success"},text:this.result.OK_MESSAGE.join()});this.result.OK_MESSAGE="";BX.prepend(i,this.authBlockNode.querySelector(".bx-soa-section-content"))}},editAuthorizeForm:function(e){var t,i,s,a,r;t=this.createAuthFormInputContainer(BX.message("STOF_LOGIN"),BX.create("INPUT",{attrs:{"data-next":"USER_PASSWORD"},props:{className:"form-control",name:"USER_LOGIN",type:"text",value:this.result.AUTH.USER_LOGIN,maxlength:"30"},events:{keypress:BX.proxy(this.checkKeyPress,this)}}));i=this.createAuthFormInputContainer(BX.message("STOF_PASSWORD"),BX.create("INPUT",{attrs:{"data-send":true},props:{className:"form-control",name:"USER_PASSWORD",type:"password",value:"",maxlength:"30"},events:{keypress:BX.proxy(this.checkKeyPress,this)}}));s=BX.create("DIV",{props:{className:"form-check mb-3"},children:[BX.create("INPUT",{props:{className:"form-check-input",id:"authRememberCheckbox",type:"checkbox",name:"USER_REMEMBER",value:"Y"}}),BX.create("LABEL",{attrs:{className:"form-check-label",for:"authRememberCheckbox"},text:BX.message("STOF_REMEMBER")})]});a=BX.create("DIV",{children:[BX.create("INPUT",{props:{id:"do_authorize",type:"hidden",name:"do_authorize",value:"N"}}),BX.create("INPUT",{props:{type:"submit",className:"btn btn-lg btn-primary",value:BX.message("STOF_ENTER")},events:{click:BX.delegate(function(e){BX("do_authorize").value="Y";this.sendRequest("showAuthForm");return BX.PreventDefault(e)},this)}}),BX.create("A",{props:{className:"btn btn-link",href:this.params.PATH_TO_AUTH+"?forgot_password=yes&back_url="+encodeURIComponent(document.location.href)},text:BX.message("STOF_FORGET_PASSWORD")})]});r=BX.create("DIV",{props:{className:"bx-authform"},children:[BX.create("H3",{props:{className:"bx-title"},text:BX.message("STOF_AUTH_REQUEST")}),t,i,s,a]});e.appendChild(BX.create("DIV",{props:{className:"col-md-6"},children:[r]}))},createAuthFormInputContainer:function(e,t,i){if(i)e+='<span class="bx-authform-starrequired">*</span>';var s=BX.create("LABEL",{children:[e]});return BX.create("DIV",{props:{className:"form-group mb-3"},children:[s,t]})},activatePhoneAuth:function(){if(!this.result.SMS_AUTH)return;new BX.PhoneAuth({containerId:"bx_register_resend",errorContainerId:"bx_register_error",interval:60,data:{signedData:this.result.SMS_AUTH.SIGNED_DATA},onError:function(e){var t=BX("bx_register_error");var i=BX.findChildByClassName(t,"errortext");i.innerHTML="";for(var s=0;s<e.errors.length;s++){i.innerHTML=i.innerHTML+BX.util.htmlspecialchars(e.errors[s].message)+"<br>"}t.style.display=""}})},editRegistrationForm:function(e){if(!this.result.AUTH)return;var t=[];var i=this.result.SMS_AUTH&&this.result.SMS_AUTH.TYPE==="OK";if(i){t.push(BX.create("DIV",{props:{className:"alert alert-success"},text:BX.message("STOF_REG_SMS_REQUEST")}));t.push(BX.create("INPUT",{props:{type:"hidden",name:"SIGNED_DATA",value:this.result.SMS_AUTH.SIGNED_DATA||""}}));t.push(this.createAuthFormInputContainer(BX.message("STOF_SMS_CODE"),BX.create("INPUT",{attrs:{"data-send":true},props:{name:"SMS_CODE",type:"text",size:40,value:""},events:{keypress:BX.proxy(this.checkKeyPress,this)}}),true));t.push(BX.create("DIV",{props:{className:"bx-authform-formgroup-container"},children:[BX.create("INPUT",{props:{name:"code_submit_button",type:"submit",className:"btn btn-lg btn-default",value:BX.message("STOF_SEND")},events:{click:BX.delegate(function(e){this.sendRequest("confirmSmsCode");return BX.PreventDefault(e)},this)}})]}));t.push(BX.create("DIV",{props:{className:"bx-authform-formgroup-container"},children:[BX.create("DIV",{props:{id:"bx_register_error"},style:{display:"none"}}),BX.create("DIV",{props:{id:"bx_register_resend"}})]}))}else{t.push(BX.create("H3",{props:{className:"bx-title"},text:BX.message("STOF_REG_REQUEST")}));t.push(this.createAuthFormInputContainer(BX.message("STOF_NAME"),BX.create("INPUT",{attrs:{"data-next":"NEW_LAST_NAME"},props:{name:"NEW_NAME",type:"text",size:40,value:this.result.AUTH.NEW_NAME||""},events:{keypress:BX.proxy(this.checkKeyPress,this)}}),true));t.push(this.createAuthFormInputContainer(BX.message("STOF_LASTNAME"),BX.create("INPUT",{attrs:{"data-next":"NEW_EMAIL"},props:{name:"NEW_LAST_NAME",type:"text",size:40,value:this.result.AUTH.NEW_LAST_NAME||""},events:{keypress:BX.proxy(this.checkKeyPress,this)}}),true));t.push(this.createAuthFormInputContainer(BX.message("STOF_EMAIL"),BX.create("INPUT",{attrs:{"data-next":"PHONE_NUMBER"},props:{name:"NEW_EMAIL",type:"text",size:40,value:this.result.AUTH.NEW_EMAIL||""},events:{keypress:BX.proxy(this.checkKeyPress,this)}}),this.result.AUTH.new_user_email_required=="Y"));if(this.result.AUTH.new_user_phone_auth==="Y"){t.push(this.createAuthFormInputContainer(BX.message("STOF_PHONE"),BX.create("INPUT",{attrs:{"data-next":"captcha_word"},props:{name:"PHONE_NUMBER",type:"text",size:40,value:this.result.AUTH.PHONE_NUMBER||""},events:{keypress:BX.proxy(this.checkKeyPress,this)}}),this.result.AUTH.new_user_phone_required==="Y"))}if(this.authGenerateUser){t.push(BX.create("LABEL",{props:{for:"NEW_GENERATE_N"},children:[BX.create("INPUT",{attrs:{checked:!this.authGenerateUser},props:{id:"NEW_GENERATE_N",type:"radio",name:"NEW_GENERATE",value:"N"}}),BX.message("STOF_MY_PASSWORD")],events:{change:BX.delegate(function(){var e=this.authBlockNode.querySelector(".generated");e.style.display="";this.authGenerateUser=false},this)}}));t.push(BX.create("BR"));t.push(BX.create("LABEL",{props:{for:"NEW_GENERATE_Y"},children:[BX.create("INPUT",{attrs:{checked:this.authGenerateUser},props:{id:"NEW_GENERATE_Y",type:"radio",name:"NEW_GENERATE",value:"Y"}}),BX.message("STOF_SYS_PASSWORD")],events:{change:BX.delegate(function(){var e=this.authBlockNode.querySelector(".generated");e.style.display="none";this.authGenerateUser=true},this)}}))}t.push(BX.create("DIV",{props:{className:"generated"},style:{display:this.authGenerateUser?"none":""},children:[this.createAuthFormInputContainer(BX.message("STOF_LOGIN"),BX.create("INPUT",{props:{name:"NEW_LOGIN",type:"text",size:30,value:this.result.AUTH.NEW_LOGIN||""},events:{keypress:BX.proxy(this.checkKeyPress,this)}}),true),this.createAuthFormInputContainer(BX.message("STOF_PASSWORD"),BX.create("INPUT",{props:{name:"NEW_PASSWORD",type:"password",size:30},events:{keypress:BX.proxy(this.checkKeyPress,this)}}),true),this.createAuthFormInputContainer(BX.message("STOF_RE_PASSWORD"),BX.create("INPUT",{props:{name:"NEW_PASSWORD_CONFIRM",type:"password",size:30},events:{keypress:BX.proxy(this.checkKeyPress,this)}}),true)]}));if(this.result.AUTH.captcha_registration=="Y"){t.push(BX.create("DIV",{props:{className:"bx-authform-formgroup-container"},children:[BX.create("DIV",{props:{className:"bx-authform-label-container"},children:[BX.create("SPAN",{props:{className:"bx-authform-starrequired"},text:"*"}),BX.message("CAPTCHA_REGF_PROMT"),BX.create("DIV",{props:{className:"bx-captcha"},children:[BX.create("INPUT",{props:{name:"captcha_sid",type:"hidden",value:this.result.AUTH.capCode||""}}),BX.create("IMG",{props:{src:"/bitrix/tools/captcha.php?captcha_sid="+this.result.AUTH.capCode,alt:""}})]})]}),BX.create("DIV",{props:{className:"bx-authform-input-container"},children:[BX.create("INPUT",{attrs:{"data-send":true},props:{name:"captcha_word",type:"text",size:"30",maxlength:"50",value:""},events:{keypress:BX.proxy(this.checkKeyPress,this)}})]})]}))}t.push(BX.create("DIV",{props:{className:"bx-authform-formgroup-container"},children:[BX.create("INPUT",{props:{id:"do_register",name:"do_register",type:"hidden",value:"N"}}),BX.create("INPUT",{props:{type:"submit",className:"btn btn-lg btn-default",value:BX.message("STOF_REGISTER")},events:{click:BX.delegate(function(e){BX("do_register").value="Y";this.sendRequest("showAuthForm");return BX.PreventDefault(e)},this)}}),BX.create("A",{props:{className:"btn btn-link",href:""},text:BX.message("STOF_DO_AUTHORIZE"),events:{click:BX.delegate(function(e){this.toggleAuthForm(e);return BX.PreventDefault(e)},this)}})]}))}e.appendChild(BX.create("DIV",{props:{className:"col-md-12"},children:[BX.create("DIV",{props:{className:"bx-authform"},children:t})]}));if(i){this.activatePhoneAuth()}},editSocialContent:function(e){if(!BX("bx-soa-soc-auth-services"))return;var t=[];if(this.socServiceHiddenNode===false){var i=BX("bx-soa-soc-auth-services").querySelector(".bx-authform-social");if(BX.type.isDomNode(i)){this.socServiceHiddenNode=i.innerHTML;BX.remove(i)}}if(this.socServiceHiddenNode){t.push(BX.create("DIV",{props:{className:"bx-authform-social"},html:'<h3 class="bx-title">'+BX.message("SOA_DO_SOC_SERV")+"</h3>"+this.socServiceHiddenNode}));t.push(BX.create("hr",{props:{className:"bxe-light"}}))}if(this.result.AUTH.new_user_registration==="Y"){t.push(BX.create("DIV",{props:{className:"bx-soa-reg-block"},children:[BX.create("P",{html:this.params.MESS_REGISTRATION_REFERENCE}),BX.create("A",{props:{className:"btn btn-primary btn-lg"},text:BX.message("STOF_DO_REGISTER"),events:{click:BX.delegate(function(e){this.toggleAuthForm(e);return BX.PreventDefault(e)},this)}})]}))}e.appendChild(BX.create("DIV",{props:{className:"col-md-6"},children:t}))},getAuthReference:function(e){e.appendChild(BX.create("DIV",{props:{className:"row"},children:[BX.create("DIV",{props:{className:"bx-soa-reference col"},children:[this.params.MESS_AUTH_REFERENCE_1,BX.create("BR"),this.params.MESS_AUTH_REFERENCE_2,BX.create("BR"),this.params.MESS_AUTH_REFERENCE_3]})]}))},toggleAuthForm:function(e){if(!e)return;var t=e.target||e.srcElement,i=BX.findParent(t,{className:"bx-soa-section"}),s=BX.findParent(t,{className:"bx-soa-section-content"}),a=BX.firstChild(this.authHiddenBlockNode);new BX.easing({duration:100,start:{opacity:100},finish:{opacity:0},transition:BX.easing.makeEaseOut(BX.easing.transitions.quad),step:function(e){s.style.opacity=e.opacity/100}}).animate();this.authHiddenBlockNode.appendChild(s);BX.cleanNode(i);i.appendChild(BX.create("DIV",{props:{className:"bx-soa-section-title-container"},children:[BX.create("div",{attrs:{"data-entity":"section-title"},props:{className:"bx-soa-section-title"},html:BX.hasClass(a,"reg")?this.params.MESS_REG_BLOCK_NAME:this.params.MESS_AUTH_BLOCK_NAME})]}));a.style.opacity=0;i.appendChild(a);setTimeout(function(){new BX.easing({duration:100,start:{opacity:0},finish:{opacity:100},transition:BX.easing.makeEaseOut(BX.easing.transitions.quart),step:function(e){a.style.opacity=e.opacity/100},complete:function(){a.style.height="";a.style.opacity=""}}).animate()},110);this.animateScrollTo(i)},alignBasketColumns:function(){if(!this.basketBlockNode)return;var e=0,t,i=0,s,a=BX.GetWindowInnerSize(),r,o;if(a.innerWidth>580&&a.innerWidth<992){r=this.basketBlockNode.querySelectorAll(".bx-soa-basket-info");o=100;if(r.length){s=r[0].querySelectorAll(".bx-soa-item-properties");if(s.length&&s[0].style.width!="")return;i=s.length;if(i>0){i=i>4?4:i;o=parseInt(o/i);for(;e<r.length;e++){s=r[e].querySelectorAll(".bx-soa-item-properties");for(t=0;t<s.length;t++){s[t].style.width=o+"%"}}}}}else{s=this.basketBlockNode.querySelectorAll(".bx-soa-item-properties");if(s.length&&s[0].style.width=="")return;for(;e<s.length;e++){s[e].style.width=""}}},editBasketBlock:function(e){if(!this.basketBlockNode||!this.basketHiddenBlockNode||!this.result.GRID)return;BX.remove(BX.lastChild(this.basketBlockNode));BX.remove(BX.lastChild(this.basketHiddenBlockNode));this.editActiveBasketBlock(e);this.editFadeBasketBlock(e);this.initialized.basket=true},editActiveBasketBlock:function(e){var t=!!e?this.basketBlockNode:this.basketHiddenBlockNode,i,s;if(this.initialized.basket){this.basketHiddenBlockNode.appendChild(BX.lastChild(t));t.appendChild(BX.firstChild(this.basketHiddenBlockNode))}else{i=t.querySelector(".bx-soa-section-content");s=BX.create("DIV",{props:{className:"bx-soa-item-table"}});if(!i){i=this.getNewContainer();t.appendChild(i)}else{BX.cleanNode(i)}this.editBasketItems(s,true);i.appendChild(BX.create("DIV",{props:{className:"bx-soa-table-fade"},children:[BX.create("DIV",{style:{overflowX:"auto",overflowY:"hidden"},children:[s]})]}));if(this.params.SHOW_COUPONS_BASKET==="Y"){this.editCoupons(i)}this.getBlockFooter(i);BX.bind(i.querySelector("div.bx-soa-table-fade").firstChild,"scroll",BX.proxy(this.basketBlockScrollCheckEvent,this))}this.alignBasketColumns()},editFadeBasketBlock:function(e){var t=!!e?this.basketHiddenBlockNode:this.basketBlockNode,i,s;if(this.initialized.basket){this.basketHiddenBlockNode.appendChild(t.querySelector(".bx-soa-section-content"));this.basketBlockNode.appendChild(BX.firstChild(this.basketHiddenBlockNode))}else{i=this.getNewContainer();s=BX.create("DIV",{props:{className:"bx-soa-item-table"}});this.editBasketItems(s,false);i.appendChild(BX.create("DIV",{props:{className:"bx-soa-table-fade"},children:[BX.create("DIV",{style:{overflowX:"auto",overflowY:"hidden"},children:[s]})]}));if(this.params.SHOW_COUPONS_BASKET==="Y"){this.editCouponsFade(i)}t.appendChild(i);this.alignBasketColumns();this.basketBlockScrollCheck();BX.bind(this.basketBlockNode.querySelector("div.bx-soa-table-fade").firstChild,"scroll",BX.proxy(this.basketBlockScrollCheckEvent,this))}this.alignBasketColumns()},editBasketItems:function(e,t){if(!this.result.GRID.ROWS)return;var i=0,s;if(this.params.SHOW_BASKET_HEADERS==="Y"){this.editBasketItemsHeader(e)}for(s in this.result.GRID.ROWS){if(this.result.GRID.ROWS.hasOwnProperty(s)){this.createBasketItem(e,this.result.GRID.ROWS[s],i++,!!t)}}},editBasketItemsHeader:function(e){if(!e)return;var t=[BX.create("DIV",{props:{className:"bx-soa-item-td"},style:{paddingBottom:"5px"},children:[BX.create("DIV",{props:{className:"bx-soa-item-td-title"},text:BX.message("SOA_SUM_NAME")})]})],i=false,s,a=0,r;for(r=0;r<this.result.GRID.HEADERS.length;r++){s=this.result.GRID.HEADERS[r];if(s.id==="NAME"||s.id==="PREVIEW_PICTURE"||s.id==="PROPS"||s.id==="NOTES")continue;if(s.id==="DETAIL_PICTURE"&&!this.options.showPreviewPicInBasket)continue;i=BX.util.in_array(s.id,["QUANTITY","PRICE_FORMATED","DISCOUNT_PRICE_PERCENT_FORMATED","SUM"]);t.push(BX.create("DIV",{props:{className:"bx-soa-item-td bx-soa-item-properties"+(i?" bx-text-right":"")},style:{paddingBottom:"5px"},children:[BX.create("DIV",{props:{className:"bx-soa-item-td-title"},text:s.name})]}));++a;if(a==4&&this.result.GRID.HEADERS[r+1]){t.push(BX.create("DIV",{props:{className:"bx-soa-item-nth-4p1"}}));a=0}}e.appendChild(BX.create("DIV",{props:{className:"bx-soa-item-tr d-none d-md-table-row"},children:t}))},createBasketItem:function(e,t,i,s){var a=[],r=[],o=[],l,n=0,c,p,h;if(this.options.showPreviewPicInBasket||this.options.showDetailPicInBasket)a.push(this.createBasketItemImg(t.data));a.push(this.createBasketItemContent(t.data));for(c=0;c<this.result.GRID.HEADERS.length;c++){l=this.result.GRID.HEADERS[c];if(l.id==="NAME"||l.id==="PREVIEW_PICTURE"||l.id==="PROPS"||l.id==="NOTES")continue;if(l.id==="DETAIL_PICTURE"&&!this.options.showPreviewPicInBasket)continue;r.push(this.createBasketItemColumn(l,t,s));++n;if(n==4&&this.result.GRID.HEADERS[c+1]){r.push(BX.create("DIV",{props:{className:"bx-soa-item-nth-4p1"}}));n=0}}if(s){for(c=0;c<this.result.GRID.HEADERS_HIDDEN.length;c++){p=this.createBasketItemHiddenColumn(this.result.GRID.HEADERS_HIDDEN[c],t);if(BX.type.isArray(p))o=o.concat(p);else if(p)o.push(p)}}h=[BX.create("DIV",{props:{className:"bx-soa-item-td"},style:{minWidth:"255px"},children:[BX.create("DIV",{props:{className:"bx-soa-item-block"},children:a})]})].concat(r);e.appendChild(BX.create("DIV",{props:{className:"bx-soa-item-tr bx-soa-basket-info"+(i==0?" bx-soa-item-tr-first":"")},children:h}));if(o.length){e.appendChild(BX.create("DIV",{props:{className:"bx-soa-item-tr bx-soa-item-info-container"},children:[BX.create("DIV",{props:{className:"bx-soa-item-td"},children:[BX.create("A",{props:{href:"",className:"bx-soa-info-shower"},html:this.params.MESS_ADDITIONAL_PROPS,events:{click:BX.proxy(this.showAdditionalProperties,this)}}),BX.create("DIV",{props:{className:"bx-soa-item-info-block"},children:[BX.create("TABLE",{props:{className:"bx-soa-info-block"},children:o})]})]})]}))}},showAdditionalProperties:function(e){var t=e.target||e.srcElement,i=t.nextSibling,s=BX.findParent(t,{className:"bx-soa-item-tr bx-soa-item-info-container"}),a=s.offsetHeight;if(BX.hasClass(i,"bx-active")){new BX.easing({duration:300,start:{opacity:100,height:a},finish:{opacity:0,height:35},transition:BX.easing.makeEaseOut(BX.easing.transitions.quad),step:function(e){i.style.opacity=e.opacity/100;i.style.height=e.height+"px";s.style.height=e.height+"px"},complete:function(){BX.removeClass(i,"bx-active");i.removeAttribute("style");s.removeAttribute("style")}}).animate()}else{i.style.opacity=0;BX.addClass(i,"bx-active");var r=i.offsetHeight+a;BX.removeClass(i,"bx-active");i.style.paddingTop="10px";new BX.easing({duration:300,start:{opacity:0,height:a},finish:{opacity:100,height:r},transition:BX.easing.makeEaseOut(BX.easing.transitions.quad),step:function(e){i.style.opacity=e.opacity/100;i.style.height=e.height+"px";s.style.height=e.height+"px"},complete:function(){BX.addClass(i,"bx-active");i.removeAttribute("style")}}).animate()}return BX.PreventDefault(e)},createBasketItemImg:function(e){if(!e)return;var t,i;t=BX.create("DIV",{props:{className:"bx-soa-item-imgcontainer"}});if(e.PREVIEW_PICTURE_SRC&&e.PREVIEW_PICTURE_SRC.length)i=this.getImageSources(e,"PREVIEW_PICTURE");else if(e.DETAIL_PICTURE_SRC&&e.DETAIL_PICTURE_SRC.length)i=this.getImageSources(e,"DETAIL_PICTURE");if(i&&i.src_2x){t.setAttribute("style",'background-image: url("'+i.src_1x+'");'+'background-image: -webkit-image-set(url("'+i.src_1x+'") 1x, url("'+i.src_2x+'") 2x)')}else{i=i&&i.src_1x||this.defaultBasketItemLogo;t.setAttribute("style",'background-image: url("'+i+'");')}if(this.params.HIDE_DETAIL_PAGE_URL!=="Y"&&e.DETAIL_PAGE_URL&&e.DETAIL_PAGE_URL.length){t=BX.create("A",{props:{href:e.DETAIL_PAGE_URL},children:[t]})}return BX.create("DIV",{props:{className:"bx-soa-item-img-block"},children:[t]})},createBasketItemContent:function(e){var t=e.NAME||"",i=this.htmlspecialcharsEx(t),s=e.PROPS||[],a=[];if(this.params.HIDE_DETAIL_PAGE_URL!=="Y"&&e.DETAIL_PAGE_URL&&e.DETAIL_PAGE_URL.length){i='<a href="'+e.DETAIL_PAGE_URL+'">'+i+"</a>"}if(this.options.showPropsInBasket&&s.length){for(var r in s){if(s.hasOwnProperty(r)){var o=s[r].NAME||"",l=s[r].VALUE||"";a.push(BX.create("DIV",{props:{className:"bx-soa-item-td-title"},style:{textAlign:"left"},text:o}));a.push(BX.create("DIV",{props:{className:"bx-soa-item-td-text"},style:{textAlign:"left"},text:l}))}}}return BX.create("DIV",{props:{className:"bx-soa-item-content"},children:a.length?[BX.create("DIV",{props:{className:"bx-soa-item-title"},html:i}),BX.create("DIV",{props:{className:"bx-scu-container"},children:a})]:[BX.create("DIV",{props:{className:"bx-soa-item-title"},html:i})]})},createBasketItemColumn:function(e,t,i){if(!e||!t)return;var s=t.columns[e.id]?t.columns:t.data,a=BX.util.in_array(e.id,["QUANTITY","PRICE_FORMATED","DISCOUNT_PRICE_PERCENT_FORMATED","SUM"]),r=BX.create("DIV",{props:{className:"bx-soa-item-td-text"}}),o,l;if(e.id==="PRICE_FORMATED"){r.appendChild(BX.create("STRONG",{props:{className:"bx-price"},html:s.PRICE_FORMATED}));if(parseFloat(s.DISCOUNT_PRICE)>0){r.appendChild(BX.create("BR"));r.appendChild(BX.create("STRONG",{props:{className:"bx-price-old"},html:s.BASE_PRICE_FORMATED}))}if(this.options.showPriceNotesInBasket&&i){r.appendChild(BX.create("BR"));r.appendChild(BX.create("SMALL",{text:s.NOTES}))}}else if(e.id==="SUM"){r.appendChild(BX.create("STRONG",{props:{className:"bx-price all"},html:s.SUM}));if(parseFloat(s.DISCOUNT_PRICE)>0){r.appendChild(BX.create("BR"));r.appendChild(BX.create("STRONG",{props:{className:"bx-price-old"},html:s.SUM_BASE_FORMATED}))}}else if(e.id==="DISCOUNT"){r.appendChild(BX.create("STRONG",{props:{className:"bx-price"},text:s.DISCOUNT_PRICE_PERCENT_FORMATED}))}else if(e.id==="DETAIL_PICTURE"){o=this.getImageSources(t.data,e.id),l=BX.create("IMG",{props:{src:o&&o.src_1x||this.defaultBasketItemLogo}});if(o&&o.src_1x&&o.src_orig){BX.bind(l,"click",BX.delegate(function(e){this.popupShow(e,o.src_orig)},this))}r.appendChild(l)}else if(BX.util.in_array(e.id,["QUANTITY","WEIGHT_FORMATED","DISCOUNT_PRICE_PERCENT_FORMATED"])){r.appendChild(BX.create("SPAN",{html:s[e.id]}))}else if(e.id==="PREVIEW_TEXT"){if(s["PREVIEW_TEXT_TYPE"]==="html"){r.appendChild(BX.create("SPAN",{html:s["PREVIEW_TEXT"]||""}))}else{r.appendChild(BX.create("SPAN",{text:s["PREVIEW_TEXT"]||""}))}}else{var n=s[e.id],c=[];if(BX.type.isArray(n)){for(var p in n){if(n.hasOwnProperty(p)){if(n[p].type=="image")c.push(this.getImageContainer(n[p].value,n[p].source));else if(n[p].type=="linked"){r.appendChild(BX.create("SPAN",{html:n[p].value_format}));r.appendChild(BX.create("BR"))}else if(n[p].value){r.appendChild(BX.create("SPAN",{html:n[p].value}));r.appendChild(BX.create("BR"))}}}if(c.length){r.appendChild(BX.create("DIV",{props:{className:"bx-scu-list"},children:[BX.create("UL",{props:{className:"bx-scu-itemlist"},children:c})]}))}}else if(n){r.appendChild(BX.create("SPAN",{html:BX.util.htmlspecialchars(n)}))}}return BX.create("DIV",{props:{className:"bx-soa-item-td bx-soa-item-properties"+(a?" bx-text-right":"")},children:[BX.create("DIV",{props:{className:"bx-soa-item-td-title d-none d-md-block d-lg-none"},text:e.name}),r]})},createBasketItemHiddenColumn:function(e,t){if(!e||!t)return;var i=t.columns[e.id]?t.columns:t.data,s=BX.create("TD",{props:{className:"bx-soa-info-text"}}),a,r,o;if(e.id==="PROPS"){var l=[],n=t.data.PROPS;if(n&&n.length){for(o in n){if(n.hasOwnProperty(o)){var c=n[o].NAME||"",p=n[o].VALUE||"";if(p.length==0)continue;l.push(BX.create("TR",{props:{className:"bx-soa-info-line"},children:[BX.create("TD",{props:{className:"bx-soa-info-title"},text:c+":"}),BX.create("TD",{props:{className:"bx-soa-info-text"},html:BX.util.htmlspecialchars(p)})]}))}}return l}else return}else if(e.id==="PRICE_FORMATED"){s.appendChild(BX.create("STRONG",{props:{className:"bx-price"},html:i.PRICE_FORMATED}));if(parseFloat(i.DISCOUNT_PRICE)>0){s.appendChild(BX.create("BR"));s.appendChild(BX.create("STRONG",{props:{className:"bx-price-old"},html:i.BASE_PRICE_FORMATED}))}}else if(e.id==="SUM")s.appendChild(BX.create("STRONG",{props:{className:"bx-price all"},text:i.SUM}));else if(e.id==="DISCOUNT")s.appendChild(BX.create("STRONG",{props:{className:"bx-price"},text:i.DISCOUNT_PRICE_PERCENT_FORMATED}));else if(e.id==="DETAIL_PICTURE"||e.id==="PREVIEW_PICTURE"){a=this.getImageSources(t.data,e.id),r=BX.create("IMG",{props:{src:a&&a.src_1x||this.defaultBasketItemLogo},style:{maxWidth:"50%"}});if(a&&a.src_1x&&a.src_orig){BX.bind(r,"click",BX.delegate(function(e){this.popupShow(e,a.src_orig)},this))}s.appendChild(r)}else if(BX.util.in_array(e.id,["QUANTITY","WEIGHT_FORMATED","DISCOUNT_PRICE_PERCENT_FORMATED"])){s.appendChild(BX.create("SPAN",{html:i[e.id]}))}else if(e.id==="PREVIEW_TEXT"){if(i["PREVIEW_TEXT_TYPE"]==="html"){s.appendChild(BX.create("SPAN",{html:i["PREVIEW_TEXT"]||""}))}else{s.appendChild(BX.create("SPAN",{text:i["PREVIEW_TEXT"]||""}))}}else{var h=i[e.id],d=[];if(BX.type.isArray(h)){for(o in h){if(h.hasOwnProperty(o)){if(h[o].type=="image")d.push(this.getImageContainer(h[o].value,h[o].source));else if(h[o].type=="linked"){s.appendChild(BX.create("SPAN",{html:h[o].value_format}));s.appendChild(BX.create("BR"))}else if(h[o].value){s.appendChild(BX.create("SPAN",{html:h[o].value}));s.appendChild(BX.create("BR"))}else return}}if(d.length){s.appendChild(BX.create("DIV",{props:{className:"bx-scu-list"},children:[BX.create("UL",{props:{className:"bx-scu-itemlist"},children:d})]}))}}else if(h){s.appendChild(BX.create("SPAN",{html:BX.util.htmlspecialchars(h)}))}else{return}}return BX.create("TR",{props:{className:"bx-soa-info-line"},children:[BX.create("TD",{props:{className:"bx-soa-info-title"},text:e.name+":"}),s]})},popupShow:function(e,t,i){if(this.popup)this.popup.destroy();var s=this;this.popup=new BX.PopupWindow("bx-soa-image-popup",null,{lightShadow:true,offsetTop:0,offsetLeft:0,closeIcon:{top:"3px",right:"10px"},autoHide:true,bindOptions:{position:"bottom"},closeByEsc:true,zIndex:100,events:{onPopupShow:function(){BX.create("IMG",{props:{src:i||t},events:{load:function(){var e=BX("bx-soa-image-popup-content");if(e){var t=BX.GetWindowInnerSize(),i=this.isMobile?.5:.9,a,r;BX.cleanNode(e);e.appendChild(this);a=e.offsetHeight;r=e.offsetWidth;if(a>t.innerHeight*i){e.style.height=t.innerHeight*i+"px";e.style.width=r*(t.innerHeight*i/a)+"px";a=e.offsetHeight;r=e.offsetWidth}if(r>t.innerWidth*i){e.style.width=t.innerWidth*i+"px";e.style.height=a*(t.innerWidth*i/r)+"px"}e.style.height=e.offsetHeight+"px";e.style.width=e.offsetWidth+"px";s.popup.adjustPosition()}}}})},onPopupClose:function(){this.destroy()}},content:BX.create("DIV",{props:{id:"bx-soa-image-popup-content"},children:[BX.create("IMG",{props:{src:this.templateFolder+"/images/loader.gif"}})]})});this.popup.show()},getImageContainer:function(e,t){return BX.create("LI",{props:{className:"bx-img-item"},children:[BX.create("DIV",{props:{className:"bx-scu-itemColorBlock"},children:[BX.create("DIV",{props:{className:"bx-img-itemColor"},style:{backgroundImage:'url("'+e+'")'}})],events:{click:BX.delegate(function(i){this.popupShow(i,e,t)},this)}})]})},editCoupons:function(e){var t=this.getCouponsList(true),i=this.getCouponsLabel(true),s=BX.create("DIV",{props:{className:"bx-soa-coupon-block"},children:[BX.create("DIV",{props:{className:"bx-soa-coupon-input"},children:[BX.create("INPUT",{props:{className:"form-control bx-ios-fix",type:"text"},events:{change:BX.delegate(function(e){var t=BX.getEventTarget(e);if(t&&t.value){this.sendRequest("enterCoupon",t.value);t.value=""}},this)}})]}),BX.create("SPAN",{props:{className:"bx-soa-coupon-item"},children:t})]});e.appendChild(BX.create("DIV",{props:{className:"bx-soa-coupon"},children:[i,s]}))},editCouponsFade:function(e){if(this.result.COUPON_LIST.length<1)return;var t=this.getCouponsList(false),i,s;if(t.length){i=this.getCouponsLabel(false);s=BX.create("DIV",{props:{className:"bx-soa-coupon-block"},children:[BX.create("DIV",{props:{className:"bx-soa-coupon-list"},children:[BX.create("DIV",{props:{className:"bx-soa-coupon-item"},children:[i].concat(t)})]})]});e.appendChild(BX.create("DIV",{props:{className:"bx-soa-coupon bx-soa-coupon-item-fixed"},children:[s]}))}},getCouponsList:function(e){var t=[],i;for(i=0;i<this.result.COUPON_LIST.length;i++){if(e||!e&&this.result.COUPON_LIST[i].JS_STATUS=="APPLIED"){t.push(this.getCouponNode({text:this.result.COUPON_LIST[i].COUPON,desc:this.result.COUPON_LIST[i].JS_CHECK_CODE,status:this.result.COUPON_LIST[i].JS_STATUS},e))}}return t},getCouponNode:function(e,t){var i=BX.util.htmlspecialchars(e.text)||"",s=e.desc&&e.desc.length?e.desc.charAt(0).toUpperCase()+e.desc.slice(1):BX.message("SOA_NOT_FOUND"),a=e.status||"BAD",r,o;switch(a.toUpperCase()){case"ENTERED":r="used";o="warning";break;case"BAD":r=o="danger";break;default:r=o="success"}return BX.create("STRONG",{attrs:{"data-coupon":i,className:"bx-soa-coupon-item-"+r},children:t?[i||"",BX.create("SPAN",{props:{className:"bx-soa-coupon-remove"},events:{click:BX.delegate(function(e){var t=e.target||e.srcElement,i=BX.findParent(t,{tagName:"STRONG"});if(i&&i.getAttribute("data-coupon")){this.sendRequest("removeCoupon",i.getAttribute("data-coupon"))}},this)}}),BX.create("SPAN",{props:{className:"bx-soa-tooltip bx-soa-tooltip-coupon bx-soa-tooltip-"+o+" tooltip top"},children:[BX.create("SPAN",{props:{className:"tooltip-arrow"}}),BX.create("SPAN",{props:{className:"tooltip-inner"},text:s})]})]:[i]})},getCouponsLabel:function(e){return BX.create("DIV",{props:{className:"bx-soa-coupon-label"},children:e?[BX.create("LABEL",{html:this.params.MESS_USE_COUPON+":"})]:[this.params.MESS_COUPON+":"]})},addCoupon:function(e){var t=this.orderBlockNode.querySelectorAll(".bx-soa-coupon:not(.bx-soa-coupon-item-fixed) .bx-soa-coupon-item");for(var i=0;i<t.length;i++){if(t[i].querySelector('[data-coupon="'+BX.util.htmlspecialchars(e)+'"]'))break;t[i].appendChild(this.getCouponNode({text:e},true,"bx-soa-coupon-item-danger"))}},removeCoupon:function(e){var t=this.orderBlockNode.querySelectorAll('[data-coupon="'+BX.util.htmlspecialchars(e)+'"]'),i;for(i in t){if(t.hasOwnProperty(i)){BX.remove(t[i])}}},editRegionBlock:function(e){if(!this.regionBlockNode||!this.regionHiddenBlockNode||!this.result.PERSON_TYPE)return;if(e){this.editActiveRegionBlock(true);!this.regionBlockNotEmpty&&this.editFadeRegionBlock()}else this.editFadeRegionBlock();this.initialized.region=true},editActiveRegionBlock:function(e){var t=e?this.regionBlockNode:this.regionHiddenBlockNode,i,s,a;if(this.initialized.region){BX.remove(BX.lastChild(t));t.appendChild(BX.firstChild(this.regionHiddenBlockNode))}else{i=t.querySelector(".bx-soa-section-content");if(!i){i=this.getNewContainer();t.appendChild(i)}else BX.cleanNode(i);this.getErrorContainer(i);s=BX.create("DIV",{props:{className:"bx_soa_location row"}});a=BX.create("DIV",{props:{className:"col"}});this.getPersonTypeControl(a);this.getProfilesControl(a);this.getDeliveryLocationInput(a);if(!this.result.SHOW_AUTH){if(this.regionBlockNotEmpty){BX.addClass(this.regionBlockNode,"bx-active");this.regionBlockNode.style.display=""}else{BX.removeClass(this.regionBlockNode,"bx-active");this.regionBlockNode.style.display="none";if(!this.result.IS_AUTHORIZED||typeof this.result.LAST_ORDER_DATA.FAIL!=="undefined")this.initFirstSection()}}s.appendChild(a);i.appendChild(s);this.getBlockFooter(i)}},editFadeRegionBlock:function(){var e=this.regionBlockNode.querySelector(".bx-soa-section-content"),t;if(this.initialized.region){this.regionHiddenBlockNode.appendChild(e)}else{this.editActiveRegionBlock(false);BX.remove(BX.lastChild(this.regionBlockNode))}t=this.getNewContainer(true);this.regionBlockNode.appendChild(t);this.editFadeRegionContent(t)},editFadeRegionContent:function(e){if(!e||!this.locationsInitialized)return;var t=this.getSelectedPersonType(),i=this.regionHiddenBlockNode.querySelector(".alert.alert-danger"),s="",a=[],r,o,l="",n,c,p,h,d,u;BX.cleanNode(e);if(i)e.appendChild(i.cloneNode(true));if(t&&t.NAME&&this.result.PERSON_TYPE.length>1){s+="<strong>"+this.params.MESS_PERSON_TYPE+":</strong> "+BX.util.htmlspecialchars(t.NAME)+"<br>"}if(t){c="PROPS_FADE_LIST_"+t.ID;a=this.params[c]||[]}for(p in this.result.ORDER_PROP.properties){if(this.result.ORDER_PROP.properties.hasOwnProperty(p)){if(this.result.ORDER_PROP.properties[p].IS_LOCATION=="Y"&&this.result.ORDER_PROP.properties[p].ID==this.deliveryLocationInfo.loc){r=this.result.ORDER_PROP.properties[p]}else if(this.result.ORDER_PROP.properties[p].IS_ZIP=="Y"&&this.result.ORDER_PROP.properties[p].ID==this.deliveryLocationInfo.zip){n=this.result.ORDER_PROP.properties[p];for(h=0;h<a.length;h++){if(a[h]==n.ID){o=BX("zipProperty");l=o&&o.value&&o.value.length?o.value:BX.message("SOA_NOT_SPECIFIED");break}}}}}d=this.getLocationString(this.regionHiddenBlockNode);if(r&&d.length)s+="<strong>"+BX.util.htmlspecialchars(r.NAME)+":</strong> "+BX.util.htmlspecialchars(d)+"<br>";if(n&&l.length)s+="<strong>"+BX.util.htmlspecialchars(n.NAME)+":</strong> "+BX.util.htmlspecialchars(l);e.innerHTML+=s;if(this.regionBlockNode.getAttribute("data-visited")=="true"){u=this.isValidRegionBlock();if(u.length){BX.addClass(this.regionBlockNode,"bx-step-error");this.showError(this.regionBlockNode,u)}else BX.removeClass(this.regionBlockNode,"bx-step-error")}BX.bind(e.querySelector(".alert.alert-danger"),"click",BX.proxy(this.showByClick,this));BX.bind(e.querySelector(".alert.alert-warning"),"click",BX.proxy(this.showByClick,this))},getSelectedPersonType:function(){var e,t,i,s,a=this.result.PERSON_TYPE.length;if(a==1){e=this.regionBlockNode.querySelector("input[type=hidden][name=PERSON_TYPE]");if(!e)e=this.regionHiddenBlockNode.querySelector("input[type=hidden][name=PERSON_TYPE]")}else if(a==2){e=this.regionBlockNode.querySelector("input[type=radio][name=PERSON_TYPE]:checked");if(!e)e=this.regionHiddenBlockNode.querySelector("input[type=radio][name=PERSON_TYPE]:checked")}else{e=this.regionBlockNode.querySelector("select[name=PERSON_TYPE] > option:checked");if(!e)e=this.regionHiddenBlockNode.querySelector("select[name=PERSON_TYPE] > option:checked")}if(e){i=e.value;for(s in this.result.PERSON_TYPE){if(this.result.PERSON_TYPE[s].ID==i){t=this.result.PERSON_TYPE[s];break}}}return t},getDeliveryLocationInput:function(e){var t,i,s,a,r,o,l,n,c,p,h,d,u;for(r in this.result.ORDER_PROP.properties){if(this.result.ORDER_PROP.properties.hasOwnProperty(r)){t=this.result.ORDER_PROP.properties[r];if(t.IS_LOCATION=="Y"){i=t.ID;s=parseInt(t.INPUT_FIELD_LOCATION);break}}}a=this.locations[i];if(a&&a[0]&&a[0].output){this.regionBlockNotEmpty=true;l='<label class="bx-soa-custom-label" for="soa-property-'+parseInt(i)+'">'+(t.REQUIRED=="Y"?'<span class="bx-authform-starrequired">*</span> ':"")+BX.util.htmlspecialchars(t.NAME)+(t.DESCRIPTION.length?" <small>("+BX.util.htmlspecialchars(t.DESCRIPTION)+")</small>":"")+"</label>";n=a[0].output;c=BX.create("DIV",{attrs:{"data-property-id-row":i},props:{className:"form-group bx-soa-location-input-container"},style:{visibility:"hidden"},html:l+n.HTML});e.appendChild(c);e.appendChild(BX.create("INPUT",{props:{type:"hidden",name:"RECENT_DELIVERY_VALUE",value:a[0].lastValue}}));for(r in n.SCRIPT)if(n.SCRIPT.hasOwnProperty(r))BX.evalGlobal(n.SCRIPT[r].JS)}if(a&&a[0]&&a[0].showAlt&&s>0){for(r in this.result.ORDER_PROP.properties){if(parseInt(this.result.ORDER_PROP.properties[r].ID)==s){o=this.result.ORDER_PROP.properties[r];break}}}if(o){u=BX.create("DIV",{attrs:{"data-property-id-row":o.ID},props:{className:"form-group bx-soa-location-input-container"}});p=o.REQUIRED=="Y"?'<span class="bx-authform-starrequired">*</span> ':"";p+=BX.util.htmlspecialchars(o.NAME);h=BX.create("LABEL",{attrs:{for:"altProperty"},props:{className:"bx-soa-custom-label"},html:p});d=BX.create("INPUT",{props:{id:"altProperty",type:"text",placeholder:o.DESCRIPTION,autocomplete:"city",className:"form-control bx-soa-customer-input bx-ios-fix",name:"ORDER_PROP_"+o.ID,value:o.VALUE}});u.appendChild(h);u.appendChild(d);e.appendChild(u);this.bindValidation(o.ID,u)}this.getZipLocationInput(e);if(a&&a[0]){e.appendChild(BX.create("DIV",{props:{className:"bx-soa-reference"},html:this.params.MESS_REGION_REFERENCE}))}},getLocationString:function(e){if(!e)return"";var t=e.querySelector(".bx-ui-sls-route"),i="",s,a,r;if(t&&t.value&&t.value.length)i=t.value;else{s=e.querySelectorAll(".bx-ui-combobox-fake.bx-combobox-fake-as-input");for(a=s.length;a--;){if(s[a].innerHTML.indexOf("...")>=0)continue;if(s[a].innerHTML.indexOf("---")>=0){r=BX("altProperty");if(r&&r.value.length)i+=r.value;continue}if(i.length)i+=", ";i+=s[a].innerHTML}if(i.length==0)i=BX.message("SOA_NOT_SPECIFIED")}return i},getZipLocationInput:function(e){var t,i,s,a,r,o;for(i in this.result.ORDER_PROP.properties){if(this.result.ORDER_PROP.properties.hasOwnProperty(i)&&this.result.ORDER_PROP.properties[i].IS_ZIP=="Y"){t=this.result.ORDER_PROP.properties[i];break}}if(t){this.regionBlockNotEmpty=true;s=BX.create("DIV",{props:{className:"form-group bx-soa-location-input-container"}});s.setAttribute("data-property-id-row",t.ID);a=t.REQUIRED=="Y"?'<span class="bx-authform-starrequired">*</span> ':"";a+=BX.util.htmlspecialchars(t.NAME);r=BX.create("LABEL",{attrs:{for:"zipProperty"},props:{className:"bx-soa-custom-label"},html:a});o=BX.create("INPUT",{props:{id:"zipProperty",type:"text",placeholder:t.DESCRIPTION,autocomplete:"zip",className:"form-control bx-soa-customer-input bx-ios-fix",name:"ORDER_PROP_"+t.ID,value:t.VALUE}});s.appendChild(r);s.appendChild(o);e.appendChild(s);e.appendChild(BX.create("input",{props:{id:"ZIP_PROPERTY_CHANGED",name:"ZIP_PROPERTY_CHANGED",type:"hidden",value:this.result.ZIP_PROPERTY_CHANGED||"N"}}));this.bindValidation(t.ID,s)}},getPersonTypeSortedArray:function(e){var t=[],i;for(i in e){if(e.hasOwnProperty(i)){t.push(e[i])}}return t.sort(function(e,t){return parseInt(e.SORT)-parseInt(t.SORT)})},getPersonTypeControl:function(e){if(!this.result.PERSON_TYPE)return;this.result.PERSON_TYPE=this.getPersonTypeSortedArray(this.result.PERSON_TYPE);var t=this.result.PERSON_TYPE.length,i,s,a,r,o=[],l,n=false;if(t>1){r=BX.create("DIV",{props:{className:"form-check-group"},children:[BX.create("LABEL",{props:{className:"bx-soa-custom-label"},html:this.params.MESS_PERSON_TYPE})]});e.appendChild(r);e=r}if(t>2){for(a in this.result.PERSON_TYPE){if(this.result.PERSON_TYPE.hasOwnProperty(a)){i=this.result.PERSON_TYPE[a];o.push(BX.create("OPTION",{props:{value:i.ID,selected:i.CHECKED=="Y"},text:i.NAME}));if(i.CHECKED=="Y")s=i.ID}}e.appendChild(BX.create("SELECT",{props:{name:"PERSON_TYPE",className:"form-control"},children:o,events:{change:BX.proxy(this.sendRequest,this)}}));this.regionBlockNotEmpty=true}else if(t==2){for(a in this.result.PERSON_TYPE){if(this.result.PERSON_TYPE.hasOwnProperty(a)){i=this.result.PERSON_TYPE[a];var c=BX.create("div",{attrs:{className:"form-check"},children:[BX.create("INPUT",{attrs:{className:"form-check-input",id:"radio"+i.ID,checked:i.CHECKED=="Y"},props:{type:"radio",name:"PERSON_TYPE",value:i.ID}}),BX.create("LABEL",{attrs:{className:"form-check-label",for:"radio"+i.ID},text:BX.util.htmlspecialchars(i.NAME),events:{change:BX.proxy(this.sendRequest,this)}})],events:{change:BX.proxy(this.sendRequest,this)}});e.appendChild(c);n=true;if(i.CHECKED=="Y")s=i.ID}}this.regionBlockNotEmpty=true}else{for(a in this.result.PERSON_TYPE)if(this.result.PERSON_TYPE.hasOwnProperty(a))e.appendChild(BX.create("INPUT",{props:{type:"hidden",name:"PERSON_TYPE",value:this.result.PERSON_TYPE[a].ID}}))}if(s){e.appendChild(BX.create("INPUT",{props:{type:"hidden",name:"PERSON_TYPE_OLD",value:s}}))}},getProfilesControl:function(e){var t=BX.util.object_keys(this.result.USER_PROFILES).length,i,s,a=[],r,o;if(t){if(this.params.ALLOW_USER_PROFILES==="Y"&&(t>1||this.params.ALLOW_NEW_PROFILE==="Y")){this.regionBlockNotEmpty=true;s=BX.create("LABEL",{props:{className:"bx-soa-custom-label"},html:this.params.MESS_SELECT_PROFILE});for(i in this.result.USER_PROFILES){if(this.result.USER_PROFILES.hasOwnProperty(i)){a.unshift(BX.create("OPTION",{props:{value:this.result.USER_PROFILES[i].ID,selected:this.result.USER_PROFILES[i].CHECKED==="Y"},html:this.result.USER_PROFILES[i].NAME}))}}if(this.params.ALLOW_NEW_PROFILE==="Y"){a.unshift(BX.create("OPTION",{props:{value:0},text:BX.message("SOA_PROP_NEW_PROFILE")}))}r=BX.create("INPUT",{props:{type:"hidden",value:"N",id:"profile_change",name:"profile_change"}});o=BX.create("SELECT",{props:{className:"form-control",name:"PROFILE_ID"},children:a,events:{change:BX.delegate(function(){BX("profile_change").value="Y";this.sendRequest()},this)}});e.appendChild(BX.create("DIV",{props:{className:"form-group bx-soa-location-input-container"},children:[s,r,o]}))}else{for(i in this.result.USER_PROFILES){if(this.result.USER_PROFILES.hasOwnProperty(i)&&this.result.USER_PROFILES[i].CHECKED==="Y"){e.appendChild(BX.create("INPUT",{props:{name:"PROFILE_ID",type:"hidden",value:this.result.USER_PROFILES[i].ID}}))}}}}},editPaySystemBlock:function(e){if(!this.paySystemBlockNode||!this.paySystemHiddenBlockNode||!this.result.PAY_SYSTEM)return;if(e)this.editActivePaySystemBlock(true);else this.editFadePaySystemBlock();this.initialized.paySystem=true},editActivePaySystemBlock:function(e){var t=e?this.paySystemBlockNode:this.paySystemHiddenBlockNode,i,s;if(this.initialized.paySystem){BX.remove(BX.lastChild(t));t.appendChild(BX.firstChild(this.paySystemHiddenBlockNode))}else{i=t.querySelector(".bx-soa-section-content");if(!i){i=this.getNewContainer();t.appendChild(i)}else BX.cleanNode(i);this.getErrorContainer(i);s=BX.create("DIV",{props:{className:"bx-soa-pp row"}});this.editPaySystemItems(s);i.appendChild(s);this.editPaySystemInfo(s);if(this.params.SHOW_COUPONS_PAY_SYSTEM=="Y")this.editCoupons(i);this.getBlockFooter(i)}},editFadePaySystemBlock:function(){var e=this.paySystemBlockNode.querySelector(".bx-soa-section-content"),t;if(this.initialized.paySystem){this.paySystemHiddenBlockNode.appendChild(e)}else{this.editActivePaySystemBlock(false);BX.remove(BX.lastChild(this.paySystemBlockNode))}t=this.getNewContainer(true);this.paySystemBlockNode.appendChild(t);this.editFadePaySystemContent(t);if(this.params.SHOW_COUPONS_PAY_SYSTEM=="Y")this.editCouponsFade(t)},editPaySystemItems:function(e){if(!this.result.PAY_SYSTEM||this.result.PAY_SYSTEM.length<=0)return;var t=BX.create("DIV",{props:{className:"order-md-1 order-2 col-md-7 bx-soa-pp-item-container"}}),i=BX.create("DIV",{props:{className:"row"}}),s,a;for(a=0;a<this.paySystemPagination.currentPage.length;a++){s=this.createPaySystemItem(this.paySystemPagination.currentPage[a]);i.appendChild(s)}t.appendChild(i);if(this.paySystemPagination.show)this.showPagination("paySystem",t);e.appendChild(t)},createPaySystemItem:function(e){var t=e.CHECKED=="Y",i,s,a=parseInt(e.ID),r,o,l;s=BX.create("DIV",{props:{className:"bx-soa-pp-company-image"}});i=this.getImageSources(e,"PSA_LOGOTIP");if(i&&i.src_2x){s.setAttribute("style",'background-image: url("'+i.src_1x+'");'+'background-image: -webkit-image-set(url("'+i.src_1x+'") 1x, url("'+i.src_2x+'") 2x)')}else{i=i&&i.src_1x||this.defaultPaySystemLogo;s.setAttribute("style",'background-image: url("'+i+'");')}o=BX.create("DIV",{props:{className:"bx-soa-pp-company-graf-container"},children:[BX.create("INPUT",{props:{id:"ID_PAY_SYSTEM_ID_"+a,name:"PAY_SYSTEM_ID",type:"checkbox",className:"bx-soa-pp-company-checkbox",value:a,checked:t}}),s]});if(this.params.SHOW_PAY_SYSTEM_LIST_NAMES=="Y"){r=BX.create("DIV",{props:{className:"bx-soa-pp-company-smalltitle"},text:e.NAME})}l=BX.create("DIV",{props:{className:"bx-soa-pp-company col-6"},children:[o,r],events:{click:BX.proxy(this.selectPaySystem,this)}});if(t)BX.addClass(l,"bx-selected");return l},editPaySystemInfo:function(e){if(!this.result.PAY_SYSTEM||this.result.PAY_SYSTEM.length==0&&this.result.PAY_FROM_ACCOUNT!="Y")return;var t=BX.create("DIV",{props:{className:(this.result.PAY_SYSTEM.length==0?"col-12 mb-3":"col-md-5 mb-lg-0")+" col-12 mb-3 order-md-2 order-1 bx-soa-pp-desc-container"}}),i,s,a,r,o,l,n,c,p,h;BX.cleanNode(t);if(this.result.PAY_FROM_ACCOUNT=="Y")i=this.getInnerPaySystem(t);r=this.getSelectedPaySystem();if(r){l=BX.create("DIV",{props:{className:"bx-soa-pp-company-image"}});o=this.getImageSources(r,"PSA_LOGOTIP");if(o&&o.src_2x){l.setAttribute("style",'background-image: url("'+o.src_1x+'");'+'background-image: -webkit-image-set(url("'+o.src_1x+'") 1x, url("'+o.src_2x+'") 2x)')}else{o=o&&o.src_1x||this.defaultPaySystemLogo;l.setAttribute("style",'background-image: url("'+o+'");')}if(this.params.SHOW_PAY_SYSTEM_INFO_NAME=="Y"){n=BX.create("DIV",{props:{className:"bx-soa-pp-company-subTitle"},text:r.NAME})}c=BX.create("DIV",{props:{className:"bx-soa-pp-company-logo"},children:[BX.create("DIV",{props:{className:"bx-soa-pp-company-graf-container"},children:[l]})]});p=BX.create("DIV",{props:{className:"bx-soa-pp-company-block"},children:[BX.create("DIV",{props:{className:"bx-soa-pp-company-desc"},html:r.DESCRIPTION})]});if(r.PRICE&&parseFloat(r.PRICE)>0){h=BX.create("UL",{props:{className:"bx-soa-pp-list"},children:[BX.create("LI",{children:[BX.create("DIV",{props:{className:"bx-soa-pp-list-termin"},html:this.params.MESS_PRICE+":"}),BX.create("DIV",{props:{className:"bx-soa-pp-list-description"},text:"~"+r.PRICE_FORMATTED})]})]})}s=BX.create("DIV",{children:[n,c,p,h]})}if(i&&s)a=BX.create("HR",{props:{className:"bxe-light"}});t.appendChild(BX.create("DIV",{props:{className:"bx-soa-pp-company"},children:[i,a,s]}));e.appendChild(t)},getInnerPaySystem:function(){if(!this.result.CURRENT_BUDGET_FORMATED||!this.result.PAY_CURRENT_ACCOUNT||!this.result.INNER_PAY_SYSTEM)return;var e=this.params.ONLY_FULL_PAY_FROM_ACCOUNT&&this.params.ONLY_FULL_PAY_FROM_ACCOUNT=="Y",t=this.result.PAY_CURRENT_ACCOUNT&&this.result.PAY_CURRENT_ACCOUNT=="Y",i=this.result.INNER_PAY_SYSTEM,s,a,r,o,l,n,c,p;if(this.params.SHOW_PAY_SYSTEM_INFO_NAME=="Y"){r=BX.create("DIV",{props:{className:"bx-soa-pp-company-subTitle"},text:i.NAME})}a=BX.create("DIV",{props:{className:"bx-soa-pp-company-image"}});s=this.getImageSources(i,"LOGOTIP");if(s&&s.src_2x){a.setAttribute("style",'background-image: url("'+s.src_1x+'");'+'background-image: -webkit-image-set(url("'+s.src_1x+'") 1x, url("'+s.src_2x+'") 2x)')}else{s=s&&s.src_1x||this.defaultPaySystemLogo;a.setAttribute("style",'background-image: url("'+s+'");')}o=BX.create("DIV",{props:{className:"bx-soa-pp-company-logo"},children:[BX.create("DIV",{props:{className:"bx-soa-pp-company-graf-container"},children:[BX.create("INPUT",{props:{type:"checkbox",className:"bx-soa-pp-company-checkbox",name:"PAY_CURRENT_ACCOUNT",value:"Y",checked:t}}),a],events:{click:BX.proxy(this.selectPaySystem,this)}})]});if(i.DESCRIPTION&&i.DESCRIPTION.length){l=BX.create("DIV",{props:{className:"bx-soa-pp-company-block"},children:[BX.create("DIV",{props:{className:"bx-soa-pp-company-desc"},html:i.DESCRIPTION})]})}n=BX.create("INPUT",{props:{type:"hidden",name:"PAY_CURRENT_ACCOUNT",value:"N"}});c=this.params.MESS_INNER_PS_BALANCE+' <b class="wsnw">'+this.result.CURRENT_BUDGET_FORMATED+"</b><br>"+(e?BX.message("SOA_PAY_ACCOUNT3"):"");p=BX.create("DIV",{props:{className:"bx-soa-pp-company-desc"},html:c});return BX.create("DIV",{props:{className:"bx-soa-pp-inner-ps"+(t?" bx-selected":"")},children:[n,r,o,l,p]})},editFadePaySystemContent:function(e){var t=this.getSelectedPaySystem(),i=this.paySystemHiddenBlockNode.querySelector("div.alert.alert-danger"),s=this.paySystemHiddenBlockNode.querySelector("div.alert.alert-warning.alert-show"),a="",r,o;if(i)e.appendChild(BX.create("div",{props:{className:"col-12"},children:[i.cloneNode(true)]}));else this.getErrorContainer(e);if(s&&s.innerHTML)e.appendChild(s.cloneNode(true));if(this.isSelectedInnerPayment()){r=this.getImageSources(this.result.INNER_PAY_SYSTEM,"LOGOTIP");o=r&&r.src_1x||this.defaultPaySystemLogo;a+='<div class="bx-soa-pp-company-selected">';a+='<img src="'+o+'" style="height:18px;" alt="">';a+="<strong>"+this.result.INNER_PAY_SYSTEM.NAME+"</strong><br>";a+="</div>"}if(t&&t.NAME){r=this.getImageSources(t,"PSA_LOGOTIP");o=r&&r.src_1x||this.defaultPaySystemLogo;a+='<div class="bx-soa-pp-company-selected">';a+='<img src="'+o+'" style="height:18px;" alt="">';a+="<strong>"+BX.util.htmlspecialchars(t.NAME)+"</strong>";a+="</div>"}if(!a.length)a="<strong>"+BX.message("SOA_PS_SELECT_ERROR")+"</strong>";e.innerHTML+=a;e.appendChild(BX.create("DIV",{style:{clear:"both"}}));BX.bind(e.querySelector(".alert.alert-danger"),"click",BX.proxy(this.showByClick,this));BX.bind(e.querySelector(".alert.alert-warning"),"click",BX.proxy(this.showByClick,this))},getSelectedPaySystem:function(){var e=this.paySystemBlockNode.querySelector("input[type=checkbox][name=PAY_SYSTEM_ID]:checked"),t=null,i,s;if(!e)e=this.paySystemHiddenBlockNode.querySelector("input[type=checkbox][name=PAY_SYSTEM_ID]:checked");if(!e)e=this.paySystemHiddenBlockNode.querySelector("input[type=hidden][name=PAY_SYSTEM_ID]");if(e){i=e.value;for(s=0;s<this.result.PAY_SYSTEM.length;s++){if(this.result.PAY_SYSTEM[s].ID==i){t=this.result.PAY_SYSTEM[s];break}}}return t},isSelectedInnerPayment:function(){var e=this.paySystemBlockNode.querySelector("input[type=checkbox][name=PAY_CURRENT_ACCOUNT]");if(!e)e=this.paySystemHiddenBlockNode.querySelector("input[type=checkbox][name=PAY_CURRENT_ACCOUNT]");return e&&e.checked},selectPaySystem:function(e){if(!this.orderBlockNode||!e)return;var t=e.target||e.srcElement,i=this.paySystemBlockNode.querySelector("div.bx-soa-pp-inner-ps"),s=this.paySystemBlockNode.querySelector("input[type=checkbox][name=PAY_CURRENT_ACCOUNT]"),a=this.result.TOTAL&&parseFloat(this.result.TOTAL.ORDER_TOTAL_LEFT_TO_PAY)===0;var r=BX.hasClass(t,"bx-soa-pp-inner-ps")?t:BX.findParent(t,{className:"bx-soa-pp-inner-ps"}),o=BX.hasClass(t,"bx-soa-pp-company")?t:BX.findParent(t,{className:"bx-soa-pp-company"}),l,n;if(r){if(t.nodeName=="INPUT")s.checked=!s.checked;if(s.checked){BX.removeClass(i,"bx-selected");s.checked=false}else{BX.addClass(i,"bx-selected");s.checked=true}}else if(o){if(BX.hasClass(o,"bx-selected"))return BX.PreventDefault(e);if(s&&s.checked&&a){BX.addClass(o,"bx-selected");l=o.querySelector("input[type=checkbox]");l.checked=true;BX.removeClass(i,"bx-selected");s.checked=false}else{n=this.paySystemBlockNode.querySelector(".bx-soa-pp-company.bx-selected");BX.addClass(o,"bx-selected");l=o.querySelector("input[type=checkbox]");l.checked=true;if(n){BX.removeClass(n,"bx-selected");n.querySelector("input[type=checkbox]").checked=false}}}this.sendRequest()},editDeliveryBlock:function(e){if(!this.deliveryBlockNode||!this.deliveryHiddenBlockNode||!this.result.DELIVERY)return;if(e)this.editActiveDeliveryBlock(true);else this.editFadeDeliveryBlock();this.checkPickUpShow();this.initialized.delivery=true},editActiveDeliveryBlock:function(e){var t=e?this.deliveryBlockNode:this.deliveryHiddenBlockNode,i,s;if(this.initialized.delivery){BX.remove(BX.lastChild(t));t.appendChild(BX.firstChild(this.deliveryHiddenBlockNode))}else{i=t.querySelector(".bx-soa-section-content");if(!i){i=this.getNewContainer();t.appendChild(i)}else BX.cleanNode(i);this.getErrorContainer(i);s=BX.create("DIV",{props:{className:"bx-soa-pp row"}});this.editDeliveryItems(s);i.appendChild(s);this.editDeliveryInfo(s);if(this.params.SHOW_COUPONS_DELIVERY=="Y")this.editCoupons(i);this.getBlockFooter(i)}},editDeliveryItems:function(e){if(!this.result.DELIVERY||this.result.DELIVERY.length<=0)return;var t=BX.create("DIV",{props:{className:"order-md-1 order-2 col-md-7 bx-soa-pp-item-container"}}),i=BX.create("DIV",{props:{className:"row"}}),s,a;for(a=0;a<this.deliveryPagination.currentPage.length;a++){s=this.createDeliveryItem(this.deliveryPagination.currentPage[a]);i.appendChild(s)}t.appendChild(i);if(this.deliveryPagination.show)this.showPagination("delivery",t);e.appendChild(t)},editDeliveryInfo:function(e){if(!this.result.DELIVERY)return;var t=BX.create("DIV",{props:{className:"col-md-5 mb-lg-0 col-12 mb-3 order-md-2 order-1 bx-soa-pp-desc-container"}}),i,s,a,r,o,l,n,c,p,h,d,u,B;BX.cleanNode(t);i=this.getSelectedDelivery();r=BX.create("DIV",{props:{className:"bx-soa-pp-company-image"}});s=this.getImageSources(i,"LOGOTIP");if(s&&s.src_2x){r.setAttribute("style",'background-image: url("'+s.src_1x+'");'+'background-image: -webkit-image-set(url("'+s.src_1x+'") 1x, url("'+s.src_2x+'") 2x)')}else{s=s&&s.src_1x||this.defaultDeliveryLogo;r.setAttribute("style",'background-image: url("'+s+'");')}a=this.params.SHOW_DELIVERY_PARENT_NAMES!="N"?i.NAME:i.OWN_NAME;if(this.params.SHOW_DELIVERY_INFO_NAME=="Y")o=BX.create("DIV",{props:{className:"bx-soa-pp-company-subTitle"},text:a});l=BX.create("DIV",{props:{className:"bx-soa-pp-company-logo"},children:[BX.create("DIV",{props:{className:"bx-soa-pp-company-graf-container"},children:[r]})]});n=BX.create("DIV",{props:{className:"bx-soa-pp-company-block"},children:[BX.create("DIV",{props:{className:"bx-soa-pp-company-desc"},html:i.DESCRIPTION}),i.CALCULATE_DESCRIPTION?BX.create("DIV",{props:{className:"bx-soa-pp-company-desc"},html:i.CALCULATE_DESCRIPTION}):null]});if(i.PRICE>=0){c=BX.create("LI",{children:[BX.create("DIV",{props:{className:"bx-soa-pp-list-termin"},html:this.params.MESS_PRICE+":"}),BX.create("DIV",{props:{className:"bx-soa-pp-list-description"},children:this.getDeliveryPriceNodes(i)})]})}if(i.PERIOD_TEXT&&i.PERIOD_TEXT.length){p=BX.create("LI",{children:[BX.create("DIV",{props:{className:"bx-soa-pp-list-termin"},html:this.params.MESS_PERIOD+":"}),BX.create("DIV",{props:{className:"bx-soa-pp-list-description"},html:i.PERIOD_TEXT})]})}h=BX.create("DIV",{style:{clear:"both"}});d=BX.create("UL",{props:{className:"bx-soa-pp-list"},children:[c,p]});u=this.getDeliveryExtraServices(i);if(u.length){B=BX.create("DIV",{props:{className:"bx-soa-pp-company-block"},children:u})}t.appendChild(BX.create("DIV",{props:{className:"bx-soa-pp-company"},children:[o,l,n,h,B,d]}));e.appendChild(t);if(this.params.DELIVERY_NO_AJAX!="Y")this.deliveryCachedInfo[i.ID]=i},getDeliveryPriceNodes:function(e){var t;if(typeof e.DELIVERY_DISCOUNT_PRICE!=="undefined"&&parseFloat(e.DELIVERY_DISCOUNT_PRICE)!=parseFloat(e.PRICE)){if(parseFloat(e.DELIVERY_DISCOUNT_PRICE)>parseFloat(e.PRICE))t=[e.DELIVERY_DISCOUNT_PRICE_FORMATED];else t=[e.DELIVERY_DISCOUNT_PRICE_FORMATED,BX.create("BR"),BX.create("SPAN",{props:{className:"bx-price-old"},html:e.PRICE_FORMATED})]}else{t=[e.PRICE_FORMATED]}return t},getDeliveryExtraServices:function(e){var t=[],i=false,s,a,r,o,l;for(s in e.EXTRA_SERVICES){if(!e.EXTRA_SERVICES.hasOwnProperty(s))continue;a=e.EXTRA_SERVICES[s];if(!a.canUserEditValue)continue;if(a.editControl.indexOf("this.checked")==-1){o=BX.create("LABEL",{html:BX.util.htmlspecialchars(a.name)+(a.price?" ("+a.priceFormatted+")":"")});if(s==0)i=true;r=BX.create("DIV",{props:{className:"form-group bx-soa-pp-field"},html:a.editControl+(a.description&&a.description.length?'<div class="bx-soa-service-small">'+BX.util.htmlspecialchars(a.description)+"</div>":"")});BX.prepend(o,r);l=r.querySelector("input[type=text]");if(!l)l=r.querySelector("select");if(l)BX.addClass(l,"form-control")}else{r=BX.create("DIV",{props:{className:"checkbox"},children:[BX.create("LABEL",{html:a.editControl+BX.util.htmlspecialchars(a.name)+(a.price?" ("+a.priceFormatted+")":"")+(a.description&&a.description.length?'<div class="bx-soa-service-small">'+BX.util.htmlspecialchars(a.description)+"</div>":"")})]})}t.push(r)}i&&t.unshift(BX.create("BR"));return t},editFadeDeliveryBlock:function(){var e=this.deliveryBlockNode.querySelector(".bx-soa-section-content"),t;if(this.initialized.delivery){this.deliveryHiddenBlockNode.appendChild(e)}else{this.editActiveDeliveryBlock(false);BX.remove(BX.lastChild(this.deliveryBlockNode))}t=this.getNewContainer(true);this.deliveryBlockNode.appendChild(t);this.editFadeDeliveryContent(t);if(this.params.SHOW_COUPONS_DELIVERY=="Y")this.editCouponsFade(t)},createDeliveryItem:function(e){var t=e.CHECKED=="Y",i=parseInt(e.ID),s=[BX.create("INPUT",{props:{id:"ID_DELIVERY_ID_"+i,name:"DELIVERY_ID",type:"checkbox",className:"bx-soa-pp-company-checkbox",value:i,checked:t}})],a=this.deliveryCachedInfo[i],r,o,l,n,c;c=BX.create("DIV",{props:{className:"bx-soa-pp-company-image"}});r=this.getImageSources(e,"LOGOTIP");if(r&&r.src_2x){c.setAttribute("style",'background-image: url("'+r.src_1x+'");'+'background-image: -webkit-image-set(url("'+r.src_1x+'") 1x, url("'+r.src_2x+'") 2x)')}else{r=r&&r.src_1x||this.defaultDeliveryLogo;c.setAttribute("style",'background-image: url("'+r+'");')}s.push(c);if(e.PRICE>=0||typeof e.DELIVERY_DISCOUNT_PRICE!=="undefined"){s.push(BX.create("DIV",{props:{className:"bx-soa-pp-delivery-cost"},html:typeof e.DELIVERY_DISCOUNT_PRICE!=="undefined"?e.DELIVERY_DISCOUNT_PRICE_FORMATED:e.PRICE_FORMATED}))}else if(a&&(a.PRICE>=0||typeof a.DELIVERY_DISCOUNT_PRICE!=="undefined")){s.push(BX.create("DIV",{props:{className:"bx-soa-pp-delivery-cost"},html:typeof a.DELIVERY_DISCOUNT_PRICE!=="undefined"?a.DELIVERY_DISCOUNT_PRICE_FORMATED:a.PRICE_FORMATED}))}o=BX.create("DIV",{props:{className:"bx-soa-pp-company-graf-container"+(e.CALCULATE_ERRORS||a&&a.CALCULATE_ERRORS?" bx-bd-waring":"")},children:s});if(this.params.SHOW_DELIVERY_LIST_NAMES=="Y"){l=BX.create("DIV",{props:{className:"bx-soa-pp-company-smalltitle"},text:this.params.SHOW_DELIVERY_PARENT_NAMES!="N"?e.NAME:e.OWN_NAME})}n=BX.create("DIV",{props:{className:"bx-soa-pp-company col-6"},children:[o,l],events:{click:BX.proxy(this.selectDelivery,this)}});t&&BX.addClass(n,"bx-selected");if(t&&this.result.LAST_ORDER_DATA.PICK_UP)this.lastSelectedDelivery=i;return n},editFadeDeliveryContent:function(e){var t=this.getSelectedDelivery(),i=this.params.SHOW_DELIVERY_PARENT_NAMES!="N"?t.NAME:t.OWN_NAME,s=this.deliveryHiddenBlockNode.querySelector("div.alert.alert-danger"),a=this.deliveryHiddenBlockNode.querySelector("div.alert.alert-warning.alert-show"),r,o,l,n,c;if(s&&s.innerHTML)e.appendChild(s.cloneNode(true));else this.getErrorContainer(e);if(a&&a.innerHTML)e.appendChild(a.cloneNode(true));if(t&&t.NAME){o=this.getImageSources(t,"LOGOTIP");l=o&&o.src_1x||this.defaultDeliveryLogo;n=[BX.create("IMG",{props:{src:l,alt:""},style:{height:"18px"}}),BX.create("STRONG",{text:i})];if(this.params.DELIVERY_FADE_EXTRA_SERVICES=="Y"&&BX.util.object_keys(t.EXTRA_SERVICES).length){n.push(BX.create("BR"));for(c in t.EXTRA_SERVICES){if(t.EXTRA_SERVICES.hasOwnProperty(c)){r=t.EXTRA_SERVICES[c];if(r.value&&r.value!="N"&&r.canUserEditValue){n.push(BX.create("BR"));n.push(BX.create("STRONG",{text:r.name+": "}));n.push(r.viewControl)}}}}e.appendChild(BX.create("DIV",{props:{className:"row"},children:[BX.create("DIV",{props:{className:"col-sm-9 bx-soa-pp-company-selected"},children:n}),BX.create("DIV",{props:{className:"col-sm bx-soa-pp-price"},children:this.getDeliveryPriceNodes(t)})]}))}else e.appendChild(BX.create("STRONG",{text:BX.message("SOA_DELIVERY_SELECT_ERROR")}));e.appendChild(BX.create("DIV",{style:{clear:"both"}}));BX.bind(e.querySelector(".alert.alert-danger"),"click",BX.proxy(this.showByClick,this));BX.bind(e.querySelector(".alert.alert-warning"),"click",BX.proxy(this.showByClick,this))},selectDelivery:function(e){if(!this.orderBlockNode)return;var t=e.target||e.srcElement,i=BX.hasClass(t,"bx-soa-pp-company")?t:BX.findParent(t,{className:"bx-soa-pp-company"}),s=this.deliveryBlockNode.querySelector(".bx-soa-pp-company.bx-selected"),a,r;if(BX.hasClass(i,"bx-selected"))return BX.PreventDefault(e);if(i){a=i.querySelector("input[type=checkbox]");BX.addClass(i,"bx-selected");a.checked=true}if(s){r=s.querySelector("input[type=checkbox]");BX.removeClass(s,"bx-selected");r.checked=false}this.sendRequest()},getSelectedDelivery:function(){var e=this.deliveryBlockNode.querySelector("input[type=checkbox][name=DELIVERY_ID]:checked"),t=false,i,s;if(!e)e=this.deliveryHiddenBlockNode.querySelector("input[type=checkbox][name=DELIVERY_ID]:checked");if(!e)e=this.deliveryHiddenBlockNode.querySelector("input[type=hidden][name=DELIVERY_ID]");if(e){i=e.value;for(s in this.result.DELIVERY){if(this.result.DELIVERY[s].ID==i){t=this.result.DELIVERY[s];break}}}return t},activatePickUp:function(e){if(!this.pickUpBlockNode||!this.pickUpHiddenBlockNode)return;this.pickUpBlockNode.style.display="";this.pickUpBlockNode.querySelector('[data-entity="section-title"]').innerHTML='<span class="bx-soa-section-title-count"></span>'+BX.util.htmlspecialchars(e);if(BX.hasClass(this.pickUpBlockNode,"bx-active"))return;BX.addClass(this.pickUpBlockNode,"bx-active");this.pickUpBlockNode.style.display=""},deactivatePickUp:function(){if(!this.pickUpBlockNode||!this.pickUpHiddenBlockNode)return;if(!BX.hasClass(this.pickUpBlockNode,"bx-active"))return;BX.removeClass(this.pickUpBlockNode,"bx-active");this.pickUpBlockNode.style.display="none"},editPickUpBlock:function(e){if(!this.pickUpBlockNode||!this.pickUpHiddenBlockNode||!BX.hasClass(this.pickUpBlockNode,"bx-active")||!this.result.DELIVERY)return;this.initialized.pickup=false;if(e)this.editActivePickUpBlock(true);else this.editFadePickUpBlock();this.initialized.pickup=true},editActivePickUpBlock:function(e){var t=e?this.pickUpBlockNode:this.pickUpHiddenBlockNode,i,s;if(this.initialized.pickup){BX.remove(BX.lastChild(t));t.appendChild(BX.firstChild(this.pickUpHiddenBlockNode));if(this.params.SHOW_NEAREST_PICKUP==="Y"&&this.maps&&!this.maps.maxWaitTimeExpired){this.maps.maxWaitTimeExpired=true;this.initPickUpPagination();this.editPickUpList(true);this.pickUpFinalAction()}if(this.maps&&!this.pickUpMapFocused){this.pickUpMapFocused=true;setTimeout(BX.proxy(this.maps.pickUpMapFocusWaiter,this.maps),200)}}else{i=t.querySelector(".bx-soa-section-content");if(!i){i=this.getNewContainer();t.appendChild(i)}BX.cleanNode(i);s=BX.create("DIV",{props:{className:"col"}});this.editPickUpMap(s);this.editPickUpLoader(s);i.appendChild(BX.create("DIV",{props:{className:"bx_soa_pickup row"},children:[s]}));if(this.params.SHOW_PICKUP_MAP!="Y"||this.params.SHOW_NEAREST_PICKUP!="Y"){this.initPickUpPagination();this.editPickUpList(true);this.pickUpFinalAction()}this.getBlockFooter(i)}},editFadePickUpBlock:function(){var e=this.pickUpBlockNode.querySelector(".bx-soa-section-content"),t;if(this.initialized.pickup){this.pickUpHiddenBlockNode.appendChild(e)}else{this.editActivePickUpBlock(false);BX.remove(BX.lastChild(this.pickUpBlockNode))}t=this.getNewContainer();this.pickUpBlockNode.appendChild(t);this.editFadePickUpContent(t)},editFadePickUpContent:function(e){var t=this.getSelectedPickUp(),i="",s,a;if(t){if(this.params.SHOW_STORES_IMAGES=="Y"){s=this.getImageSources(t,"IMAGE_ID");a=s.src_1x||this.defaultStoreLogo;i+='<img src="'+a+'" class="bx-soa-pickup-preview-img">'}i+="<strong>"+BX.util.htmlspecialchars(t.TITLE)+"</strong>";if(t.ADDRESS)i+="<br><strong>"+BX.message("SOA_PICKUP_ADDRESS")+":</strong> "+BX.util.htmlspecialchars(t.ADDRESS);if(t.PHONE)i+="<br><strong>"+BX.message("SOA_PICKUP_PHONE")+":</strong> "+BX.util.htmlspecialchars(t.PHONE);if(t.SCHEDULE)i+="<br><strong>"+BX.message("SOA_PICKUP_WORK")+":</strong> "+BX.util.htmlspecialchars(t.SCHEDULE);if(t.DESCRIPTION)i+="<br><strong>"+BX.message("SOA_PICKUP_DESC")+":</strong> "+BX.util.htmlspecialchars(t.DESCRIPTION);e.innerHTML=i;if(this.params.SHOW_STORES_IMAGES=="Y"){BX.bind(e.querySelector(".bx-soa-pickup-preview-img"),"click",BX.delegate(function(e){this.popupShow(e,s&&s.src_orig||a)},this))}}},getPickUpInfoArray:function(e){if(!e||e.length<=0)return[];var t=[],i;for(i=0;i<e.length;i++)if(this.result.STORE_LIST[e[i]])t.push(this.result.STORE_LIST[e[i]]);return t},getSelectedPickUp:function(){var e=BX("BUYER_STORE"),t,i,s=this.result.STORE_LIST,a,r;if(e){i=e.value;t=s[i];if(!t){a=this.getSelectedDelivery().STORE;if(a){for(r in a){if(a.hasOwnProperty(r)){t=s[a[r]];e.setAttribute("value",a[r]);break}}}}}return t},checkPickUpShow:function(){var e=this.getSelectedDelivery(),t,i;if(e&&e.STORE&&e.STORE.length)i=this.getPickUpInfoArray(e.STORE);if(i&&i.length){t=this.params.SHOW_DELIVERY_PARENT_NAMES!="N"?e.NAME:e.OWN_NAME;e.STORE_MAIN=e.STORE;this.activatePickUp(t);this.editSection(this.pickUpBlockNode)}else{this.deactivatePickUp()}},geoLocationSuccessCallback:function(e){var t,i=this.getSelectedDelivery();if(i&&i.STORE){t=this.getPickUpInfoArray(i.STORE)}if(t&&t.length>=this.options.pickUpMap.minToShowNearestBlock){this.editPickUpRecommendList(e.geoObjects.get(0))}this.initPickUpPagination();this.editPickUpList(true);this.pickUpFinalAction()},geoLocationFailCallback:function(){this.initPickUpPagination();this.editPickUpList(true);this.pickUpFinalAction()},initMaps:function(){this.maps=BX.Sale.OrderAjaxComponent.Maps.init(this);if(this.maps){this.mapsReady=true;this.resizeMapContainers();if(this.params.SHOW_PICKUP_MAP==="Y"&&BX("pickUpMap")){var e=this.getSelectedDelivery();if(e&&e.STORE&&e.STORE.length){var t=this.getPickUpInfoArray(e.STORE)}if(t&&t.length){var i=this.getSelectedPickUp();this.maps.initializePickUpMap(i);if(this.params.SHOW_NEAREST_PICKUP==="Y"){this.maps.showNearestPickups(BX.proxy(this.geoLocationSuccessCallback,this),BX.proxy(this.geoLocationFailCallback,this))}this.maps.buildBalloons(t)}}if(this.params.SHOW_MAP_IN_PROPS==="Y"&&BX("propsMap")){var s=this.getPropertyMapData();this.maps.initializePropsMap(s)}}},getPropertyMapData:function(){var e,t,i;var s=this.options.propertyMap.defaultMapPosition;for(i in this.result.ORDER_PROP.properties){if(this.result.ORDER_PROP.properties.hasOwnProperty(i)){e=this.result.ORDER_PROP.properties[i];if(e.IS_LOCATION=="Y"){t=e.ID;break}}}if(this.locations[t]&&this.locations[t][0]&&this.locations[t][0].coordinates){e=this.locations[t][0].coordinates;var a=parseFloat(e.LONGITUDE),r=parseFloat(e.LATITUDE);if(!isNaN(a)&&!isNaN(r)&&a!=0&&r!=0){s.lon=a;s.lat=r}}return s},resizeMapContainers:function(){var e=BX("pickUpMap"),t=BX("propsMap"),i=this.propsBlockNode,s,a;if(i&&(e||t)){s=i.clientWidth;a=parseInt(s/16*9);if(this.params.SHOW_PICKUP_MAP==="Y"&&e){e.style.height=a+"px"}if(this.params.SHOW_MAP_IN_PROPS==="Y"&&t){t.style.height=a+"px"}}},editPickUpMap:function(e){e.appendChild(BX.create("DIV",{props:{id:"pickUpMap"},style:{width:"100%",marginBottom:"10px"}}))},editPickUpLoader:function(e){e.appendChild(BX.create("DIV",{props:{id:"pickUpLoader",className:"text-center"},children:[BX.create("IMG",{props:{src:this.templateFolder+"/images/loader.gif"}})]}))},editPickUpList:function(e){if(!this.pickUpPagination.currentPage||!this.pickUpPagination.currentPage.length)return;BX.remove(BX("pickUpLoader"));var t=BX.create("DIV",{props:{className:"bx-soa-pickup-list main"}}),i=BX("BUYER_STORE"),s,a,r,o=false,l,n,c,p;if(i)s=i.value;l=this.pickUpBlockNode.querySelector(".bx-soa-pickup-list.recommend");if(!l)l=this.pickUpHiddenBlockNode.querySelector(".bx-soa-pickup-list.recommend");if(!l||!l.querySelector(".bx-soa-pickup-list-item.bx-selected")){n=this.getSelectedDelivery();if(n&&n.STORE){for(r=0;r<n.STORE.length;r++)if(n.STORE[r]==s)o=true}}else o=true;for(r=0;r<this.pickUpPagination.currentPage.length;r++){c=this.pickUpPagination.currentPage[r];if(c.ID==s||parseInt(s)==0||!o){s=i.value=c.ID;o=true}p=this.createPickUpItem(c,{selected:c.ID==s});t.appendChild(p)}if(!!e){a=this.pickUpHiddenBlockNode.querySelector(".bx_soa_pickup>.col");if(!a)a=this.pickUpBlockNode.querySelector(".bx_soa_pickup>.col");a.appendChild(BX.create("DIV",{props:{className:"bx-soa-pickup-subTitle"},html:this.params.MESS_PICKUP_LIST}));a.appendChild(t)}else{a=this.pickUpBlockNode.querySelector(".bx-soa-pickup-list.main");BX.insertAfter(t,a);BX.remove(a)}this.pickUpPagination.show&&this.showPagination("pickUp",t)},pickUpFinalAction:function(){var e=this.getSelectedDelivery(),t;if(e){t=this.lastSelectedDelivery!==parseInt(e.ID);this.lastSelectedDelivery=parseInt(e.ID)}if(t&&this.pickUpBlockNode.id!==this.activeSectionId){if(this.pickUpBlockNode.id!==this.activeSectionId){this.editFadePickUpContent(BX.lastChild(this.pickUpBlockNode))}BX.removeClass(this.pickUpBlockNode,"bx-step-completed")}this.maps&&this.maps.pickUpFinalAction()},getStoreInfoHtml:function(e){var t="";if(e.ADDRESS)t+=BX.message("SOA_PICKUP_ADDRESS")+": "+BX.util.htmlspecialchars(e.ADDRESS)+"<br>";if(e.PHONE)t+=BX.message("SOA_PICKUP_PHONE")+": "+BX.util.htmlspecialchars(e.PHONE)+"<br>";if(e.SCHEDULE)t+=BX.message("SOA_PICKUP_WORK")+": "+BX.util.htmlspecialchars(e.SCHEDULE)+"<br>";if(e.DESCRIPTION)t+=BX.message("SOA_PICKUP_DESC")+": "+BX.util.htmlspecialchars(e.DESCRIPTION)+"<br>";return t},createPickUpItem:function(e,t){t=t||{};var i="bx-soa-pickup-l-item-detail",s="bx-soa-pickup-l-item-btn",a,r,o,l,n;if(this.params.SHOW_STORES_IMAGES==="Y"){r=this.getImageSources(e,"IMAGE_ID");n=r&&r.src_1x||this.defaultStoreLogo;a=BX.create("IMG",{props:{src:n,className:"bx-soa-pickup-l-item-img"},events:{click:BX.delegate(function(e){this.popupShow(e,r&&r.src_orig||n)},this)}})}else{i+=" no-image";s+=" no-image"}o=this.getStoreInfoHtml(e);l=BX.create("DIV",{props:{className:"bx-soa-pickup-list-item",id:"store-"+e.ID},children:[BX.create("DIV",{props:{className:"bx-soa-pickup-l-item-adress"},children:t.distance?[BX.util.htmlspecialchars(e.ADDRESS)," ( ~"+t.distance+" "+BX.message("SOA_DISTANCE_KM")+" ) "]:[BX.util.htmlspecialchars(e.ADDRESS)]}),BX.create("DIV",{props:{className:i},children:[a,BX.create("DIV",{props:{className:"bx-soa-pickup-l-item-name"},text:e.TITLE}),BX.create("DIV",{props:{className:"bx-soa-pickup-l-item-desc"},html:o})]}),BX.create("DIV",{props:{className:s},children:[BX.create("A",{props:{href:"",className:"btn btn-sm btn-primary"},html:this.params.MESS_SELECT_PICKUP,events:{click:BX.delegate(function(e){this.selectStore(e);this.clickNextAction(e)},this)}})]})],events:{click:BX.proxy(this.selectStore,this)}});if(t.selected)BX.addClass(l,"bx-selected");return l},editPickUpRecommendList:function(e){if(!this.maps||!this.maps.canUseRecommendList()||!e){return}BX.remove(BX("pickUpLoader"));var t=BX.create("DIV",{props:{className:"bx-soa-pickup-list recommend"}}),i=BX("BUYER_STORE"),s=this.getSelectedDelivery();var a,r,o,l,n,c;var p=this.maps.getRecommendedStoreIds(e);for(a=0;a<p.length;a++){o=p[a];r=this.getPickUpInfoArray([o])[0];if(a===0&&parseInt(s.ID)!==this.lastSelectedDelivery){i.value=parseInt(o)}l=this.maps.getDistance(e,o);n=this.createPickUpItem(r,{selected:i.value===o,distance:l});t.appendChild(n);if(s.STORE_MAIN){s.STORE_MAIN.splice(s.STORE_MAIN.indexOf(o),1)}}c=this.pickUpHiddenBlockNode.querySelector(".bx_soa_pickup>.col");if(!c){c=this.pickUpBlockNode.querySelector(".bx_soa_pickup>.col")}c.appendChild(BX.create("DIV",{props:{className:"bx-soa-pickup-subTitle"},html:this.params.MESS_NEAREST_PICKUP_LIST}));c.appendChild(t)},selectStore:function(e){var t,i=BX("BUYER_STORE"),s,a,r,o,l,n,c,p;if(BX.type.isString(e)){t=BX("store-"+e);if(!t){for(r=0;r<this.pickUpPagination.pages.length;r++){l=this.pickUpPagination.pages[r];for(o=0;o<l.length;o++){if(l[o].ID==e){this.showPickUpItemsPage(++r);break}}}t=BX("store-"+e)}}else{n=e.target||e.srcElement;t=BX.hasClass(n,"bx-soa-pickup-list-item")?n:BX.findParent(n,{className:"bx-soa-pickup-list-item"})}if(t&&i){if(BX.hasClass(t,"bx-selected"))return;s=this.pickUpBlockNode.querySelector(".bx-selected");a=t.id.substr("store-".length);BX.removeClass(s,"bx-selected");c=t.clientHeight;t.style.overflow="hidden";BX.addClass(t,"bx-selected");p=t.clientHeight;t.style.height=c+"px";new BX.easing({duration:300,start:{height:c,opacity:0},finish:{height:p,opacity:100},transition:BX.easing.transitions.quad,step:function(e){t.style.height=e.height+"px"},complete:function(){t.removeAttribute("style")}}).animate();i.setAttribute("value",a);this.maps&&this.maps.selectBalloon(a)}},getDeliverySortedArray:function(e){var t=[],i=[],s=function(e,t){var i=parseInt(e.SORT)-parseInt(t.SORT);if(i===0){return e.OWN_NAME.toLowerCase()>t.OWN_NAME.toLowerCase()?1:e.OWN_NAME.toLowerCase()<t.OWN_NAME.toLowerCase()?-1:0}else{return i}},a;for(a in e){if(e.hasOwnProperty(a)){if(this.params.SHOW_NOT_CALCULATED_DELIVERIES==="L"&&e[a].CALCULATE_ERRORS){i.push(e[a])}else{t.push(e[a])}}}t.sort(s);i.sort(s);return t.concat(i)},editPropsBlock:function(e){if(!this.propsBlockNode||!this.propsHiddenBlockNode||!this.result.ORDER_PROP)return;if(e)this.editActivePropsBlock(true);else this.editFadePropsBlock();this.initialized.props=true},editActivePropsBlock:function(e){var t=e?this.propsBlockNode:this.propsHiddenBlockNode,i,s,a,r=false,o,l;if(this.initialized.props){BX.remove(BX.lastChild(t));t.appendChild(BX.firstChild(this.propsHiddenBlockNode));this.maps&&setTimeout(BX.proxy(this.maps.propsMapFocusWaiter,this.maps),200)}else{i=t.querySelector(".bx-soa-section-content");if(!i){i=this.getNewContainer();t.appendChild(i)}else BX.cleanNode(i);this.getErrorContainer(i);s=BX.create("DIV",{props:{className:"row"}});a=this.getSelectedDelivery();if(a&&this.params.SHOW_MAP_IN_PROPS==="Y"&&this.params.SHOW_MAP_FOR_DELIVERIES&&this.params.SHOW_MAP_FOR_DELIVERIES.length){for(o=0;o<this.params.SHOW_MAP_FOR_DELIVERIES.length;o++){if(parseInt(a.ID)===parseInt(this.params.SHOW_MAP_FOR_DELIVERIES[o])){r=true;break}}}this.editPropsItems(s);r&&this.editPropsMap(s);if(this.params.HIDE_ORDER_DESCRIPTION!=="Y"){this.editPropsComment(s)}i.appendChild(s);this.getBlockFooter(i);if(this.propsBlockNode.getAttribute("data-visited")==="true"){l=this.isValidPropertiesBlock(true);if(l.length)BX.addClass(this.propsBlockNode,"bx-step-error");else BX.removeClass(this.propsBlockNode,"bx-step-error")}}},editFadePropsBlock:function(){var e=this.propsBlockNode.querySelector(".bx-soa-section-content"),t;if(this.initialized.props){this.propsHiddenBlockNode.appendChild(e)}else{this.editActivePropsBlock(false);BX.remove(BX.lastChild(this.propsBlockNode))}t=this.getNewContainer();this.propsBlockNode.appendChild(t);this.editFadePropsContent(t)},editFadePropsContent:function(e){if(!e||!this.locationsInitialized)return;var t=this.propsHiddenBlockNode.querySelector(".alert"),i=this.getSelectedPersonType(),s,a,r,o,l,n,c,p;BX.cleanNode(e);if(t)e.appendChild(t.cloneNode(true));if(i){s="PROPS_FADE_LIST_"+i.ID;a=this.params[s]}if(!a||a.length===0){e.innerHTML+="<strong>"+BX.message("SOA_ORDER_PROPS")+"</strong>"}else{l=this.fadedPropertyCollection.getGroupIterator();while(r=l()){n=r.getIterator();while(o=n()){for(c=0;c<a.length;c++)if(a[c]==o.getId()&&o.getSettings()["IS_ZIP"]!="Y")this.getPropertyRowNode(o,e,true)}}}if(this.propsBlockNode.getAttribute("data-visited")==="true"){p=this.isValidPropertiesBlock();if(p.length)this.showError(this.propsBlockNode,p)}BX.bind(e.querySelector(".alert.alert-danger"),"click",BX.proxy(this.showByClick,this));BX.bind(e.querySelector(".alert.alert-warning"),"click",BX.proxy(this.showByClick,this))},editPropsItems:function(e){if(!this.result.ORDER_PROP||!this.propertyCollection)return;var t=BX.create("DIV",{props:{className:"col-sm-12 bx-soa-customer"}}),i,s,a=this.propertyCollection.getGroupIterator(),r;if(!t)t=this.propsBlockNode.querySelector(".col-sm-12.bx-soa-customer");while(i=a()){r=i.getIterator();while(s=r()){if(this.deliveryLocationInfo.loc==s.getId()||this.deliveryLocationInfo.zip==s.getId()||this.deliveryLocationInfo.city==s.getId())continue;this.getPropertyRowNode(s,t,false)}}e.appendChild(t)},getPropertyRowNode:function(e,t,i){var s=BX.create("DIV"),a="",r=e.getType()||"",o=e.getDescription()||"",l;if(i){s.innerHTML="<strong>"+BX.util.htmlspecialchars(e.getName())+":</strong> "}else{BX.addClass(s,"form-group bx-soa-customer-field");if(e.isRequired())a+='<span class="bx-authform-starrequired">*</span> ';a+=BX.util.htmlspecialchars(e.getName());if(o.length&&r!="STRING"&&r!="NUMBER"&&r!="DATE")a+=" <small>("+BX.util.htmlspecialchars(o)+")</small>";l=BX.create("LABEL",{attrs:{for:"soa-property-"+e.getId()},props:{className:"bx-soa-custom-label"},html:a});s.setAttribute("data-property-id-row",e.getId());s.appendChild(l)}switch(r){case"LOCATION":this.insertLocationProperty(e,s,i);break;case"DATE":this.insertDateProperty(e,s,i);break;case"FILE":this.insertFileProperty(e,s,i);break;case"STRING":this.insertStringProperty(e,s,i);break;case"ENUM":this.insertEnumProperty(e,s,i);break;case"Y/N":this.insertYNProperty(e,s,i);break;case"NUMBER":this.insertNumberProperty(e,s,i)}t.appendChild(s)},insertLocationProperty:function(e,t,i){var s,a,r,o,l,n,c,p,h=[];if(e.getId()in this.locations){if(i){s=this.propsHiddenBlockNode.querySelector('[data-property-id-row="'+e.getId()+'"]');if(s){a=s.querySelectorAll("div.bx-soa-loc");for(c=0;c<a.length;c++){r=this.getLocationString(a[c]);h.push(r.length?BX.util.htmlspecialchars(r):BX.message("SOA_NOT_SELECTED"))}}t.innerHTML+=h.join("<br>")}else{n=BX.create("DIV",{props:{className:"soa-property-container"}});s=this.locations[e.getId()];for(c=0;c<s.length;c++){o=s[c]?s[c].output:{};l=BX.create("DIV",{props:{className:"bx-soa-loc"},html:o.HTML});if(e.isMultiple())l.style.marginBottom=this.locationsTemplate=="search"?"5px":"20px";n.appendChild(l);for(p in o.SCRIPT){if(o.SCRIPT.hasOwnProperty(p))BX.evalGlobal(o.SCRIPT[p].JS)}}if(e.isMultiple()){n.appendChild(BX.create("DIV",{attrs:{"data-prop-id":e.getId()},props:{className:"btn btn-sm btn-primary"},text:BX.message("ADD_DEFAULT"),events:{click:BX.proxy(this.addLocationProperty,this)}}))}t.appendChild(n)}}},addLocationProperty:function(e){var t=e.target||e.srcElement,i=t.getAttribute("data-prop-id"),s=BX.previousSibling(t),a,r,o,l=0,n="sls-",c=BX.util.getRandomString(5);if(BX.hasClass(s,"bx-soa-loc")){if(this.locationsTemplate=="search"){o=s.querySelector("input[type=text][class=dropdown-field]");if(o)l=parseInt(o.name.substring(o.name.indexOf("[")+1,o.name.indexOf("]")))+1}else{o=s.querySelectorAll("input[type=hidden]");if(o.length){o=o[o.length-1];l=parseInt(o.name.substring(o.name.indexOf("[")+1,o.name.indexOf("]")))+1}}}if(this.cleanLocations[i]){a=BX.create("DIV",{props:{className:"bx-soa-loc"},style:{marginBottom:this.locationsTemplate=="search"?"5px":"20px"},html:this.cleanLocations[i].HTML.split("#key#").join(l).replace(/sls-\d{5}/g,n+c)});t.parentNode.insertBefore(a,t);BX.saleOrderAjax.addPropertyDesc({id:i+"_"+l,attributes:{id:i+"_"+l,type:"LOCATION",valueSource:"form"}});for(r in this.cleanLocations[i].SCRIPT)if(this.cleanLocations[i].SCRIPT.hasOwnProperty(r))BX.evalGlobal(this.cleanLocations[i].SCRIPT[r].JS.split("_key__").join("_"+l).replace(/sls-\d{5}/g,n+c));BX.saleOrderAjax.initDeferredControl()}},insertDateProperty:function(e,t,i){var s,a,r,o,l,n;if(i){s=this.propsHiddenBlockNode.querySelector('div[data-property-id-row="'+e.getId()+'"]');if(s){r=[];a=s.querySelectorAll("input[type=text]");for(o=0;o<a.length;o++)if(a[o].value&&a[o].value.length)r.push(a[o].value);t.innerHTML+=this.valuesToString(r)}}else{l=BX.create("DIV",{props:{className:"soa-property-container"}});e.appendTo(l);t.appendChild(l);n=l.querySelectorAll("input[type=text]");for(o=0;o<n.length;o++)this.alterDateProperty(e.getSettings(),n[o]);this.alterProperty(e.getSettings(),l);this.bindValidation(e.getId(),l)}},insertFileProperty:function(e,t,i){var s,a,r,o,l,n,c;if(i){s=this.propsHiddenBlockNode.querySelector('div[data-property-id-row="'+e.getId()+'"]');if(s){r=[];a=s.querySelectorAll("a");for(o=0;o<a.length;o++){l=a[o].innerHTML;if(l.length)r.push(l)}t.innerHTML+=this.valuesToString(r)}}else{n=this.savedFilesBlockNode.querySelector('div[data-property-id-row="'+e.getId()+'"]');if(n)c=n.querySelector("div.soa-property-container");if(c)t.appendChild(c);else{c=BX.create("DIV",{props:{className:"soa-property-container"}});e.appendTo(c);t.appendChild(c);this.alterProperty(e.getSettings(),c)}}},insertStringProperty:function(e,t,i){var s,a,r,o,l;if(i){s=this.propsHiddenBlockNode.querySelector('div[data-property-id-row="'+e.getId()+'"]');if(s){r=[];a=s.querySelectorAll("input[type=text]");if(a.length==0)a=s.querySelectorAll("textarea");if(a.length){for(o=0;o<a.length;o++){if(a[o].value.length)r.push(a[o].value)}}t.innerHTML+=this.valuesToString(r)}}else{l=BX.create("DIV",{props:{className:"soa-property-container"}});e.appendTo(l);t.appendChild(l);this.alterProperty(e.getSettings(),l);this.bindValidation(e.getId(),l)}},insertEnumProperty:function(e,t,i){var s,a,r,o,l;if(i){s=this.propsHiddenBlockNode.querySelector('div[data-property-id-row="'+e.getId()+'"]');if(s){r=[];a=s.querySelectorAll("input[type=radio]");if(a.length){for(o=0;o<a.length;o++){if(a[o].checked)r.push(a[o].nextSibling.nodeValue)}}a=s.querySelectorAll("option");if(a.length){for(o=0;o<a.length;o++){if(a[o].selected)r.push(a[o].innerHTML)}}t.innerHTML+=this.valuesToString(r)}}else{l=BX.create("DIV",{props:{className:"soa-property-container"}});e.appendTo(l);t.appendChild(l);this.bindValidation(e.getId(),l)}},insertYNProperty:function(e,t,i){var s,a,r,o,l;if(i){s=this.propsHiddenBlockNode.querySelector('div[data-property-id-row="'+e.getId()+'"]');if(s){r=[];a=s.querySelectorAll("input[type=checkbox]");for(o=0;o<a.length;o+=2)r.push(a[o].checked?BX.message("SOA_YES"):BX.message("SOA_NO"));t.innerHTML+=this.valuesToString(r)}}else{l=BX.create("DIV",{props:{className:"soa-property-container"}});e.appendTo(l);t.appendChild(l);this.alterProperty(e.getSettings(),l);this.bindValidation(e.getId(),l)}},insertNumberProperty:function(e,t,i){var s,a,r,o,l;if(i){s=this.propsHiddenBlockNode.querySelector('div[data-property-id-row="'+e.getId()+'"]');if(s){r=[];a=s.querySelectorAll("input[type=text]");for(o=0;o<a.length;o++)if(a[o].value.length)r.push(a[o].value);t.innerHTML+=this.valuesToString(r)}}else{l=BX.create("DIV",{props:{className:"soa-property-container"}});e.appendTo(l);t.appendChild(l);this.alterProperty(e.getSettings(),l);this.bindValidation(e.getId(),l)}},valuesToString:function(e){var t=e.join(", ");return t.length?BX.util.htmlspecialchars(t):BX.message("SOA_NOT_SELECTED")},alterProperty:function(e,t){var i=BX.findChildren(t,{tagName:"DIV"}),s,a,r,o,l,n,c,p;if(i&&i.length){for(s=0;s<i.length;s++){if(BX.hasClass(i[s],"bx-no-alter-margin"))continue;i[s].style.margin="5px 0"}}a=t.querySelector("input[type=text]");if(!a)a=t.querySelector("textarea");if(a){a.id="soa-property-"+e.ID;if(e.IS_ADDRESS=="Y")a.setAttribute("autocomplete","address");if(e.IS_EMAIL=="Y")a.setAttribute("autocomplete","email");if(e.IS_PAYER=="Y")a.setAttribute("autocomplete","name");if(e.IS_PHONE=="Y")a.setAttribute("autocomplete","tel");if(e.PATTERN&&e.PATTERN.length){a.removeAttribute("pattern")}}r=t.querySelectorAll("input[type=text]");for(s=0;s<r.length;s++){r[s].placeholder=e.DESCRIPTION;BX.addClass(r[s],"form-control bx-soa-customer-input bx-ios-fix")}r=t.querySelectorAll("select");for(s=0;s<r.length;s++)BX.addClass(r[s],"form-control");r=t.querySelectorAll("textarea");for(s=0;s<r.length;s++){r[s].placeholder=e.DESCRIPTION;BX.addClass(r[s],"form-control bx-ios-fix")}o=t.querySelectorAll("label");for(s=0;s<o.length;s++)BX.remove(o[s]);if(e.TYPE=="FILE"){if(e.ACCEPT&&e.ACCEPT.length){n=t.querySelectorAll("input[type=file]");c=this.getFileAccepts(e.ACCEPT);for(s=0;s<n.length;s++)n[s].setAttribute("accept",c)}p=t.querySelectorAll("a");for(s=0;s<p.length;s++){BX.bind(p[s],"click",function(e){var t=e.target||e.srcElement,i=t&&t.nextSibling&&t.nextSibling.nextSibling;if(i)BX.fireEvent(i,"change")})}}l=t.querySelectorAll("input[type=button]");for(s=0;s<l.length;s++){BX.addClass(l[s],"btn btn-primary btn-sm");if(e.MULTIPLE=="Y"&&s==l.length-1)continue;if(e.TYPE=="FILE"){BX.prepend(l[s],l[s].parentNode);l[s].style.marginRight="10px"}}if(l.length){l=l[l.length-1];BX.bind(l,"click",BX.delegate(function(i){var s=i.target||i.srcElement,a=BX.findParent(s,{tagName:"div",className:"soa-property-container"}),r=a.querySelector("label"),o=a.querySelectorAll("input[type=button]"),l=a.querySelectorAll("input[type=text]"),n=a.querySelectorAll("textarea"),c=BX.findChildren(a,{tagName:"DIV"});var p,h,d,u;if(c&&c.length){for(p=0;p<c.length;p++){c[p].style.margin="5px 0"}}this.bindValidation(e.ID,a);if(o.length&&o[o.length-2]){BX.prepend(o[o.length-2],o[o.length-2].parentNode);o[o.length-2].style.marginRight="10px";BX.addClass(o[o.length-2],"btn btn-primary btn-sm")}r&&BX.remove(r);if(l.length){l[l.length-1].placeholder=e.DESCRIPTION;BX.addClass(l[l.length-1],"form-control bx-soa-customer-input bx-ios-fix");if(e.TYPE=="DATE")this.alterDateProperty(e,l[l.length-1]);if(e.PATTERN&&e.PATTERN.length)l[l.length-1].removeAttribute("pattern")}if(n.length){n[n.length-1].placeholder=e.DESCRIPTION;BX.addClass(n[n.length-1],"form-control bx-ios-fix")}if(e.TYPE=="FILE"){if(e.ACCEPT&&e.ACCEPT.length){d=t.querySelectorAll("input[type=file]");u=this.getFileAccepts(e.ACCEPT);for(p=0;p<d.length;p++)d[p].setAttribute("accept",u)}h=a.querySelectorAll("a");BX.bind(h[h.length-1],"click",function(e){var t=e.target||e.srcElement,i=t&&t.nextSibling&&t.nextSibling.nextSibling;if(i)setTimeout(function(){BX.fireEvent(i,"change")},10)})}},this))}},alterDateProperty:function(e,t){var i=BX.findParent(t,{tagName:"DIV"}),s;BX.addClass(i,"input-group");s=BX.create("DIV",{props:{className:"input-group-append bx-no-alter-margin"},html:'<span class="input-group-text"><i class="fa fa-calendar"></i></span>'});BX.insertAfter(s,t);BX.remove(i.querySelector("input[type=button]"));BX.bind(s,"click",BX.delegate(function(t){var i=t.target||t.srcElement,s=BX.findParent(i,{tagName:"DIV",className:"input-group"});BX.calendar({node:s.querySelector(".input-group-append"),field:s.querySelector("input[type=text]").name,form:"",bTime:e.TIME==="Y",bHideTime:false})},this))},isValidForm:function(){if(!this.options.propertyValidation)return true;var e=this.isValidRegionBlock(),t=this.isValidPropertiesBlock(),i=false,s,a;if(e.length){i=true;this.animateScrollTo(this.regionBlockNode,800,50)}if(t.length&&!i){if(this.activeSectionId==this.propsBlockNode.id){s=this.propsBlockNode.querySelectorAll("div.tooltip");for(a=0;a<s.length;a++){if(s[a].getAttribute("data-state")=="opened"){this.animateScrollTo(BX.findParent(s[a],{className:"form-group bx-soa-customer-field"}),800,50);break}}}else this.animateScrollTo(this.propsBlockNode,800,50)}if(e.length){this.showError(this.regionBlockNode,e);BX.addClass(this.regionBlockNode,"bx-step-error")}if(t.length){if(this.activeSectionId!==this.propsBlockNode.id)this.showError(this.propsBlockNode,t);BX.addClass(this.propsBlockNode,"bx-step-error")}return!(e.length+t.length)},isValidRegionBlock:function(){if(!this.options.propertyValidation)return[];var e=this.orderBlockNode.querySelectorAll(".bx-soa-location-input-container[data-property-id-row]"),t=[],i,s,a,r;for(r=0;r<e.length;r++){i=e[r].getAttribute("data-property-id-row");s=this.validation.properties[i];a=this.getValidationData(s,e[r]);t=t.concat(this.isValidProperty(a,true))}return t},isValidPropertiesBlock:function(e){if(!this.options.propertyValidation)return[];var t=this.orderBlockNode.querySelectorAll(".bx-soa-customer-field[data-property-id-row]"),i=[],s,a,r,o,l;for(l=0;l<t.length;l++){s=t[l].getAttribute("data-property-id-row");if(!!e&&this.locations[s])continue;a=t[l].querySelector(".soa-property-container");if(a){r=this.validation.properties[s];o=this.getValidationData(r,a);i=i.concat(this.isValidProperty(o,true))}}return i},isValidProperty:function(e,t){var i=[],s,a;if(!e||!e.inputs)return i;for(a=0;a<e.inputs.length;a++){s=e.func(e.inputs[a],!!t);if(s.length)i[a]=s.join("<br>")}this.showValidationResult(e.inputs,i);return i},bindValidation:function(e,t){if(!this.validation.properties||!this.validation.properties[e])return;var i=this.validation.properties[e],s=this.getValidationData(i,t),a,r;if(s&&s.inputs&&s.action){for(a=0;a<s.inputs.length;a++){if(BX.type.isElementNode(s.inputs[a]))BX.bind(s.inputs[a],s.action,BX.delegate(function(){this.isValidProperty(s)},this));else for(r=0;r<s.inputs[a].length;r++)BX.bind(s.inputs[a][r],s.action,BX.delegate(function(){this.isValidProperty(s)},this))}}},getValidationData:function(e,t){if(!e||!t)return;var i={},s;switch(e.TYPE){case"STRING":i.action="change";i.func=BX.delegate(function(t,i){return this.validateString(t,e,i)},this);s=t.querySelectorAll("input[type=text]");if(s.length){i.inputs=s;break}s=t.querySelectorAll("textarea");if(s.length)i.inputs=s;break;case"LOCATION":i.func=BX.delegate(function(t,i){return this.validateLocation(t,e,i)},this);s=t.querySelectorAll("input.bx-ui-sls-fake[type=text]");if(s.length){i.inputs=s;i.action="keyup";break}s=t.querySelectorAll("div.bx-ui-slst-pool");if(s.length){i.inputs=s}break;case"Y/N":i.inputs=t.querySelectorAll("input[type=checkbox]");i.action="change";i.func=BX.delegate(function(t,i){return this.validateCheckbox(t,e,i)},this);break;case"NUMBER":i.inputs=t.querySelectorAll("input[type=text]");i.action="blur";i.func=BX.delegate(function(t,i){return this.validateNumber(t,e,i)},this);break;case"ENUM":s=t.querySelectorAll("input[type=radio]");if(!s.length)s=t.querySelectorAll("input[type=checkbox]");if(s.length){i.inputs=[s];i.action="change";i.func=BX.delegate(function(t,i){return this.validateEnum(t,e,i)},this);break}s=t.querySelectorAll("option");if(s.length){i.inputs=[s];i.action="click";i.func=BX.delegate(function(t,i){return this.validateSelect(t,e,i)},this)}break;case"FILE":i.inputs=t.querySelectorAll("input[type=file]");i.action="change";i.func=BX.delegate(function(t,i){return this.validateFile(t,e,i)},this);break;case"DATE":i.inputs=t.querySelectorAll("input[type=text]");i.action="change";i.func=BX.delegate(function(t,i){return this.validateDate(t,e,i)},this);break}return i},showErrorTooltip:function(e,t,i){if(!e||!t||!i)return;var s=BX("tooltip-"+e),a,r;i=this.uniqueText(i,"<br>");if(s){a=s.querySelector("div.tooltip-inner")}else{a=BX.create("DIV",{props:{className:"tooltip-inner"}});s=BX.create("DIV",{props:{id:"tooltip-"+e,className:"bx-soa-tooltip bx-soa-tooltip-static bx-soa-tooltip-danger tooltip top"},children:[BX.create("DIV",{props:{className:"tooltip-arrow"}}),a]});r=t.parentNode.querySelector("div.quick-locations");if(r)t=r;BX.insertAfter(s,t)}a.innerHTML=i;if(s.getAttribute("data-state")!="opened"){s.setAttribute("data-state","opened");s.style.opacity=0;s.style.display="block";new BX.easing({duration:150,start:{opacity:0},finish:{opacity:100},transition:BX.easing.transitions.quad,step:function(e){s.style.opacity=e.opacity/100}}).animate()}},closeErrorTooltip:function(e){var t=BX("tooltip-"+e);if(t){t.setAttribute("data-state","closed");new BX.easing({duration:150,start:{opacity:100},finish:{opacity:0},transition:BX.easing.transitions.quad,step:function(e){t.style.opacity=e.opacity/100},complete:function(){t.style.display="none"}}).animate()}},showValidationResult:function(e,t){if(!e||!e.length||!t)return;var i=BX.type.isElementNode(e[0])?e[0]:e[0][0],s=BX.findParent(i,{tagName:"DIV",className:"form-group"}),a=s.querySelector("label"),r,o,l;if(a)r=a.getAttribute("for");for(l=0;l<e.length;l++){o=BX.findParent(e[l],{tagName:"DIV",className:"form-group"});if(t[l]&&t[l].length)BX.addClass(o,"has-error");else BX.removeClass(o,"has-error")}if(t.length)this.showErrorTooltip(r,a,t.join("<br>"));else this.closeErrorTooltip(r)},validateString:function(e,t,i){if(!e||!t)return[];var s=e.value,a=[],r=BX.util.htmlspecialchars(t.NAME),o=!!i?BX.message("SOA_FIELD")+' "'+r+'"':BX.message("SOA_FIELD"),l;if(t.MULTIPLE==="Y")return a;if(t.REQUIRED==="Y"&&s.length===0)a.push(o+" "+BX.message("SOA_REQUIRED"));if(s.length){if(t.MINLENGTH&&t.MINLENGTH>s.length)a.push(BX.message("SOA_MIN_LENGTH")+' "'+r+'" '+BX.message("SOA_LESS")+" "+t.MINLENGTH+" "+BX.message("SOA_SYMBOLS"));if(t.MAXLENGTH&&t.MAXLENGTH<s.length)a.push(BX.message("SOA_MAX_LENGTH")+' "'+r+'" '+BX.message("SOA_MORE")+" "+t.MAXLENGTH+" "+BX.message("SOA_SYMBOLS"));if(t.IS_EMAIL==="Y"){e.value=s=BX.util.trim(s);if(s.length){l=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;if(!l.test(s)){a.push(BX.message("SOA_INVALID_EMAIL"))}}}if(s.length>0&&t.PATTERN&&t.PATTERN.length){l=new RegExp(t.PATTERN);if(!l.test(s))a.push(o+" "+BX.message("SOA_INVALID_PATTERN"))}}return a},validateLocation:function(e,t,i){if(!e||!t)return[];var s=BX.findParent(e,{tagName:"DIV",className:"form-group"}),a=this.getLocationString(s),r=[],o=!!i?BX.message("SOA_FIELD")+' "'+BX.util.htmlspecialchars(t.NAME)+'"':BX.message("SOA_FIELD");if(t.MULTIPLE=="Y"&&t.IS_LOCATION!=="Y")return r;if(t.REQUIRED=="Y"&&(a.length==0||a==BX.message("SOA_NOT_SPECIFIED")))r.push(o+" "+BX.message("SOA_REQUIRED"));return r},validateCheckbox:function(e,t,i){if(!e||!t)return[];var s=[],a=!!i?BX.message("SOA_FIELD")+' "'+BX.util.htmlspecialchars(t.NAME)+'"':BX.message("SOA_FIELD");if(t.MULTIPLE=="Y")return s;if(t.REQUIRED=="Y"&&!e.checked)s.push(a+" "+BX.message("SOA_REQUIRED"));return s},validateNumber:function(e,t,i){if(!e||!t)return[];var s=e.value,a=[],r=BX.util.htmlspecialchars(t.NAME),o=!!i?BX.message("SOA_FIELD")+' "'+r+'"':BX.message("SOA_FIELD"),l,n;if(t.MULTIPLE=="Y")return a;if(t.REQUIRED=="Y"&&s.length==0)a.push(o+" "+BX.message("SOA_REQUIRED"));if(s.length){if(!/[0-9]|\./.test(s))a.push(o+" "+BX.message("SOA_NOT_NUMERIC"));if(t.MIN&&parseFloat(t.MIN)>parseFloat(s))a.push(BX.message("SOA_MIN_VALUE")+' "'+r+'" '+parseFloat(t.MIN));if(t.MAX&&parseFloat(t.MAX)<parseFloat(s))a.push(BX.message("SOA_MAX_VALUE")+' "'+r+'" '+parseFloat(t.MAX));if(t.STEP&&parseFloat(t.STEP)>0){l=Math.abs(parseFloat(s)-(t.MIN&&parseFloat(t.MIN)>0?parseFloat(t.MIN):0));n=(l/parseFloat(t.STEP)).toPrecision(12);if(n!=parseInt(n))a.push(o+" "+BX.message("SOA_NUM_STEP")+" "+t.STEP)}}return a},validateEnum:function(e,t,i){if(!e||!t)return[];var s=[],a=[],r,o=!!i?BX.message("SOA_FIELD")+' "'+BX.util.htmlspecialchars(t.NAME)+'"':BX.message("SOA_FIELD");if(t.MULTIPLE=="Y")return a;for(r=0;r<e.length;r++)if(e[r].checked||e[r].selected)s.push(r);if(t.REQUIRED=="Y"&&s.length==0)a.push(o+" "+BX.message("SOA_REQUIRED"));return a},validateSelect:function(e,t,i){if(!e||!t)return[];var s=[],a=[],r,o=!!i?BX.message("SOA_FIELD")+' "'+BX.util.htmlspecialchars(t.NAME)+'"':BX.message("SOA_FIELD");if(t.MULTIPLE=="Y")return a;for(r=0;r<e.length;r++)if(e[r].selected)s.push(r);if(t.REQUIRED=="Y"&&s.length==0)a.push(o+" "+BX.message("SOA_REQUIRED"));return a},validateFile:function(e,t,i){if(!e||!t)return[];var s=[],a,r=e.files||[],o=!!i?BX.message("SOA_FIELD")+' "'+BX.util.htmlspecialchars(t.NAME)+'"':BX.message("SOA_FIELD"),l=e.previousSibling.value,n,c,p,h;if(t.MULTIPLE=="Y")return s;if(t.REQUIRED=="Y"&&r.length==0&&l==""&&(!t.DEFAULT_VALUE||!t.DEFAULT_VALUE.length)){s.push(o+" "+BX.message("SOA_REQUIRED"))}else{for(a=0;a<r.length;a++){n=r[a];c=BX.util.htmlspecialchars(n.name);p=n.name.split(".");h=p.length>1?p[p.length-1].toLowerCase():"";if(t.ACCEPT.length>0&&(h.length==0||t.ACCEPT.indexOf(h)=="-1"))s.push(BX.message("SOA_BAD_EXTENSION")+' "'+c+'" ('+BX.util.htmlspecialchars(t.ACCEPT)+")");if(n.size>parseInt(t.MAXSIZE))s.push(BX.message("SOA_MAX_SIZE")+' "'+c+'" ('+this.getSizeString(t.MAXSIZE,1)+")")}}return s},validateDate:function(e,t,i){if(!e||!t)return[];var s=e.value,a=[],r=BX.util.htmlspecialchars(t.NAME),o=!!i?BX.message("SOA_FIELD")+' "'+r+'"':BX.message("SOA_FIELD");if(t.MULTIPLE=="Y")return a;if(t.REQUIRED=="Y"&&s.length==0)a.push(o+" "+BX.message("SOA_REQUIRED"));return a},editPropsMap:function(e){var t=BX.create("DIV",{props:{className:"col-sm-12"},style:{marginBottom:"10px"}}),i=BX.create("DIV",{props:{id:"propsMap"},style:{width:"100%"}});t.appendChild(i);e.appendChild(t)},editPropsComment:function(e){var t,i,s,a;t=BX.create("DIV",{props:{className:"col-sm-12"}});i=BX.create("LABEL",{attrs:{for:"orderDescription"},props:{className:"bx-soa-customer-label"},html:this.params.MESS_ORDER_DESC});s=BX.create("TEXTAREA",{props:{id:"orderDescription",cols:"4",className:"form-control bx-soa-customer-textarea bx-ios-fix",name:"ORDER_DESCRIPTION"},text:this.result.ORDER_DESCRIPTION?this.result.ORDER_DESCRIPTION:""});a=BX.create("DIV",{props:{className:"form-group bx-soa-customer-field"},children:[i,s]});t.appendChild(a);e.appendChild(t)},editTotalBlock:function(){if(!this.totalInfoBlockNode||!this.result.TOTAL)return;var e=this.result.TOTAL,t,i={},s,a,r,o,l,n,c=this.params.SHOW_TOTAL_ORDER_BUTTON==="Y";BX.cleanNode(this.totalInfoBlockNode);if(parseFloat(e.ORDER_PRICE)===0){t=this.params.MESS_PRICE_FREE;i.free=true}else{t=e.ORDER_PRICE_FORMATED}if(this.options.showPriceWithoutDiscount){t+='<br><span class="bx-price-old">'+e.PRICE_WITHOUT_DISCOUNT+"</span>"}this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message("SOA_SUM_SUMMARY"),t,i));if(this.options.showOrderWeight){this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message("SOA_SUM_WEIGHT_SUM"),e.ORDER_WEIGHT_FORMATED))}if(this.options.showTaxList){for(r=0;r<e.TAX_LIST.length;r++){a=e.TAX_LIST[r].VALUE_MONEY_FORMATED||"";this.totalInfoBlockNode.appendChild(this.createTotalUnit(e.TAX_LIST[r].NAME+(!!e.TAX_LIST[r].VALUE_FORMATED?" "+e.TAX_LIST[r].VALUE_FORMATED:"")+":",a))}}i={};o=this.getSelectedDelivery();l=o&&o.CALCULATE_ERRORS&&o.CALCULATE_ERRORS.length;if(l){n=BX.message("SOA_NOT_CALCULATED");i.error=l}else{if(parseFloat(e.DELIVERY_PRICE)===0){n=this.params.MESS_PRICE_FREE;i.free=true}else{n=e.DELIVERY_PRICE_FORMATED}if(o&&typeof o.DELIVERY_DISCOUNT_PRICE!=="undefined"&&parseFloat(o.PRICE)>parseFloat(o.DELIVERY_DISCOUNT_PRICE)){n+='<br><span class="bx-price-old">'+o.PRICE_FORMATED+"</span>"}}if(this.result.DELIVERY.length){this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message("SOA_SUM_DELIVERY"),n,i))}if(this.options.showDiscountPrice){s=this.params.MESS_ECONOMY;if(e.DISCOUNT_PERCENT_FORMATED&&parseFloat(e.DISCOUNT_PERCENT_FORMATED)>0)s+=e.DISCOUNT_PERCENT_FORMATED;this.totalInfoBlockNode.appendChild(this.createTotalUnit(s+":",e.DISCOUNT_PRICE_FORMATED,{highlighted:true}))}if(this.options.showPayedFromInnerBudget){this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message("SOA_SUM_IT"),e.ORDER_TOTAL_PRICE_FORMATED));this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message("SOA_SUM_PAYED"),e.PAYED_FROM_ACCOUNT_FORMATED));this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message("SOA_SUM_LEFT_TO_PAY"),e.ORDER_TOTAL_LEFT_TO_PAY_FORMATED,{total:true}))}else{this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message("SOA_SUM_IT"),e.ORDER_TOTAL_PRICE_FORMATED,{total:true}))}if(parseFloat(e.PAY_SYSTEM_PRICE)>=0&&this.result.DELIVERY.length){this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message("SOA_PAYSYSTEM_PRICE"),"~"+e.PAY_SYSTEM_PRICE_FORMATTED))}if(!this.result.SHOW_AUTH){this.totalInfoBlockNode.appendChild(BX.create("DIV",{props:{className:"bx-soa-cart-total-button-container"+(!c?" d-block d-sm-none":"")},children:[BX.create("A",{props:{href:"javascript:void(0)",className:"btn btn-primary btn-lg btn-order-save"},html:this.params.MESS_ORDER,events:{click:BX.proxy(this.clickOrderSaveAction,this)}})]}))}this.editMobileTotalBlock()},editMobileTotalBlock:function(){if(this.result.SHOW_AUTH)BX.removeClass(this.mobileTotalBlockNode,"d-block d-sm-none");else BX.addClass(this.mobileTotalBlockNode,"d-block d-sm-none");BX.cleanNode(this.mobileTotalBlockNode);this.mobileTotalBlockNode.appendChild(this.totalInfoBlockNode.cloneNode(true));BX.bind(this.mobileTotalBlockNode.querySelector("a.bx-soa-price-not-calc"),"click",BX.delegate(function(){this.animateScrollTo(this.deliveryBlockNode)},this));BX.bind(this.mobileTotalBlockNode.querySelector("a.btn-order-save"),"click",BX.proxy(this.clickOrderSaveAction,this))},createTotalUnit:function(e,t,i){var s,a="bx-soa-cart-total-line";e=e||"";t=t||"";i=i||{};if(i.error){s=[BX.create("A",{props:{className:"bx-soa-price-not-calc"},html:t,events:{click:BX.delegate(function(){this.animateScrollTo(this.deliveryBlockNode)},this)}})]}else if(i.free){s=[BX.create("SPAN",{props:{className:"bx-soa-price-free"},html:t})]}else{s=[t]}if(i.total){a+=" bx-soa-cart-total-line-total"}if(i.highlighted){a+=" bx-soa-cart-total-line-highlighted"}return BX.create("DIV",{props:{className:a},children:[BX.create("SPAN",{props:{className:"bx-soa-cart-t"},text:e}),BX.create("SPAN",{props:{className:"bx-soa-cart-d"+(!!i.total&&this.options.totalPriceChanged?" bx-soa-changeCostSign":"")},children:s})]})},basketBlockScrollCheckEvent:function(e){var t=e.target||e.srcElement,i=t.scrollLeft,s=t.scrollWidth-(i+t.clientWidth),a=t.parentNode;if(i==0)BX.removeClass(a,"bx-soa-table-fade-left");else BX.addClass(a,"bx-soa-table-fade-left");if(s==0)BX.removeClass(a,"bx-soa-table-fade-right");else BX.addClass(a,"bx-soa-table-fade-right")},basketBlockScrollCheck:function(){var e=this.orderBlockNode.querySelectorAll("div.bx-soa-table-fade"),t,i,s,a,r,o,l,n,c=false;for(r=0;r<e.length;r++){t=e[r];s=t.querySelector("div.bx-soa-item-table");i=t.clientWidth;a=s.clientWidth||0;c=c||a>i;if(c){o=BX.firstChild(t);l=o.scrollLeft;n=o.scrollWidth-(l+o.clientWidth);if(l==0)BX.removeClass(t,"bx-soa-table-fade-left");else BX.addClass(t,"bx-soa-table-fade-left");if(n==0)BX.removeClass(t,"bx-soa-table-fade-right");else BX.addClass(t,"bx-soa-table-fade-right");if(l==0&&n==0)BX.addClass(t,"bx-soa-table-fade-right")}else BX.removeClass(t,"bx-soa-table-fade-left bx-soa-table-fade-right")}},totalBlockScrollCheck:function(){if(!this.totalInfoBlockNode||!this.totalGhostBlockNode)return;var e=BX.GetWindowScrollPos().scrollTop,t=BX.pos(this.totalGhostBlockNode).top,i=BX.pos(this.orderBlockNode).bottom,s;if(i-this.totalBlockNode.offsetHeight<e+20)BX.addClass(this.totalInfoBlockNode,"bx-soa-cart-total-bottom");else BX.removeClass(this.totalInfoBlockNode,"bx-soa-cart-total-bottom");if(e>t&&!BX.hasClass(this.totalInfoBlockNode,"bx-soa-cart-total-fixed")){s=this.totalInfoBlockNode.offsetWidth;BX.addClass(this.totalInfoBlockNode,"bx-soa-cart-total-fixed");this.totalGhostBlockNode.style.paddingTop=this.totalInfoBlockNode.offsetHeight+"px";this.totalInfoBlockNode.style.width=s+"px"}else if(e<t&&BX.hasClass(this.totalInfoBlockNode,"bx-soa-cart-total-fixed")){BX.removeClass(this.totalInfoBlockNode,"bx-soa-cart-total-fixed");this.totalGhostBlockNode.style.paddingTop=0;this.totalInfoBlockNode.style.width=""}},totalBlockResizeCheck:function(){if(!this.totalInfoBlockNode||!this.totalGhostBlockNode)return;if(BX.hasClass(this.totalInfoBlockNode,"bx-soa-cart-total-fixed"))this.totalInfoBlockNode.style.width=this.totalGhostBlockNode.offsetWidth+"px"},totalBlockFixFont:function(){var e=this.totalInfoBlockNode.querySelector(".bx-soa-cart-total-line.bx-soa-cart-total-line-total"),t,i,s=[];if(e){i=BX.lastChild(e);s.push({node:i,maxFontSize:28,smallestValue:false,scaleBy:i.parentNode})}if(this.params.SHOW_TOTAL_ORDER_BUTTON=="Y"){t=this.totalInfoBlockNode.querySelector(".bx-soa-cart-total-button-container");if(t){i=BX.lastChild(t);s.push({node:i,maxFontSize:18,smallestValue:false})}}if(s.length)BX.FixFontSize.init({objList:s,onAdaptiveResize:true})},setAnalyticsDataLayer:function(e,t){if(!this.params.DATA_LAYER_NAME)return;var i,s;var a=[],r,o;for(s in this.result.GRID.ROWS){if(this.result.GRID.ROWS.hasOwnProperty(s)){o=this.result.GRID.ROWS[s];r=[];for(s=0;s<o.data.PROPS.length;s++){r.push(o.data.PROPS[s].VALUE)}a.push({id:o.data.PRODUCT_ID,name:o.data.NAME,price:o.data.PRICE,brand:(o.data[this.params.BRAND_PROPERTY+"_VALUE"]||"").split(", ").join("/"),variant:r.join("/"),quantity:o.data.QUANTITY})}}switch(e){case"checkout":i={event:"checkout",ecommerce:{checkout:{products:a}}};break;case"purchase":i={event:"purchase",ecommerce:{purchase:{actionField:{id:t,revenue:this.result.TOTAL.ORDER_TOTAL_PRICE,tax:this.result.TOTAL.TAX_PRICE,shipping:this.result.TOTAL.DELIVERY_PRICE},products:a}}};break}window[this.params.DATA_LAYER_NAME]=window[this.params.DATA_LAYER_NAME]||[];window[this.params.DATA_LAYER_NAME].push(i)},isOrderSaveAllowed:function(){return this.orderSaveAllowed===true},allowOrderSave:function(){this.orderSaveAllowed=true},disallowOrderSave:function(){this.orderSaveAllowed=false},initUserConsent:function(){BX.ready(BX.delegate(function(){var e=BX.UserConsent&&BX.UserConsent.load(this.orderBlockNode);if(e){BX.addCustomEvent(e,BX.UserConsent.events.save,BX.proxy(this.doSaveAction,this));BX.addCustomEvent(e,BX.UserConsent.events.refused,BX.proxy(this.disallowOrderSave,this))}},this))}}})();
//# sourceMappingURL=order_ajax.map.js

Youez - 2016 - github.com/yon3zu
LinuXploit