File manager - Edit - /home/c14075/dragmet-ural.ru/www/bitrix/templates/aspro_next/components/bitrix/sale.order.ajax/v1/order_ajax.min.js
Back
BX.namespace("BX.Sale.OrderAjaxComponent"),function(){"use strict";BX.Sale&&BX.Sale.Input&&BX.Sale.Input.Utils&&(BX.Sale.Input.Utils.asMultiple=function(e){if(null==e||""===e)return[];if(e.constructor!==Array)return[e];for(var t,i=0,s=e.length;i<s;)null==(t=e[i])||""===t?(e.splice(i,1),--s):++i;return e.length?e:[""]}),BX.Sale.OrderAjaxComponent={initializePrimaryFields:function(){this.BXFormPosting=!1,this.regionBlockNotEmpty=!1,this.locationsInitialized=!1,this.locations={},this.cleanLocations={},this.locationsTemplate="",this.pickUpMapFocused=!1,this.options={},this.activeSectionId="",this.firstLoad=!0,this.initialized={},this.mapsReady=!1,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="https:"===window.location.protocol,this.orderSaveAllowed=!1,this.socServiceHiddenNode=!1,this.isDeliveryChanged=!1},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"),this.result.SHOW_AUTH&&(this.authBlockNode.style.display="",BX.addClass(this.authBlockNode,"bx-active"),this.authGenerateUser="Y"!==this.result.AUTH.new_user_registration_email_confirmation&&"Y"!==this.result.AUTH.new_user_phone_required),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=!1,this.options.pickUpMap=e.pickUpMap,this.options.propertyMap=e.propertyMap,this.options.totalPriceChanged=!1,this.result.IS_AUTHORIZED&&void 0===this.result.LAST_ORDER_DATA.FAIL||this.initFirstSection(),this.initOptions(),this.editOrder(),this.bindEvents(),this.orderBlockNode.removeAttribute("style"),this.basketBlockScrollCheck(),"Y"===this.params.USE_ENHANCED_ECOMMERCE&&this.setAnalyticsDataLayer("checkout"),"Y"===this.params.USER_CONSENT&&this.initUserConsent()},sendRequest:function(t,e){var i;this.startLoader()&&(this.firstLoad=!1,"saveOrderAjax"===(t=BX.type.isNotEmptyString(t)?t:"refreshOrderAjax")?((i=BX("bx-soa-order-form"))&&(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)})):BX.ajax({method:"POST",dataType:"json",url:this.ajaxUrl,data:this.getData(t,e),onsuccess:BX.delegate(function(e){switch(e.redirect&&e.redirect.length&&(document.location.href=e.redirect),this.saveFiles(),t){case"refreshOrderAjax":this.refreshOrder(e);break;case"confirmSmsCode":case"showAuthForm":this.firstLoad=!0,this.refreshOrder(e);break;case"enterCoupon":e&&e.order?(this.deliveryCachedInfo=[],this.refreshOrder(e)):this.addCoupon(e);break;case"removeCoupon":e&&e.order?(this.deliveryCachedInfo=[],this.refreshOrder(e)):this.removeCoupon(e)}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};return"enterCoupon"!==(i[this.params.ACTION_VARIABLE]=e)&&"removeCoupon"!==e||(i.coupon=t),i},getAllFormData:function(){var e,t=BX("bx-soa-order-form"),i=BX.ajax.prepareForm(t);for(e in i.data)i.data.hasOwnProperty(e)&&""==e&&delete i.data[e];return i&&i.data?i.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=e.order.OK_MESSAGE&&e.order.OK_MESSAGE.length||"OK"===e.order.SMS_AUTH.TYPE?"bx-step-good":"bx-step-bad";this.addAnimationEffect(this.authBlockNode,t),BX.merge(this.result,e.order),this.editAuthBlock(),this.showAuthBlock(),this.showErrors(e.order.ERROR,!1),this.animateScrollTo(this.authBlockNode)}else{if(this.isPriceChanged(e),this.isDeliveryChanged?this.isDeliveryChanged=!1:this.activeSectionId!==this.deliveryBlockNode.id&&(this.deliveryCachedInfo=[]),e.order.PAY_CURRENT_ACCOUNT&&"Y"===e.order.PAY_CURRENT_ACCOUNT){var i=this.getSelectedPaySystem();if(i){var s=i.ID;if(s&&e.order.PAY_SYSTEM)for(var a in e.order.PAY_SYSTEM)if(e.order.PAY_SYSTEM[a].ID==s){e.order.PAY_SYSTEM[a].CHECKED="Y";break}}}this.result=e.order,this.prepareLocations(e.locations),this.locationsInitialized=!1,this.maxWaitTimeExpired=!1,this.pickUpMapFocused=!1,this.deliveryLocationInfo={},this.initialized={},this.couponsCustomInitialized=!1,this.initOptions(),this.editOrder(),this.mapsReady&&this.initMaps(),BX.saleOrderAjax&&BX.saleOrderAjax.initDeferredControl(),this.totalBlockScrollCheck()}return!0},saveOrderWithJson:function(e){var t=!1;e&&e.order&&((e=e.order).REDIRECT_URL?("Y"===this.params.USE_ENHANCED_ECOMMERCE&&this.setAnalyticsDataLayer("purchase",e.ID),t=!0,location.href=e.REDIRECT_URL):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)):this.showErrors(e.ERROR,!0,!0)),t||this.handleNotRedirected()},handleNotRedirected:function(){this.endLoader(),this.disallowOrderSave()},startLoader:function(){return!0!==this.BXFormPosting&&(this.BXFormPosting=!0,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",!0)},endLoader:function(){this.BXFormPosting=!1,this.loadingScreen&&this.loadingScreen.isShown()&&this.loadingScreen.close()},htmlspecialcharsEx:function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},saveFiles:function(){if(this.result.ORDER_PROP&&this.result.ORDER_PROP.properties){var e,t,i=this.result.ORDER_PROP.properties;for(e=0;e<i.length;e++)"FILE"==i[e].TYPE&&(t=this.orderBlockNode.querySelector('div[data-property-id-row="'+i[e].ID+'"]'))&&this.savedFilesBlockNode.appendChild(t)}},animateScrollTo:function(e,t,i){if(e){var s=BX.GetWindowScrollPos().scrollTop,a=BX.pos(this.orderBlockNode),o=BX.pos(e).top-(this.isMobile?50:0);i&&(o-=parseInt(i)),o+window.innerHeight>a.bottom&&(o=a.bottom-window.innerHeight+17),new BX.easing({duration:t||800,start:{scroll:s},finish:{scroll:o},transition:BX.easing.makeEaseOut(BX.easing.transitions.quad),step:BX.delegate(function(e){window.scrollTo(0,e.scroll)},this)}).animate()}},checkKeyPress:function(e){if(13==e.keyCode){var t,i,s=e.target||e.srcElement;if(!s.getAttribute("data-send"))return(t=s.getAttribute("data-next"))&&(i=this.orderBlockNode.querySelector("input[name="+t+"]"))&&i.focus(),BX.PreventDefault(e)}},getSizeString:function(e,t){var i=1073741824,s=1048576;return e=parseInt(e),t=parseInt(t),i<e?parseFloat(e/i).toFixed(t)+" Gb":s<e?parseFloat(e/s).toFixed(t)+" Mb":1024<e?parseFloat(e/1024).toFixed(t)+" Kb":e+" B"},getFileAccepts:function(e){var t,i,s=[],a=e.split(","),o={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(t=0;t<a.length;t++)i=o[i=BX.util.trim(a[t])]||i,s.push(i);return s.join(",")},uniqueText:function(e,t){var i,s,a=[];for(i=(e=e||"").split(t=t||"<br>"),i=BX.util.array_unique(i),s=0;s<i.length;s++)""!=i[s]&&a.push(BX.util.trim(i[s]));return a.join(t)},getImageSources:function(e,t){return!!(e&&t&&e[t])&&{src_1x:e[t+"_SRC"],src_2x:e[t+"_SRC_2X"],src_orig:e[t+"_SRC_ORIGINAL"]}},getErrorContainer:function(e){e&&e.appendChild(BX.create("DIV",{props:{className:"alert alert-danger"},style:{display:"none"}}))},showError:function(e,t,i){BX.type.isArray(t)&&(t=t.join("<br>"));var s=e.querySelector(".alert.alert-danger");s&&t.length&&(BX.cleanNode(s),s.appendChild(BX.create("DIV",{html:t})),!this.hasErrorSection[e.id]?(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()):s.style.display="",i&&BX.addClass(e,"bx-step-error"))},showErrors:function(e,t,i){var s,a,o,r=this.orderBlockNode.querySelectorAll("div.alert.alert-danger");for(a=0;a<r.length;a++)s=BX.findParent(r[a],{className:"bx-soa-section"}),BX.removeClass(s,"bx-step-error"),r[a].style.display="none",BX.cleanNode(r[a]);if(e&&!(BX.util.object_keys(e).length<1)){for(a in e)if(e.hasOwnProperty(a))switch(o=e[a],a.toUpperCase()){case"MAIN":this.showError(this.mainErrorsNode,o),this.animateScrollTo(this.mainErrorsNode,800,20),t=!1;break;case"AUTH":"none"==this.authBlockNode.style.display?(this.showError(this.mainErrorsNode,o,!0),this.animateScrollTo(this.mainErrorsNode,800,20),t=!1):this.showError(this.authBlockNode,o,!0);break;case"REGION":!i&&"true"!==this.regionBlockNode.getAttribute("data-visited")||(this.showError(this.regionBlockNode,o,!0),this.showError(this.regionHiddenBlockNode,o));break;case"DELIVERY":!i&&"true"!==this.deliveryBlockNode.getAttribute("data-visited")||(this.showError(this.deliveryBlockNode,o,!0),this.showError(this.deliveryHiddenBlockNode,o));break;case"PAY_SYSTEM":!i&&"true"!==this.paySystemBlockNode.getAttribute("data-visited")||(this.showError(this.paySystemBlockNode,o,!0),this.showError(this.paySystemHiddenBlockNode,o));break;case"PROPERTY":!i&&"true"!==this.propsBlockNode.getAttribute("data-visited")||(this.showError(this.propsBlockNode,o,!0),this.showError(this.propsHiddenBlockNode,o))}t&&this.scrollToError()}},showBlockErrors:function(e){var t,i,s=e.querySelector("div.alert.alert-danger");if(s){switch(BX.removeClass(e,"bx-step-error"),s.style.display="none",BX.cleanNode(s),e.id){case this.regionBlockNode.id:t=this.regionHiddenBlockNode,i=this.result.ERROR.REGION;break;case this.deliveryBlockNode.id:t=this.deliveryHiddenBlockNode,i=this.result.ERROR.DELIVERY;break;case this.paySystemBlockNode.id:t=this.paySystemHiddenBlockNode,i=this.result.ERROR.PAY_SYSTEM;break;case this.propsBlockNode.id:t=this.propsHiddenBlockNode,i=this.result.ERROR.PROPERTY}i&&BX.util.object_keys(i).length&&(this.showError(e,i,!0),this.showError(t,i))}},checkNotifications:function(){var e,t,i,s,a,o,r=this.mainErrorsNode.querySelector('[data-type="informer"]');r&&(this.firstLoad&&this.result.IS_AUTHORIZED&&void 0===this.result.LAST_ORDER_DATA.FAIL?(i=(e=(t=this.orderBlockNode.querySelectorAll(".bx-soa-section.bx-active")).length&&"true"==t[t.length-1].getAttribute("data-visited"))?"success":"warning",s=(e?this.params.MESS_SUCCESS_PRELOAD_TEXT:this.params.MESS_FAIL_PRELOAD_TEXT).split("#ORDER_BUTTON#").join(this.params.MESS_ORDER),r.appendChild(BX.create("DIV",{props:{className:"row"},children:[BX.create("DIV",{props:{className:"col-xs-12"},style:{position:"relative",paddingLeft:"48px"},children:[BX.create("DIV",{props:{className:"icon-"+i}}),BX.create("DIV",{html:s})]})]})),BX.addClass(r,"alert alert-"+i),r.style.display=""):BX.hasClass(r,"alert")&&(a=BX.GetWindowScrollPos().scrollTop,o=BX.pos(r),new BX.easing({duration:300,start:{opacity:100},finish:{opacity:0},transition:BX.easing.transitions.linear,step:function(e){r.style.opacity=e.opacity/100},complete:function(){a>o.top&&window.scrollBy(0,-(o.height+20)),r.style.display="none",BX.cleanNode(r),r.removeAttribute("class"),r.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=!0}return t},checkBlockErrors:function(e){var t,i,s,a,o,r;if((t=BX(e.id+"-hidden"))&&(s=(i=t.querySelector("div.alert.alert-danger"))&&"none"!=i.style.display,a=t.querySelector("div.alert.alert-warning.alert-show"),!s))for(o=t.querySelectorAll("div.tooltip"),r=0;r<o.length;r++)if("opened"==o[r].getAttribute("data-state")){s=!0;break}return s?BX.addClass(e,"bx-step-error"):a?BX.addClass(e,"bx-step-warning"):BX.removeClass(e,"bx-step-error bx-step-warning"),!s},scrollToError:function(){var e,t,i=this.orderBlockNode.querySelectorAll("div.bx-soa-section.bx-active");for(e in i)if(i.hasOwnProperty(e)&&(t=i[e].querySelector(".alert.alert-danger"))&&"none"!=t.style.display){this.animateScrollTo(i[e]);break}},showWarnings:function(){var e,t,i=this.orderBlockNode.querySelectorAll("div.bx-soa-section.bx-active"),s=this.getSelectedDelivery();for(e=0;e<i.length;e++)BX.removeClass(i[e],"bx-step-warning"),"false"==i[e].getAttribute("data-visited")&&BX.removeClass(i[e],"bx-step-completed");if(s&&s.CALCULATE_ERRORS?(BX.addClass(this.deliveryBlockNode,"bx-step-warning"),t="<strong>"+this.params.MESS_DELIVERY_CALC_ERROR_TITLE+"</strong>",this.params.MESS_DELIVERY_CALC_ERROR_TEXT.length&&(t+="<br><small>"+this.params.MESS_DELIVERY_CALC_ERROR_TEXT+"</small>"),this.showBlockWarning(this.deliveryBlockNode,t),this.showBlockWarning(this.deliveryHiddenBlockNode,t),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)))):BX.hasClass(this.deliveryBlockNode,"bx-step-warning")&&this.activeSectionId!=this.deliveryBlockNode.id&&BX.removeClass(this.deliveryBlockNode,"bx-step-warning"),this.result.WARNING&&this.options.showWarnings)for(e in this.result.WARNING)if(this.result.WARNING.hasOwnProperty(e))switch(e.toUpperCase()){case"DELIVERY":"true"===this.deliveryBlockNode.getAttribute("data-visited")&&(this.showBlockWarning(this.deliveryBlockNode,this.result.WARNING[e],!0),this.showBlockWarning(this.deliveryHiddenBlockNode,this.result.WARNING[e],!0));break;case"PAY_SYSTEM":"true"===this.paySystemBlockNode.getAttribute("data-visited")&&(this.showBlockWarning(this.paySystemBlockNode,this.result.WARNING[e],!0),this.showBlockWarning(this.paySystemHiddenBlockNode,this.result.WARNING[e],!0))}},notifyAboutWarnings:function(e){if(BX.type.isDomNode(e))switch(e.id){case this.deliveryBlockNode.id:this.showBlockWarning(this.deliveryBlockNode,this.result.WARNING.DELIVERY,!0);break;case this.paySystemBlockNode.id:this.showBlockWarning(this.paySystemBlockNode,this.result.WARNING.PAY_SYSTEM,!0)}},showBlockWarning:function(e,t,i){var s,a,o,r=e.querySelector(".alert.alert-danger"),l="";if(r){if(BX.type.isString(t))l=t;else for(s in t)t.hasOwnProperty(s)&&t[s]&&(l+=t[s]+"<br>");if(!l)return;for(s in o=e.querySelectorAll(".alert.alert-warning"))if(o.hasOwnProperty(s)&&BX.type.isDomNode(o[s])&&-1!==o[s].innerHTML.indexOf(l))return;a=BX.create("DIV",{props:{className:"alert alert-warning"+(i?" alert-hide":" alert-show")},html:l}),BX.prepend(a,r.parentNode),BX.addClass(e,"bx-step-warning")}},showPagination:function(e,t){if(t&&e){var i,s,a,o,r,l,n=[];switch(e){case"delivery":i=this.deliveryPagination;break;case"paySystem":i=this.paySystemPagination;break;case"pickUp":i=this.pickUpPagination}if(1<i.pages.length){for(n.push(BX.create("LI",{attrs:{"data-action":"prev","data-entity":e},props:{className:"bx-pag-prev"},html:1==i.pageNumber?"<span>"+this.params.MESS_NAV_BACK+"</span>":'<a href=""><span>'+this.params.MESS_NAV_BACK+"</span></a>",events:{click:BX.proxy(this.doPagination,this)}})),s=0;s<i.pages.length;s++)o=(a=parseInt(s)+1)==i.pageNumber?"bx-active":"",n.push(BX.create("LI",{attrs:{"data-action":a,"data-entity":e},props:{className:o},html:'<a href=""><span>'+a+"</span></a>",events:{click:BX.proxy(this.doPagination,this)}}));n.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)}})),r=this.params.TEMPLATE_THEME||"",l=BX.create("DIV",{props:{className:"bx-pagination"+(r?" bx-"+r:"")},children:[BX.create("DIV",{props:{className:"bx-pagination-container"},children:[BX.create("UL",{children:n})]})]}),t.appendChild(BX.create("DIV",{style:{clear:"both"}})),t.appendChild(l)}}},doPagination:function(e){var t,i=e.target||e.srcElement,s="LI"==i.tagName?i:BX.findParent(i,{tagName:"LI"}),a=s.getAttribute("data-action"),o=s.getAttribute("data-entity");return BX.hasClass(s,"bx-active")||("prev"!=a&&"next"!=a||(t=parseInt(BX.findParent(s).querySelector(".bx-active").getAttribute("data-action")),a="next"==a?++t:--t),"delivery"==o?this.showDeliveryItemsPage(a):"paySystem"==o?this.showPaySystemItemsPage(a):"pickUp"==o&&this.showPickUpItemsPage(a)),BX.PreventDefault(e)},showDeliveryItemsPage:function(e){this.getCurrentPageItems("delivery",e);var t,i,s,a,o=this.getSelectedDelivery();for(o&&o.ID&&(t=(t=this.deliveryBlockNode.querySelector("input[type=hidden][name=DELIVERY_ID]"))||BX.create("INPUT",{props:{type:"hidden",name:"DELIVERY_ID",value:o.ID}})),i=this.deliveryBlockNode.querySelector(".bx-soa-pp-item-container"),BX.cleanNode(i),BX.type.isDomNode(t)&&BX.prepend(t,BX.findParent(i)),s=0;s<this.deliveryPagination.currentPage.length;s++)a=this.createDeliveryItem(this.deliveryPagination.currentPage[s]),i.appendChild(a);this.showPagination("delivery",i)},showPaySystemItemsPage:function(e){this.getCurrentPageItems("paySystem",e);var t,i,s,a,o=this.getSelectedPaySystem();for(o&&o.ID&&(t=(t=this.paySystemBlockNode.querySelector("input[type=hidden][name=PAY_SYSTEM_ID]"))||BX.create("INPUT",{props:{type:"hidden",name:"PAY_SYSTEM_ID",value:o.ID}})),i=this.paySystemBlockNode.querySelector(".bx-soa-pp-item-container"),BX.cleanNode(i),BX.type.isDomNode(t)&&BX.prepend(t,BX.findParent(i)),s=0;s<this.paySystemPagination.currentPage.length;s++)a=this.createPaySystemItem(this.paySystemPagination.currentPage[s]),i.appendChild(a);this.showPagination("paySystem",i)},showPickUpItemsPage:function(e){this.getCurrentPageItems("pickUp",e),this.editPickUpList(!1)},getCurrentPageItems:function(e,t){if(e&&void 0!==t){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}if(i&&0<s){if(t<=0||t>i.pages.length)return;i.pageNumber=t,i.currentPage=i.pages.slice(i.pageNumber-1,i.pageNumber)[0]}}},initPropsListForLocation:function(){var e,t,i,s;if(BX.saleOrderAjax&&this.result.ORDER_PROP&&this.result.ORDER_PROP.properties)for(BX.saleOrderAjax.cleanUp(),e=0;e<this.result.ORDER_PROP.properties.length;e++)if("LOCATION"==(i=this.result.ORDER_PROP.properties[e]).TYPE&&"Y"==i.MULTIPLE&&"Y"!=i.IS_LOCATION)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:"DEFAULT"==i.SOURCE?"default":"form"}});else s={id:i.ID,type:i.TYPE,valueSource:"DEFAULT"==i.SOURCE?"default":"form"},!this.deliveryLocationInfo.city&&0<parseInt(i.INPUT_FIELD_LOCATION)&&(s.altLocationPropId=parseInt(i.INPUT_FIELD_LOCATION),this.deliveryLocationInfo.city=i.INPUT_FIELD_LOCATION),this.deliveryLocationInfo.loc||"Y"!=i.IS_LOCATION||(this.deliveryLocationInfo.loc=i.ID),this.deliveryLocationInfo.zip||"Y"!=i.IS_ZIP||(s.isZip=!0,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");e.id!=this.basketBlockNode.id&&(BX.addClass(e,"bx-selected"),this.activeSectionId=e.id)},initOptions:function(){var e,t,i;if(this.initPropsListForLocation(),this.propertyCollection=new BX.Sale.PropertyCollection(BX.merge({publicMode:!0},this.result.ORDER_PROP)),this.fadedPropertyCollection=new BX.Sale.PropertyCollection(BX.merge({publicMode:!0},this.result.ORDER_PROP)),this.options.propertyValidation&&this.initValidation(),this.initPagination(),this.options.showPreviewPicInBasket=!1,this.options.showDetailPicInBasket=!1,this.options.showPropsInBasket=!1,this.options.showPriceNotesInBasket=!1,this.result.GRID&&this.result.GRID.HEADERS)for(e=this.result.GRID.HEADERS,t=0;t<e.length;t++)"PREVIEW_PICTURE"===e[t].id&&(this.options.showPreviewPicInBasket=!0),"DETAIL_PICTURE"===e[t].id&&(this.options.showDetailPicInBasket=!0),"PROPS"===e[t].id&&(this.options.showPropsInBasket=!0),"NOTES"===e[t].id&&(this.options.showPriceNotesInBasket=!0);this.result.TOTAL&&(i=this.result.TOTAL,this.options.showOrderWeight=i.ORDER_WEIGHT&&0<parseFloat(i.ORDER_WEIGHT),this.options.showPriceWithoutDiscount=parseFloat(i.ORDER_PRICE)<parseFloat(i.PRICE_WITHOUT_DISCOUNT_VALUE),this.options.showDiscountPrice=i.DISCOUNT_PRICE&&0<parseFloat(i.DISCOUNT_PRICE),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,s=this.params.YM_GOALS_COUNTER||"";"Y"==this.params.USE_YM_GOALS&&void 0!==window["yaCounter"+s]&&(i=this.getGoalId(e,t),window["yaCounter"+s].reachGoal(i))},getGoalId:function(e,t){if(!e)return"";if("initialization"==e)return this.params.YM_GOALS_INITIALIZE;if("order"==e)return this.params.YM_GOALS_SAVE_ORDER;var i="",s="edit"==e;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}return i},isPriceChanged:function(e){var t=null===this.result.TOTAL.ORDER_TOTAL_LEFT_TO_PAY||""===this.result.TOTAL.ORDER_TOTAL_LEFT_TO_PAY?this.result.TOTAL.ORDER_TOTAL_PRICE:this.result.TOTAL.ORDER_TOTAL_LEFT_TO_PAY,i=null===e.order.TOTAL.ORDER_TOTAL_LEFT_TO_PAY?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){var e,t=this.result.ORDER_PROP.properties,i={};for(e in t)t.hasOwnProperty(e)&&(i[t[e].ID]=t[e]);this.validation.properties=i}},initPagination:function(){var e,t,i,s;if(this.result.DELIVERY)if(this.result.DELIVERY=this.getDeliverySortedArray(this.result.DELIVERY),0<this.options.deliveriesPerPage&&this.result.DELIVERY.length>this.options.deliveriesPerPage){for(e=this.result.DELIVERY.slice(),t=Math.ceil(e.length/this.options.deliveriesPerPage),i=[],s=0;s<t;s++)i.push(e.splice(0,this.options.deliveriesPerPage));for(this.deliveryPagination.pages=i,s=0;s<this.result.DELIVERY.length;s++)if("Y"==this.result.DELIVERY[s].CHECKED){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=!0}else this.deliveryPagination.pageNumber=1,this.deliveryPagination.currentPage=this.result.DELIVERY,this.deliveryPagination.show=!1;if(this.result.PAY_SYSTEM)if(0<this.options.paySystemsPerPage&&this.result.PAY_SYSTEM.length>this.options.paySystemsPerPage){for(e=this.result.PAY_SYSTEM.slice(),t=Math.ceil(e.length/this.options.paySystemsPerPage),i=[],s=0;s<t;s++)i.push(e.splice(0,this.options.paySystemsPerPage));for(this.paySystemPagination.pages=i,s=0;s<this.result.PAY_SYSTEM.length;s++)if("Y"==this.result.PAY_SYSTEM[s].CHECKED){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=!0}else this.paySystemPagination.pageNumber=1,this.paySystemPagination.currentPage=this.result.PAY_SYSTEM,this.paySystemPagination.show=!1},initPickUpPagination:function(){var e,t,i,s,a=!1,o=!1,r=0;if(0<=this.options.pickUpsPerPage&&this.result.DELIVERY)for(r=0;r<this.result.DELIVERY.length;r++)if("Y"===this.result.DELIVERY[r].CHECKED&&this.result.DELIVERY[r].STORE_MAIN){o=0<this.result.DELIVERY[r].STORE_MAIN.length,a=this.result.DELIVERY[r].STORE_MAIN.length>this.options.pickUpsPerPage,o&&(e=this.getPickUpInfoArray(this.result.DELIVERY[r].STORE_MAIN));break}if(o)if(0<this.options.pickUpsPerPage&&a){for(t=e.slice(),i=Math.ceil(t.length/this.options.pickUpsPerPage),s=[],r=0;r<i;r++)s.push(t.splice(0,this.options.pickUpsPerPage));for(this.pickUpPagination.pages=s,r=0;r<e.length;r++)if(!this.result.BUYER_STORE||e[r].ID==this.result.BUYER_STORE){this.pickUpPagination.pageNumber=Math.ceil(++r/this.options.pickUpsPerPage);break}this.pickUpPagination.pageNumber||(this.pickUpPagination.pageNumber=1),this.pickUpPagination.currentPage=s.slice(this.pickUpPagination.pageNumber-1,this.pickUpPagination.pageNumber)[0],this.pickUpPagination.show=!0}else this.pickUpPagination.pageNumber=1,this.pickUpPagination.currentPage=e,this.pickUpPagination.show=!1},prepareLocations:function(e){var t,i,s,a;if(this.locations={},this.cleanLocations={},BX.util.object_keys(e).length)for(i in e)if(e.hasOwnProperty(i)){for(s in this.locationsTemplate=e[i].template||"",t=[],(a=e[i].output).clean&&(this.cleanLocations[i]=BX.processHTML(a.clean,!1),delete a.clean),a)a.hasOwnProperty(s)&&t.push({output:BX.processHTML(a[s],!1),showAlt:e[i].showAlt,lastValue:e[i].lastValue,coordinates:e[i].coordinates||!1});this.locations[i]=t}},locationsCompletion:function(){var e,t,i,s,a,o,r,l;for(e in this.locationsInitialized=!0,this.fixLocationsStyle(this.regionBlockNode,this.regionHiddenBlockNode),this.fixLocationsStyle(this.propsBlockNode,this.propsHiddenBlockNode),this.locations)this.locations.hasOwnProperty(e)&&(t=this.orderBlockNode.querySelector('div[data-property-id-row="'+e+'"]'))&&(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),i&&BX.bind(i,"click",function(e){var t,i=e.target||e.srcElement,s=BX.findParent(i,{tagName:"DIV",className:"form-group"});s&&(t=s.querySelector("input.bx-ui-sls-fake[type=text]")),t&&BX.fireEvent(t,"keyup")}),!this.firstLoad&&this.options.propertyValidation&&(s&&(o=this.validation.properties[e],r=this.getValidationData(o,t),(l=BX.findParent(t,{className:"bx-soa-section"}))&&"true"==l.getAttribute("data-visited")&&this.isValidProperty(r)),a&&BX.fireEvent(a,"keyup")));this.firstLoad&&this.result.IS_AUTHORIZED&&void 0===this.result.LAST_ORDER_DATA.FAIL?this.showActualBlock():this.result.SHOW_AUTH||this.changeVisibleContent(),this.checkNotifications(),this.activeSectionId!==this.regionBlockNode.id&&this.editFadeRegionContent(this.regionBlockNode.querySelector(".bx-soa-section-content")),this.activeSectionId!=this.propsBlockNode.id&&this.editFadePropsContent(this.propsBlockNode.querySelector(".bx-soa-section-content"))},fixLocationsStyle:function(e,t){if(e&&t){var i,s,a,o=this.activeSectionId==e.id?e:t;if(i=o.querySelectorAll("div.bx-sls div.dropdown-block.bx-ui-sls-input-block"),s=o.querySelectorAll("div.bx-slst div.dropdown-block.bx-ui-slst-input-block"),i.length)for(a=0;a<i.length;a++)BX.addClass(i[a],"form-control");if(s.length)for(a=0;a<s.length;a++)BX.addClass(s[a],"form-control")}},clickOrderSaveAction:function(e){return this.isValidForm()&&(this.allowOrderSave(),"Y"===this.params.USER_CONSENT&&BX.UserConsent?BX.onCustomEvent("bx-soa-order-save",[]):this.doSaveAction()),BX.PreventDefault(e)},doSaveAction:function(){this.isOrderSaveAllowed()&&(this.reachGoal("order"),this.sendRequest("saveOrderAjax"))},clickNextAction:function(e){var t,i=e.target||e.srcElement,s=BX.findParent(i,{className:"bx-active"}),a=this.getNextSection(s);return this.reachGoal("next",s),this.result.IS_AUTHORIZED&&void 0===this.result.LAST_ORDER_DATA.FAIL||"false"!=a.next.getAttribute("data-visited")||(t=this.orderBlockNode.querySelectorAll(".bx-soa-section.bx-active"),a.next.id==t[t.length-1].id&&this.switchOrderSaveButtons(!0)),this.fade(s,a.next),this.show(a.next),BX.PreventDefault(e)},clickPrevAction:function(e){var t=e.target||e.srcElement,i=BX.findParent(t,{className:"bx-active"}),s=this.getPrevSection(i);return this.fade(i),this.show(s.next),this.animateScrollTo(s.next,800),BX.PreventDefault(e)},showAuthBlock:function(){var e=this.authBlockNode,t=BX(this.activeSectionId);e&&!BX.hasClass(e,"bx-selected")&&(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=!1;if("Y"===this.params.SKIP_USELESS_BLOCK){if(e.id===this.pickUpBlockNode.id){var i=this.getSelectedDelivery();i&&(t=1===this.getPickUpInfoArray(i.STORE).length)}e.id===this.deliveryBlockNode.id&&(t=this.result.DELIVERY&&1===this.result.DELIVERY.length&&0===this.result.DELIVERY[0].EXTRA_SERVICES.length&&!this.result.DELIVERY[0].CALCULATE_ERRORS),e.id===this.paySystemBlockNode.id&&(t=this.result.PAY_SYSTEM&&1===this.result.PAY_SYSTEM.length&&"Y"!==this.result.PAY_FROM_ACCOUNT)}return t},getNextSection:function(e,t){if(!this.orderBlockNode||!e)return{};var i,s,a=this.orderBlockNode.querySelectorAll(".bx-soa-section.bx-active");for(s=0;s<a.length;s++)if(a[s].id===e.id&&a[s+1])return i=a[s+1],this.shouldSkipSection(i)?(this.markSectionAsCompleted(i),this.getNextSection(i,i)):{prev:e,next:i,skip:t};return{next:e}},markSectionAsCompleted:function(e){this.result.IS_AUTHORIZED&&void 0===this.result.LAST_ORDER_DATA.FAIL||"false"!==e.getAttribute("data-visited")||this.changeVisibleSection(e,!0),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,i,s=this.orderBlockNode.querySelectorAll(".bx-soa-section.bx-active");for(i=0;i<s.length;i++)if(s[i].id===e.id&&s[i-1])return t=s[i-1],this.shouldSkipSection(t)?(this.markSectionAsCompleted(t),this.getPrevSection(t)):{prev:e,next:t};return{next:e}},addAnimationEffect:function(e,t,i){e&&t&&(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(t,i){if(t&&t.id&&this.activeSectionId==t.id){this.hasErrorSection[t.id]=!1;var e,s=t.offsetHeight;switch(t.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()}if(BX.addClass(t,"bx-step-completed"),BX.removeClass(t,"bx-selected"),e=t.offsetHeight,t.style.height=s+"px",i){var a,o,r,l,n,c,p=BX.GetWindowScrollPos().scrollTop,h=BX.pos(this.orderBlockNode),d=BX.pos(t);(n=BX(i.id+"-hidden")).style.left="-10000",n.style.position="absolute",this.orderBlockNode.appendChild(n),r=i.offsetHeight,l=n.offsetHeight+57,BX(t.id+"-hidden").parentNode.appendChild(n),n.removeAttribute("style"),a=e+l-s-r,0<(c=window.innerHeight-h.height-a)?o=h.top-c/2:(o=d.top>p?d.top:d.bottom+6-s+e)+window.innerHeight>h.bottom+25+a&&(o=h.bottom+25+a-window.innerHeight),o-=this.isMobile?50:0}new BX.easing({duration:i?800:600,start:{height:s,scrollTop:p},finish:{height:e,scrollTop:o},transition:BX.easing.makeEaseOut(BX.easing.transitions.quad),step:function(e){t.style.height=e.height+"px",i&&window.scrollTo(0,e.scrollTop)},complete:function(){t.style.height=""}}).animate(),this.checkBlockErrors(t)}},show:function(e){if(e&&e.id&&this.activeSectionId!=e.id){switch(this.activeSectionId=e.id,BX.removeClass(e,"bx-step-error bx-step-warning"),e.id){case this.authBlockNode.id:this.authBlockNode.style.display="",BX.addClass(this.authBlockNode,"bx-active");break;case this.basketBlockNode.id:this.editActiveBasketBlock(!0),this.alignBasketColumns();break;case this.regionBlockNode.id:this.editActiveRegionBlock(!0);break;case this.deliveryBlockNode.id:this.editActiveDeliveryBlock(!0);break;case this.paySystemBlockNode.id:this.editActivePaySystemBlock(!0);break;case this.pickUpBlockNode.id:this.editActivePickUpBlock(!0);break;case this.propsBlockNode.id:this.editActivePropsBlock(!0)}"false"===e.getAttribute("data-visited")&&(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.GetWindowScrollPos().scrollTop;return!i||BX.hasClass(i,"bx-selected")||(this.reachGoal("edit",i),this.show(i),setTimeout(BX.delegate(function(){BX.pos(i).top<s&&this.animateScrollTo(i,300)},this),320)),BX.PreventDefault(e)},showActualBlock:function(){for(var e=this.orderBlockNode.querySelectorAll(".bx-soa-section.bx-active"),t=0;e[t];){if(e[t].id===this.regionBlockNode.id&&this.isValidRegionBlock(),e[t].id===this.propsBlockNode.id&&this.isValidPropertiesBlock(),!this.checkBlockErrors(e[t])||!this.checkPreload(e[t])){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"});a.id==this.basketBlockNode.id&&(a&&a.id.indexOf(i.id),a&&a.id.indexOf(s.id))},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");""==this.orderSaveBlockNode.style.display!=e&&e&&(t.style.opacity=0,t.style.display="",i&&(i.style.opacity=0,i.style.display=""),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,i&&(i.style.opacity=e.opacity/100),s&&(s.style.opacity=e.opacity/100)},complete:function(){t.removeAttribute("style"),i&&i.removeAttribute("style"),s&&s.removeAttribute("style")}}).animate())},shouldBeSectionVisible:function(e,t){var i,s=!1;if(!e||!e.length)return s;for(;t<e.length;t++){if("true"==e[t].getAttribute("data-visited")){s=!0;break}if(!this.firstLoad&&(i=e[t].querySelector(".bx-soa-editstep"))&&"none"!==i.style.display){s=!0;break}}return s},changeVisibleContent:function(){var e,t,i=this.orderBlockNode.querySelectorAll(".bx-soa-section.bx-active"),s=!!this.result.IS_AUTHORIZED&&"Y"===this.params.USE_PRELOAD&&!0!==this.result.LAST_ORDER_DATA.FAIL,a=!0;for(e=0;e<i.length;e++)t=(t=this.firstLoad&&s)||this.shouldBeSectionVisible(i,e),this.changeVisibleSection(i[e],t),this.firstLoad&&a&&(t&&i[e+1]&&this.checkBlockErrors(i[e])&&(s&&this.checkPreload(i[e])||!s&&this.shouldSkipSection(i[e]))?(this.fade(i[e]),this.markSectionAsCompleted(i[e]),this.show(i[e+1])):a=!1);this.result.IS_AUTHORIZED&&void 0===this.result.LAST_ORDER_DATA.FAIL||"final_step"!==this.params.SHOW_ORDER_BUTTON||this.switchOrderSaveButtons(this.shouldBeSectionVisible(i,i.length-1))},changeVisibleSection:function(e,t){var i;e.id!==this.basketBlockNode.id&&(i=e.querySelector(".bx-soa-section-content"))&&(i.style.display=t?"":"none")},editOrder:function(){if(this.orderBlockNode&&this.result){0<this.result.DELIVERY.length?(BX.addClass(this.deliveryBlockNode,"bx-active"),this.deliveryBlockNode.removeAttribute("style")):(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,t=this.orderBlockNode.querySelectorAll(".bx-soa-section.bx-active");for(e in t)t.hasOwnProperty(e)&&this.editSection(t[e]);this.editTotalBlock(),this.totalBlockFixFont(),this.showErrors(this.result.ERROR,!1),this.showWarnings()}},editSection:function(e){if(e&&e.id){this.result.SHOW_AUTH&&e.id!=this.authBlockNode.id&&e.id!=this.basketBlockNode.id?e.style.display="none":e.id!=this.pickUpBlockNode.id&&(e.style.display="");var t,i,s=e.id!=this.basketBlockNode.id||e.id==this.activeSectionId,a=e.querySelector(".bx-soa-section-title-container");switch(e.id==this.basketBlockNode.id&&(t=a.querySelector(".bx-soa-editstep"),BX.unbindAll(a),BX.unbindAll(t),this.result.SHOW_AUTH?t&&BX.bind(t,"click",BX.delegate(function(){this.animateScrollTo(this.authBlockNode),this.addAnimationEffect(this.authBlockNode,"bx-step-good")},this)):t&&BX.bind(t,"click",BX.proxy(this.showByClick,this))),i=e.querySelector(".alert.alert-danger"),this.hasErrorSection[e.id]=i&&"none"!=i.style.display,e.id){case this.authBlockNode.id:this.editAuthBlock();break;case this.basketBlockNode.id:this.editBasketBlock(s);break;case this.regionBlockNode.id:this.editRegionBlock(s);break;case this.paySystemBlockNode.id:this.editPaySystemBlock(s);break;case this.deliveryBlockNode.id:this.editDeliveryBlock(s);break;case this.pickUpBlockNode.id:this.editPickUpBlock(s);break;case this.propsBlockNode.id:this.editPropsBlock(s)}s&&e.setAttribute("data-visited","true")}},editAuthBlock:function(){if(this.authBlockNode){var e,t,i=this.authBlockNode.querySelector(".bx-soa-section-content");BX.hasClass(i,"reg")?(e=i,i=BX.firstChild(this.authHiddenBlockNode)):e=BX.firstChild(this.authHiddenBlockNode),BX.cleanNode(i),BX.cleanNode(e),this.result.SHOW_AUTH?(this.getErrorContainer(i),this.editAuthorizeForm(i),this.editSocialContent(i),this.getAuthReference(i),this.getErrorContainer(e),this.editRegistrationForm(e),this.getAuthReference(e)):(BX.onCustomEvent("OnBasketChange"),this.closeAuthBlock()),this.result.OK_MESSAGE&&this.result.OK_MESSAGE.length&&(this.toggleAuthForm({target:this.authBlockNode.querySelector("input[type=submit]")}),t=BX.create("DIV",{props:{className:"alert alert-success"},text:this.result.OK_MESSAGE.join()}),this.result.OK_MESSAGE="",BX.prepend(t,this.authBlockNode.querySelector(".bx-soa-section-content")))}},editAuthorizeForm:function(e){var t,i,s,a,o;t=this.createAuthFormInputContainer(BX.message("STOF_LOGIN"),BX.create("INPUT",{attrs:{"data-next":"USER_PASSWORD"},props:{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":!0},props:{name:"USER_PASSWORD",type:"password",value:"",maxlength:"30"},events:{keypress:BX.proxy(this.checkKeyPress,this)}})),s=BX.create("DIV",{props:{className:"bx-authform-formgroup-container"},children:[BX.create("DIV",{props:{className:"checkbox"},children:[BX.create("LABEL",{props:{className:"bx-filter-param-label"},children:[BX.create("INPUT",{props:{type:"checkbox",name:"USER_REMEMBER",value:"Y"}}),BX.create("SPAN",{props:{className:"bx-filter-param-text"},text:BX.message("STOF_REMEMBER")})]})]})]}),a=BX.create("DIV",{props:{className:"bx-authform-formgroup-container"},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-default",value:BX.message("STOF_ENTER")},events:{click:BX.delegate(function(e){return BX("do_authorize").value="Y",this.sendRequest("showAuthForm"),BX.PreventDefault(e)},this)}})]}),o=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,BX.create("A",{props:{href:this.params.PATH_TO_AUTH+"?forgot_password=yes&back_url="+encodeURIComponent(document.location.href)},text:BX.message("STOF_FORGET_PASSWORD")})]}),e.appendChild(BX.create("DIV",{props:{className:"col-md-6"},children:[o]}))},createAuthFormInputContainer:function(e,t,i){var s="";return i&&(s+='<span class="bx-authform-starrequired">*</span>'),s=e+s,BX.create("DIV",{props:{className:"bx-authform-formgroup-container"},children:[BX.create("DIV",{props:{className:"bx-authform-label-container"},html:s}),BX.create("DIV",{props:{className:"bx-authform-input-container"},children:[t]})]})},activatePhoneAuth:function(){this.result.SMS_AUTH&&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"),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){var t=[],i=this.result.SMS_AUTH&&"OK"===this.result.SMS_AUTH.TYPE;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":!0},props:{name:"SMS_CODE",type:"text",size:40,value:""},events:{keypress:BX.proxy(this.checkKeyPress,this)}}),!0)),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){return this.sendRequest("confirmSmsCode"),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"}})]}))):(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)}}),!0)),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)}}),!0)),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)}}),"Y"==this.result.AUTH.new_user_email_required)),"Y"===this.result.AUTH.new_user_phone_auth&&t.push(this.createAuthFormInputContainer(BX.message("STOF_PHONE"),BX.create("INPUT",{attrs:{"data-next":"captcha_word",autocomplete:"tel"},props:{name:"PHONE_NUMBER",type:"text",size:40,value:this.result.AUTH.PHONE_NUMBER||""},events:{keypress:BX.proxy(this.checkKeyPress,this)}}),"Y"===this.result.AUTH.new_user_phone_required)),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(){this.authBlockNode.querySelector(".generated").style.display="",this.authGenerateUser=!1},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(){this.authBlockNode.querySelector(".generated").style.display="none",this.authGenerateUser=!0},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)}}),!0),this.createAuthFormInputContainer(BX.message("STOF_PASSWORD"),BX.create("INPUT",{props:{name:"NEW_PASSWORD",type:"password",size:30},events:{keypress:BX.proxy(this.checkKeyPress,this)}}),!0),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)}}),!0)]})),"Y"==this.result.AUTH.captcha_registration&&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":!0},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){var t=BX.findChild(BX("bx-soa-auth"),{attribute:{name:"NEW_EMAIL"}},!0,!1),i=BX.findChild(BX("bx-soa-auth"),{attribute:{name:"NEW_LOGIN"}},!0,!1);return"Y"===arNextOptions.THEME.LOGIN_EQUAL_EMAIL&&i&&t&&(i.value=t.value),BX("do_register").value="Y",this.sendRequest("showAuthForm"),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){return this.toggleAuthForm(e),BX.PreventDefault(e)},this)}})]}))),e.appendChild(BX.create("DIV",{props:{className:"col-md-12"},children:[BX.create("DIV",{props:{className:"bx-authform"},children:t})]})),i&&this.activatePhoneAuth()}},editSocialContent:function(e){if(BX("bx-soa-soc-auth-services")){var t=[];if(!1===this.socServiceHiddenNode){var i=BX("bx-soa-soc-auth-services").querySelector(".bx-authform-social");BX.type.isDomNode(i)&&(this.socServiceHiddenNode=i.innerHTML,BX.remove(i))}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"}}))),"Y"===this.result.AUTH.new_user_registration&&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-default btn-lg"},text:BX.message("STOF_DO_REGISTER"),events:{click:BX.delegate(function(e){return this.toggleAuthForm(e),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-xs-12"},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){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("h2",{props:{className:"bx-soa-section-title col-xs-7 col-sm-9"},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){var e,t,i,s,a=0,o=0,r=BX.GetWindowInnerSize();if(580<r.innerWidth&&r.innerWidth<992){if(s=100,(i=this.basketBlockNode.querySelectorAll(".bx-soa-basket-info")).length){if((t=i[0].querySelectorAll(".bx-soa-item-properties")).length&&""!=t[0].style.width)return;if(0<(o=t.length))for(o=4<o?4:o,s=parseInt(s/o);a<i.length;a++)for(t=i[a].querySelectorAll(".bx-soa-item-properties"),e=0;e<t.length;e++)t[e].style.width=s+"%"}}else{if((t=this.basketBlockNode.querySelectorAll(".bx-soa-item-properties")).length&&""==t[0].style.width)return;for(;a<t.length;a++)t[a].style.width=""}}},editBasketBlock:function(e){this.basketBlockNode&&this.basketHiddenBlockNode&&this.result.GRID&&(BX.remove(BX.lastChild(this.basketBlockNode)),BX.remove(BX.lastChild(this.basketHiddenBlockNode)),this.editActiveBasketBlock(e),this.editFadeBasketBlock(e),this.initialized.basket=!0)},editActiveBasketBlock:function(e){var t,i,s=e?this.basketBlockNode:this.basketHiddenBlockNode;this.initialized.basket?(this.basketHiddenBlockNode.appendChild(BX.lastChild(s)),s.appendChild(BX.firstChild(this.basketHiddenBlockNode))):(t=s.querySelector(".bx-soa-section-content"),i=BX.create("DIV",{props:{className:"bx-soa-item-table"}}),t?BX.cleanNode(t):(t=this.getNewContainer(),s.appendChild(t)),this.editBasketItems(i,!0),t.appendChild(BX.create("DIV",{props:{className:"bx-soa-table-fade"},children:[BX.create("DIV",{style:{overflowX:"auto",overflowY:"hidden"},children:[i]})]})),"Y"===this.params.SHOW_COUPONS_BASKET&&this.editCoupons(t),this.getBlockFooter(t),BX.bind(t.querySelector("div.bx-soa-table-fade").firstChild,"scroll",BX.proxy(this.basketBlockScrollCheckEvent,this))),this.alignBasketColumns()},editFadeBasketBlock:function(e){var t,i,s=e?this.basketHiddenBlockNode:this.basketBlockNode;this.initialized.basket||(t=this.getNewContainer(),i=BX.create("DIV",{props:{className:"bx-soa-item-table"}}),this.editBasketItems(i,!1),t.appendChild(BX.create("DIV",{props:{className:"bx-soa-table-fade"},children:[BX.create("DIV",{style:{overflowX:"auto",overflowY:"hidden"},children:[i]})]})),"Y"===this.params.SHOW_COUPONS_BASKET&&this.editCoupons(t),s.appendChild(t),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){var i,s=0;for(i in"Y"===this.params.SHOW_BASKET_HEADERS&&this.editBasketItemsHeader(e),this.result.GRID.ROWS)this.result.GRID.ROWS.hasOwnProperty(i)&&this.createBasketItem(e,this.result.GRID.ROWS[i],s++,!!t)}},editBasketItemsHeader:function(e){if(e){var t,i,s=[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")})]})],a=!1,o=0;for(i=0;i<this.result.GRID.HEADERS.length;i++)"NAME"!==(t=this.result.GRID.HEADERS[i]).id&&"PREVIEW_PICTURE"!==t.id&&"PROPS"!==t.id&&"NOTES"!==t.id&&("DETAIL_PICTURE"===t.id&&!this.options.showPreviewPicInBasket||(a=BX.util.in_array(t.id,["QUANTITY","PRICE_FORMATED","DISCOUNT_PRICE_PERCENT_FORMATED","SUM"]),s.push(BX.create("DIV",{props:{className:"bx-soa-item-td bx-soa-item-properties"+(a?" bx-text-right":"")},style:{paddingBottom:"5px"},children:[BX.create("DIV",{props:{className:"bx-soa-item-td-title"},text:t.name})]})),4==++o&&this.result.GRID.HEADERS[i+1]&&(s.push(BX.create("DIV",{props:{className:"bx-soa-item-nth-4p1"}})),o=0)));e.appendChild(BX.create("DIV",{props:{className:"bx-soa-item-tr hidden-sm hidden-xs"},children:s}))}},createBasketItem:function(e,t,i,s){var a,o,r,l,n=[],c=[],p=[],h=0;for((this.options.showPreviewPicInBasket||this.options.showDetailPicInBasket)&&n.push(this.createBasketItemImg(t.data)),n.push(this.createBasketItemContent(t.data)),o=0;o<this.result.GRID.HEADERS.length;o++)"NAME"!==(a=this.result.GRID.HEADERS[o]).id&&"PREVIEW_PICTURE"!==a.id&&"PROPS"!==a.id&&"NOTES"!==a.id&&("DETAIL_PICTURE"===a.id&&!this.options.showPreviewPicInBasket||(c.push(this.createBasketItemColumn(a,t,s)),4==++h&&this.result.GRID.HEADERS[o+1]&&(c.push(BX.create("DIV",{props:{className:"bx-soa-item-nth-4p1"}})),h=0)));if(s)for(o=0;o<this.result.GRID.HEADERS_HIDDEN.length;o++)r=this.createBasketItemHiddenColumn(this.result.GRID.HEADERS_HIDDEN[o],t),BX.type.isArray(r)?p=p.concat(r):r&&p.push(r);l=[BX.create("DIV",{props:{className:"bx-soa-item-td"},style:{minWidth:"300px"},children:[BX.create("DIV",{props:{className:"bx-soa-item-block"},children:n})]})].concat(c),e.appendChild(BX.create("DIV",{props:{className:"bx-soa-item-tr bx-soa-basket-info"+(0==i?" bx-soa-item-tr-first":"")},children:l})),p.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:p})]})]})]}))},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 o=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:o},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){var t,i;if(e)return t=BX.create("DIV",{props:{className:"bx-soa-item-imgcontainer"}}),e.PREVIEW_PICTURE_SRC&&e.PREVIEW_PICTURE_SRC.length?i=this.getImageSources(e,"PREVIEW_PICTURE"):e.DETAIL_PICTURE_SRC&&e.DETAIL_PICTURE_SRC.length&&(i=this.getImageSources(e,"DETAIL_PICTURE")),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)"):(i=i&&i.src_1x||this.defaultBasketItemLogo,t.setAttribute("style","background-image: url("+i+");")),"Y"!==this.params.HIDE_DETAIL_PAGE_URL&&e.DETAIL_PAGE_URL&&e.DETAIL_PAGE_URL.length&&(t=BX.create("A",{props:{href:e.DETAIL_PAGE_URL},children:[t]})),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("Y"!==this.params.HIDE_DETAIL_PAGE_URL&&e.DETAIL_PAGE_URL&&e.DETAIL_PAGE_URL.length&&(i='<a href="'+e.DETAIL_PAGE_URL+'">'+i+"</a>"),this.options.showPropsInBasket&&s.length)for(var o in s)if(s.hasOwnProperty(o)){var r=s[o].NAME||"",l=s[o].VALUE||"";a.push(BX.create("DIV",{props:{className:"bx-soa-item-td-title"},style:{textAlign:"left"},text:r})),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){var s,a,o=t.columns[e.id]?t.columns:t.data,r=BX.util.in_array(e.id,["QUANTITY","PRICE_FORMATED","DISCOUNT_PRICE_PERCENT_FORMATED","SUM"]),l=BX.create("DIV",{props:{className:"bx-soa-item-td-text"}});if("PRICE_FORMATED"===e.id)l.appendChild(BX.create("STRONG",{props:{className:"bx-price"},html:o.PRICE_FORMATED})),0<parseFloat(o.DISCOUNT_PRICE)&&(l.appendChild(BX.create("BR")),l.appendChild(BX.create("STRONG",{props:{className:"bx-price-old"},html:o.BASE_PRICE_FORMATED}))),this.options.showPriceNotesInBasket&&i&&(l.appendChild(BX.create("BR")),l.appendChild(BX.create("SMALL",{text:o.NOTES})));else if("SUM"===e.id)l.appendChild(BX.create("STRONG",{props:{className:"bx-price all"},html:o.SUM})),0<parseFloat(o.DISCOUNT_PRICE)&&(l.appendChild(BX.create("BR")),l.appendChild(BX.create("STRONG",{props:{className:"bx-price-old"},html:o.SUM_BASE_FORMATED})));else if("DISCOUNT"===e.id)l.appendChild(BX.create("STRONG",{props:{className:"bx-price"},text:o.DISCOUNT_PRICE_PERCENT_FORMATED}));else if("DETAIL_PICTURE"===e.id)s=this.getImageSources(t.data,e.id),a=BX.create("IMG",{props:{src:s&&s.src_1x||this.defaultBasketItemLogo}}),s&&s.src_1x&&s.src_orig&&BX.bind(a,"click",BX.delegate(function(e){this.popupShow(e,s.src_orig)},this)),l.appendChild(a);else if(BX.util.in_array(e.id,["QUANTITY","WEIGHT_FORMATED","DISCOUNT_PRICE_PERCENT_FORMATED"]))l.appendChild(BX.create("SPAN",{html:o[e.id]}));else if("PREVIEW_TEXT"===e.id)"html"===o.PREVIEW_TEXT_TYPE?l.appendChild(BX.create("SPAN",{html:o.PREVIEW_TEXT||""})):l.appendChild(BX.create("SPAN",{text:o.PREVIEW_TEXT||""}));else{var n=o[e.id],c=[];if(BX.type.isArray(n)){for(var p in n)n.hasOwnProperty(p)&&("image"==n[p].type?c.push(this.getImageContainer(n[p].value,n[p].source)):"linked"==n[p].type?(l.appendChild(BX.create("SPAN",{html:n[p].value_format})),l.appendChild(BX.create("BR"))):n[p].value&&(l.appendChild(BX.create("SPAN",{html:n[p].value})),l.appendChild(BX.create("BR"))));c.length&&l.appendChild(BX.create("DIV",{props:{className:"bx-scu-list"},children:[BX.create("UL",{props:{className:"bx-scu-itemlist"},children:c})]}))}else n&&l.appendChild(BX.create("SPAN",{html:BX.util.htmlspecialchars(n)}))}return BX.create("DIV",{props:{className:"bx-soa-item-td bx-soa-item-properties"+(r?" bx-text-right":"")},children:[BX.create("DIV",{props:{className:"bx-soa-item-td-title visible-xs visible-sm"},text:e.name}),l]})}},createBasketItemHiddenColumn:function(e,t){if(e&&t){var i,s,a,o=t.columns[e.id]?t.columns:t.data,r=BX.create("TD",{props:{className:"bx-soa-info-text"}});if("PROPS"!==e.id){if("PRICE_FORMATED"===e.id)r.appendChild(BX.create("STRONG",{props:{className:"bx-price"},html:o.PRICE_FORMATED})),0<parseFloat(o.DISCOUNT_PRICE)&&(r.appendChild(BX.create("BR")),r.appendChild(BX.create("STRONG",{props:{className:"bx-price-old"},html:o.BASE_PRICE_FORMATED})));else if("SUM"===e.id)r.appendChild(BX.create("STRONG",{props:{className:"bx-price all"},text:o.SUM}));else if("DISCOUNT"===e.id)r.appendChild(BX.create("STRONG",{props:{className:"bx-price"},text:o.DISCOUNT_PRICE_PERCENT_FORMATED}));else if("DETAIL_PICTURE"===e.id||"PREVIEW_PICTURE"===e.id)i=this.getImageSources(t.data,e.id),s=BX.create("IMG",{props:{src:i&&i.src_1x||this.defaultBasketItemLogo},style:{maxWidth:"50%"}}),i&&i.src_1x&&i.src_orig&&BX.bind(s,"click",BX.delegate(function(e){this.popupShow(e,i.src_orig)},this)),r.appendChild(s);else if(BX.util.in_array(e.id,["QUANTITY","WEIGHT_FORMATED","DISCOUNT_PRICE_PERCENT_FORMATED"]))r.appendChild(BX.create("SPAN",{html:o[e.id]}));else if("PREVIEW_TEXT"===e.id)"html"===o.PREVIEW_TEXT_TYPE?r.appendChild(BX.create("SPAN",{html:o.PREVIEW_TEXT||""})):r.appendChild(BX.create("SPAN",{text:o.PREVIEW_TEXT||""}));else{var l=o[e.id],n=[];if(BX.type.isArray(l)){for(a in l)if(l.hasOwnProperty(a))if("image"==l[a].type)n.push(this.getImageContainer(l[a].value,l[a].source));else if("linked"==l[a].type)r.appendChild(BX.create("SPAN",{html:l[a].value_format})),r.appendChild(BX.create("BR"));else{if(!l[a].value)return;r.appendChild(BX.create("SPAN",{html:l[a].value})),r.appendChild(BX.create("BR"))}n.length&&r.appendChild(BX.create("DIV",{props:{className:"bx-scu-list"},children:[BX.create("UL",{props:{className:"bx-scu-itemlist"},children:n})]}))}else{if(!l)return;r.appendChild(BX.create("SPAN",{html:BX.util.htmlspecialchars(l)}))}}return BX.create("TR",{props:{className:"bx-soa-info-line"},children:[BX.create("TD",{props:{className:"bx-soa-info-title"},text:e.name+":"}),r]})}var c=[],p=t.data.PROPS;if(p&&p.length){for(a in p)if(p.hasOwnProperty(a)){var h=p[a].NAME||"",d=p[a].VALUE||"";if(0==d.length)continue;c.push(BX.create("TR",{props:{className:"bx-soa-info-line"},children:[BX.create("TD",{props:{className:"bx-soa-info-title"},text:h+":"}),BX.create("TD",{props:{className:"bx-soa-info-text"},html:BX.util.htmlspecialchars(d)})]}))}return c}}},popupShow:function(e,t,i){this.popup&&this.popup.destroy();var o=this;this.popup=new BX.PopupWindow("bx-soa-image-popup",null,{lightShadow:!0,offsetTop:0,offsetLeft:0,closeIcon:{top:"3px",right:"10px"},autoHide:!0,bindOptions:{position:"bottom"},closeByEsc:!0,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,i,s=BX.GetWindowInnerSize(),a=this.isMobile?.5:.9;BX.cleanNode(e),e.appendChild(this),t=e.offsetHeight,i=e.offsetWidth,t>s.innerHeight*a&&(e.style.height=s.innerHeight*a+"px",e.style.width=i*(s.innerHeight*a/t)+"px",t=e.offsetHeight,i=e.offsetWidth),i>s.innerWidth*a&&(e.style.width=s.innerWidth*a+"px",e.style.height=t*(s.innerWidth*a/i)+"px"),e.style.height=e.offsetHeight+"px",e.style.width=e.offsetWidth+"px",o.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(t,i){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("+t+")"}})],events:{click:BX.delegate(function(e){this.popupShow(e,t,i)},this)}})]})},editCoupons:function(e){var t=this.getCouponsList(!0),i=this.getCouponsLabel(!0),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);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)){var t,i,s=this.getCouponsList(!1);s.length&&(t=this.getCouponsLabel(!1),i=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:[t].concat(s)})]})]}),e.appendChild(BX.create("DIV",{props:{className:"bx-soa-coupon bx-soa-coupon-item-fixed"},children:[i]})))}},getCouponsList:function(e){var t,i=[];for(t=0;t<this.result.COUPON_LIST.length;t++)(e||!e&&"APPLIED"==this.result.COUPON_LIST[t].JS_STATUS)&&i.push(this.getCouponNode({text:this.result.COUPON_LIST[t].COUPON,desc:this.result.COUPON_LIST[t].JS_CHECK_CODE,status:this.result.COUPON_LIST[t].JS_STATUS},e));return i},getCouponNode:function(e,t){var i,s,a=BX.util.htmlspecialchars(e.text)||"",o=e.desc&&e.desc.length?e.desc.charAt(0).toUpperCase()+e.desc.slice(1):BX.message("SOA_NOT_FOUND");switch((e.status||"BAD").toUpperCase()){case"ENTERED":i="used",s="warning";break;case"BAD":i=s="danger";break;default:i=s="success"}return BX.create("STRONG",{attrs:{"data-coupon":a,className:"bx-soa-coupon-item-"+i},children:t?[a||"",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"});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-"+s+" tooltip top"},children:[BX.create("SPAN",{props:{className:"tooltip-arrow"}}),BX.create("SPAN",{props:{className:"tooltip-inner"},text:o})]})]:[a]})},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){for(var t=this.orderBlockNode.querySelectorAll(".bx-soa-coupon:not(.bx-soa-coupon-item-fixed) .bx-soa-coupon-item"),i=0;i<t.length&&!t[i].querySelector('[data-coupon="'+BX.util.htmlspecialchars(e)+'"]');i++)t[i].appendChild(this.getCouponNode({text:e},!0,"bx-soa-coupon-item-danger"))},removeCoupon:function(e){var t,i=this.orderBlockNode.querySelectorAll('[data-coupon="'+BX.util.htmlspecialchars(e)+'"]');for(t in i)i.hasOwnProperty(t)&&BX.remove(i[t])},editRegionBlock:function(e){this.regionBlockNode&&this.regionHiddenBlockNode&&this.result.PERSON_TYPE&&(e?(this.editActiveRegionBlock(!0),this.regionBlockNotEmpty||this.editFadeRegionBlock()):this.editFadeRegionBlock(),this.initialized.region=!0)},editActiveRegionBlock:function(e){var t,i,s,a=e?this.regionBlockNode:this.regionHiddenBlockNode;this.initialized.region||((t=a.querySelector(".bx-soa-section-content"))?BX.cleanNode(t):(t=this.getNewContainer(),a.appendChild(t)),this.getErrorContainer(t),i=BX.create("DIV",{props:{className:"bx_soa_location row"}}),s=BX.create("DIV",{props:{className:"col-xs-12"}}),this.getPersonTypeControl(s),this.getProfilesControl(s),this.getDeliveryLocationInput(s),this.result.SHOW_AUTH||(this.regionBlockNotEmpty?(BX.addClass(this.regionBlockNode,"bx-active"),this.regionBlockNode.style.display=""):(BX.removeClass(this.regionBlockNode,"bx-active"),this.regionBlockNode.style.display="none",this.result.IS_AUTHORIZED&&void 0===this.result.LAST_ORDER_DATA.FAIL||this.initFirstSection())),i.appendChild(s),t.appendChild(i),this.getBlockFooter(t))},editFadeRegionBlock:function(){var e;this.regionBlockNode.querySelector(".bx-soa-section-content");this.initialized.region||(this.editActiveRegionBlock(!1),BX.remove(BX.lastChild(this.regionBlockNode))),e=this.getNewContainer(!0),this.regionBlockNode.appendChild(e),this.editFadeRegionContent(e)},editFadeRegionContent:function(e){if(e&&this.locationsInitialized){this.getSelectedPersonType();var t=this.regionHiddenBlockNode.querySelector(".alert.alert-danger");t&&e.appendChild(t.cloneNode(!0)),"true"==this.regionBlockNode.getAttribute("data-visited")&&(this.isValidRegionBlock().length?BX.addClass(this.regionBlockNode,"bx-step-error"):BX.removeClass(this.regionBlockNode,"bx-step-error"))}},getSelectedPersonType:function(){var e,t,i,s,a=this.result.PERSON_TYPE.length;if(e=1==a?(e=this.regionBlockNode.querySelector("input[type=hidden][name=PERSON_TYPE]"))||this.regionHiddenBlockNode.querySelector("input[type=hidden][name=PERSON_TYPE]"):2==a?(e=this.regionBlockNode.querySelector("input[type=radio][name=PERSON_TYPE]:checked"))||this.regionHiddenBlockNode.querySelector("input[type=radio][name=PERSON_TYPE]:checked"):(e=this.regionBlockNode.querySelector("select[name=PERSON_TYPE] > option:checked"))||this.regionHiddenBlockNode.querySelector("select[name=PERSON_TYPE] > option:checked"))for(s in i=e.value,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,o,r,l,n,c,p,h,d,u;for(o in this.result.ORDER_PROP.properties)if(this.result.ORDER_PROP.properties.hasOwnProperty(o)&&"Y"==(t=this.result.ORDER_PROP.properties[o]).IS_LOCATION){i=t.ID,s=parseInt(t.INPUT_FIELD_LOCATION);break}if((a=this.locations[i])&&a[0]&&a[0].output)for(o in this.regionBlockNotEmpty=!0,l='<label class="bx-soa-custom-label" for="soa-property-'+parseInt(i)+'">'+("Y"==t.REQUIRED?'<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}})),n.SCRIPT)n.SCRIPT.hasOwnProperty(o)&&BX.evalGlobal(n.SCRIPT[o].JS);if(a&&a[0]&&a[0].showAlt&&0<s)for(o in this.result.ORDER_PROP.properties)if(parseInt(this.result.ORDER_PROP.properties[o].ID)==s){r=this.result.ORDER_PROP.properties[o];break}r&&(u=BX.create("DIV",{attrs:{"data-property-id-row":r.ID},props:{className:"form-group bx-soa-location-input-container"}}),p="Y"==r.REQUIRED?'<span class="bx-authform-starrequired">*</span> ':"",p+=BX.util.htmlspecialchars(r.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:r.DESCRIPTION,autocomplete:"city",className:"form-control bx-soa-customer-input bx-ios-fix",name:"ORDER_PROP_"+r.ID,value:r.VALUE}}),u.appendChild(h),u.appendChild(d),e.appendChild(u),this.bindValidation(r.ID,u)),this.getZipLocationInput(e),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,i,s,a=e.querySelector(".bx-ui-sls-route"),o="";if(a&&a.value&&a.value.length)o=a.value;else{for(i=(t=e.querySelectorAll(".bx-ui-combobox-fake.bx-combobox-fake-as-input")).length;i--;)0<=t[i].innerHTML.indexOf("...")||(0<=t[i].innerHTML.indexOf("---")?(s=BX("altProperty"))&&s.value.length&&(o+=s.value):(o.length&&(o+=", "),o+=t[i].innerHTML));0==o.length&&(o=BX.message("SOA_NOT_SPECIFIED"))}return o},getZipLocationInput:function(e){var t,i,s,a,o,r;for(i in this.result.ORDER_PROP.properties)if(this.result.ORDER_PROP.properties.hasOwnProperty(i)&&"Y"==this.result.ORDER_PROP.properties[i].IS_ZIP){t=this.result.ORDER_PROP.properties[i];break}t&&(this.regionBlockNotEmpty=!0,(s=BX.create("DIV",{props:{className:"form-group bx-soa-location-input-container"}})).setAttribute("data-property-id-row",t.ID),a="Y"==t.REQUIRED?'<span class="bx-authform-starrequired">*</span> ':"",a+=BX.util.htmlspecialchars(t.NAME),o=BX.create("LABEL",{attrs:{for:"zipProperty"},props:{className:"bx-soa-custom-label"},html:a}),r=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(o),s.appendChild(r),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(t in e)e.hasOwnProperty(t)&&i.push(e[t]);return i.sort(function(e,t){return parseInt(e.SORT)-parseInt(t.SORT)})},getPersonTypeControl:function(e){if(this.result.PERSON_TYPE){this.result.PERSON_TYPE=this.getPersonTypeSortedArray(this.result.PERSON_TYPE);var t,i,s,a,o,r=this.result.PERSON_TYPE.length,l=[],n=!1;if(1<r&&(a=BX.create("DIV",{props:{className:"form-group"},children:[BX.create("BR")]}),e.appendChild(a),e=a),2<r){for(s in this.result.PERSON_TYPE)this.result.PERSON_TYPE.hasOwnProperty(s)&&(t=this.result.PERSON_TYPE[s],l.push(BX.create("OPTION",{props:{value:t.ID,selected:"Y"==t.CHECKED},text:t.NAME})),"Y"==t.CHECKED&&(i=t.ID));e.appendChild(BX.create("SELECT",{props:{name:"PERSON_TYPE",className:"form-control"},children:l,events:{change:BX.proxy(this.sendRequest,this)}})),this.regionBlockNotEmpty=!0}else if(2==r){for(s in this.result.PERSON_TYPE)this.result.PERSON_TYPE.hasOwnProperty(s)&&(t=this.result.PERSON_TYPE[s],o=BX.create("LABEL",{children:[BX.create("INPUT",{attrs:{checked:"Y"==t.CHECKED},props:{type:"radio",name:"PERSON_TYPE",value:t.ID}}),BX.util.htmlspecialchars(t.NAME)],events:{change:BX.proxy(this.sendRequest,this)}}),n&&e.appendChild(BX.create("BR")),e.appendChild(BX.create("DIV",{props:{className:"radio-inline"},children:[o]})),n=!0,"Y"==t.CHECKED&&(i=t.ID));this.regionBlockNotEmpty=!0}else for(s in this.result.PERSON_TYPE)this.result.PERSON_TYPE.hasOwnProperty(s)&&e.appendChild(BX.create("INPUT",{props:{type:"hidden",name:"PERSON_TYPE",value:this.result.PERSON_TYPE[s].ID}}));i&&e.appendChild(BX.create("INPUT",{props:{type:"hidden",name:"PERSON_TYPE_OLD",value:i}}))}},getProfilesControl:function(e){var t,i,s,a,o=BX.util.object_keys(this.result.USER_PROFILES).length,r=[];if(o)if("Y"===this.params.ALLOW_USER_PROFILES&&(1<o||"Y"===this.params.ALLOW_NEW_PROFILE)){for(t in this.regionBlockNotEmpty=!0,i=BX.create("LABEL",{props:{className:"bx-soa-custom-label"},html:this.params.MESS_SELECT_PROFILE}),this.result.USER_PROFILES)this.result.USER_PROFILES.hasOwnProperty(t)&&r.unshift(BX.create("OPTION",{props:{value:this.result.USER_PROFILES[t].ID,selected:"Y"===this.result.USER_PROFILES[t].CHECKED},html:this.result.USER_PROFILES[t].NAME}));"Y"===this.params.ALLOW_NEW_PROFILE&&r.unshift(BX.create("OPTION",{props:{value:0},text:BX.message("SOA_PROP_NEW_PROFILE")})),s=BX.create("INPUT",{props:{type:"hidden",value:"N",id:"profile_change",name:"profile_change"}}),a=BX.create("SELECT",{props:{className:"form-control",name:"PROFILE_ID"},children:r,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:[i,s,a]}))}else for(t in this.result.USER_PROFILES)this.result.USER_PROFILES.hasOwnProperty(t)&&"Y"===this.result.USER_PROFILES[t].CHECKED&&e.appendChild(BX.create("INPUT",{props:{name:"PROFILE_ID",type:"hidden",value:this.result.USER_PROFILES[t].ID}}))},editPaySystemBlock:function(e){this.paySystemBlockNode&&this.paySystemHiddenBlockNode&&this.result.PAY_SYSTEM&&(e?this.editActivePaySystemBlock(!0):this.editFadePaySystemBlock(),this.initialized.paySystem=!0)},editActivePaySystemBlock:function(e){var t,i,s=e?this.paySystemBlockNode:this.paySystemHiddenBlockNode;if(this.initialized.paySystem);else{if((t=s.querySelector(".bx-soa-section-content"))?BX.cleanNode(t):(t=this.getNewContainer(),s.appendChild(t)),this.getErrorContainer(t),i=BX.create("DIV",{props:{className:"bx-soa-pp row"}}),this.editPaySystemItems(i),t.appendChild(i),this.editPaySystemInfo(i),"Y"==this.params.SHOW_COUPONS_PAY_SYSTEM&&(this.editCoupons(t),!this.couponsCustomInitialized)){var a=BX.findChildren(BX("bx-soa-coupon"),{className:"bx-soa-section-content"});a&&a.length&&(BX.cleanNode(a[0]),this.editCoupons(a[0]),this.couponsCustomInitialized=!0)}this.getBlockFooter(t)}},editFadePaySystemBlock:function(){var e;this.paySystemBlockNode.querySelector(".bx-soa-section-content");this.initialized.paySystem||(this.editActivePaySystemBlock(!1),BX.remove(BX.lastChild(this.paySystemBlockNode))),e=this.getNewContainer(!0),this.paySystemBlockNode.appendChild(e),this.editFadePaySystemContent(e),"Y"==this.params.SHOW_COUPONS_PAY_SYSTEM&&this.editCoupons(e)},editPaySystemItems:function(e){if(this.result.PAY_SYSTEM&&!(this.result.PAY_SYSTEM.length<=0)){var t,i,s=BX.create("DIV",{props:{className:"col-sm-12 bx-soa-pp-item-container"}}),a=BX.create("DIV",{props:{className:"col-sm-12 bx-soa-pp-company-description"}});for(i=0;i<this.paySystemPagination.currentPage.length;i++)t=this.createPaySystemItem(this.paySystemPagination.currentPage[i]),s.appendChild(t),"Y"==this.paySystemPagination.currentPage[i].CHECKED&&(a.innerHTML=this.paySystemPagination.currentPage[i].DESCRIPTION);this.paySystemPagination.show&&this.showPagination("paySystem",s),e.appendChild(s),e.appendChild(a)}},createPaySystemItem:function(e){var t,i,s,a,o="Y"==e.CHECKED,r=parseInt(e.ID);return i=BX.create("DIV",{props:{className:"bx-soa-pp-company-graf-container"},children:[BX.create("INPUT",{props:{id:"ID_PAY_SYSTEM_ID_"+r,name:"PAY_SYSTEM_ID",type:"checkbox",className:"bx-soa-pp-company-checkbox",value:r,checked:o}})]}),"Y"==this.params.SHOW_PAY_SYSTEM_LIST_NAMES&&(t=BX.create("DIV",{props:{className:"bx-soa-pp-company-smalltitle"},text:e.NAME})).setAttribute("lang","ru"),a=BX.create("DIV",{props:{className:"bx-soa-pp-company-inject clearfix hidden"},html:""}),(s=BX.create("DIV",{props:{className:"bx-soa-pp-company bx-soa-pp-company-item col-lg-4 col-sm-4 col-xs-6"},children:[i,t,a],events:{click:BX.proxy(this.selectPaySystem,this)}})).setAttribute("data-id",e.ID),o&&BX.addClass(s,"bx-selected"),s},editPaySystemInfo:function(e){if(this.result.PAY_SYSTEM&&(0!=this.result.PAY_SYSTEM.length||"Y"==this.result.PAY_FROM_ACCOUNT)){var t,i,s,a=BX.create("DIV",{props:{className:(0==this.result.PAY_SYSTEM.length?"col-sm-12":"col-sm-5")+" bx-soa-pp-desc-container"}});BX.cleanNode(a),"Y"==this.result.PAY_FROM_ACCOUNT&&(t=this.getInnerPaySystem(a)),s=this.getSelectedPaySystem(),a.appendChild(BX.create("DIV",{props:{className:"bx-soa-pp-company"},children:[t,i,void 0]}));var o=BX.findChildren(this.paySystemBlockNode,{className:"bx-soa-pp-company-inject"},!0);if(o&&o.length)for(var r=0;r<o.length;++r)BX.addClass(o[r],"hidden"),BX.cleanNode(o[r]);if(s)if((e=BX.findChildren(this.paySystemBlockNode,{className:"bx-soa-pp-company",attribute:{"data-id":s.ID}},!0))&&e.length){var l=BX.findChildren(e[0],{className:"bx-soa-pp-company-inject"},!0);l&&l.length&&(BX.cleanNode(l[0]),l[0].appendChild(a),BX.removeClass(l[0],"hidden"))}}},getInnerPaySystem:function(){if(this.result.CURRENT_BUDGET_FORMATED&&this.result.PAY_CURRENT_ACCOUNT&&this.result.INNER_PAY_SYSTEM){this.params.ONLY_FULL_PAY_FROM_ACCOUNT&&this.params.ONLY_FULL_PAY_FROM_ACCOUNT;var e,t,i,s=this.result.PAY_CURRENT_ACCOUNT&&"Y"==this.result.PAY_CURRENT_ACCOUNT,a=this.result.INNER_PAY_SYSTEM;return(t=BX.create("LABEL",{props:{className:"bx-soa-pp-company-subTitle"+(s?" checked":"")},text:a.NAME})).appendChild(BX.create("INPUT",{props:{type:"checkbox",className:"bx-soa-pp-company-checkbox",name:"PAY_CURRENT_ACCOUNT",value:"Y",checked:s}})),i=BX.util.htmlspecialchars(this.params.MESS_INNER_PS_BALANCE+" "+this.result.CURRENT_BUDGET_FORMATED),t.setAttribute("title",i),e=BX.create("DIV",{props:{className:"checkbox"+(s?" checked":"")},children:[t]}),BX.create("DIV",{props:{className:"bx-soa-pp-inner-ps"+(s?" bx-selected":"")},children:[e]})}},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");i?e.appendChild(i.cloneNode(!0)):this.getErrorContainer(e),s&&s.innerHTML&&e.appendChild(s.cloneNode(!0)),this.isSelectedInnerPayment()||t&&t.NAME||(addedHtml="<strong>"+BX.message("SOA_PS_SELECT_ERROR")+"</strong>")},getSelectedPaySystem:function(){var e,t,i=this.paySystemBlockNode.querySelector("input[type=checkbox][name=PAY_SYSTEM_ID]:checked"),s=null;if(i=(i=i||this.paySystemHiddenBlockNode.querySelector("input[type=checkbox][name=PAY_SYSTEM_ID]:checked"))||this.paySystemHiddenBlockNode.querySelector("input[type=hidden][name=PAY_SYSTEM_ID]"))for(e=i.value,t=0;t<this.result.PAY_SYSTEM.length;t++)if(this.result.PAY_SYSTEM[t].ID==e){s=this.result.PAY_SYSTEM[t];break}return s},isSelectedInnerPayment:function(){var e=this.paySystemBlockNode.querySelector("input[type=checkbox][name=PAY_CURRENT_ACCOUNT]");return(e=e||this.paySystemHiddenBlockNode.querySelector("input[type=checkbox][name=PAY_CURRENT_ACCOUNT]"))&&e.checked},selectPaySystem:function(e){if(this.orderBlockNode&&e){var t,i=e.target||e.srcElement,s=this.paySystemBlockNode.querySelector("div.bx-soa-pp-inner-ps"),a=this.paySystemBlockNode.querySelector("input[type=checkbox][name=PAY_CURRENT_ACCOUNT]"),o=this.result.TOTAL&&0===parseFloat(this.result.TOTAL.ORDER_TOTAL_LEFT_TO_PAY),r=BX.hasClass(i,"bx-soa-pp-inner-ps")?i:BX.findParent(i,{className:"bx-soa-pp-inner-ps"}),l=BX.hasClass(i,"bx-soa-pp-company")?i:BX.findParent(i,{className:"bx-soa-pp-company"});if(r)"INPUT"==i.nodeName&&(a.checked=!a.checked),a.checked?(BX.removeClass(s,"bx-selected"),a.checked=!1):(BX.addClass(s,"bx-selected"),a.checked=!0);else if(l){if(BX.hasClass(l,"bx-selected"))return BX.PreventDefault(e);a&&a.checked&&o?(BX.addClass(l,"bx-selected"),l.querySelector("input[type=checkbox]").checked=!0,BX.removeClass(s,"bx-selected"),a.checked=!1):(t=this.paySystemBlockNode.querySelector(".bx-soa-pp-company.bx-selected"),BX.addClass(l,"bx-selected"),l.querySelector("input[type=checkbox]").checked=!0,t&&(BX.removeClass(t,"bx-selected"),t.querySelector("input[type=checkbox]").checked=!1))}this.sendRequest()}},editDeliveryBlock:function(e){this.deliveryBlockNode&&this.deliveryHiddenBlockNode&&this.result.DELIVERY&&(e?this.editActiveDeliveryBlock(!0):this.editFadeDeliveryBlock(),this.checkPickUpShow(),this.initialized.delivery=!0)},editActiveDeliveryBlock:function(e){var t,i,s=e?this.deliveryBlockNode:this.deliveryHiddenBlockNode;if(this.initialized.delivery);else{if((t=s.querySelector(".bx-soa-section-content"))?BX.cleanNode(t):(t=this.getNewContainer(),s.appendChild(t)),this.getErrorContainer(t),i=BX.create("DIV",{props:{className:"bx-soa-pp row"}}),this.editDeliveryItems(i),t.appendChild(i),this.editDeliveryInfo(i),"Y"==this.params.SHOW_COUPONS_DELIVERY&&(this.editCoupons(t),!this.couponsCustomInitialized)){var a=BX.findChildren(BX("bx-soa-coupon"),{className:"bx-soa-section-content"});a&&a.length&&(BX.cleanNode(a[0]),this.editCoupons(a[0]),this.couponsCustomInitialized=!0)}this.getBlockFooter(t)}},editDeliveryItems:function(e){if(this.result.DELIVERY&&!(this.result.DELIVERY.length<=0)){var t,i,s=BX.create("DIV",{props:{className:"col-sm-12 bx-soa-pp-item-container"}});for(i=0;i<this.deliveryPagination.currentPage.length;i++)t=this.createDeliveryItem(this.deliveryPagination.currentPage[i]),s.appendChild(t);this.deliveryPagination.show&&this.showPagination("delivery",s),e.appendChild(s)}},editDeliveryInfo:function(e){if(this.result.DELIVERY){var t,i,s,a,o,r=BX.create("DIV",{props:{className:"col-sm-5 bx-soa-pp-desc-container"}});BX.cleanNode(r),t=this.getSelectedDelivery(),i=BX.create("DIV",{props:{className:"bx-soa-pp-company-block"},children:[BX.create("DIV",{props:{className:"bx-soa-pp-company-desc"},html:""})]}),s=BX.create("DIV",{style:{clear:"both"}}),(a=this.getDeliveryExtraServices(t)).length&&(o=BX.create("DIV",{props:{className:"bx-soa-pp-company-block"},children:a})),r.appendChild(BX.create("DIV",{props:{className:"bx-soa-pp-company"},children:[i,s,o]}));var l=BX.findChildren(this.deliveryBlockNode,{className:"bx-soa-pp-company-inject"},!0);if(l&&l.length)for(var n=0;n<l.length;++n)BX.addClass(l[n],"hidden"),BX.cleanNode(l[n]);if((e=BX.findChildren(this.deliveryBlockNode,{className:"bx-soa-pp-company",attribute:{"data-id":t.ID}},!0))&&e.length){var c=BX.findChildren(e[0],{className:"bx-soa-pp-company-inject"},!0);c&&c.length&&(BX.cleanNode(c[0]),c[0].appendChild(r),BX.removeClass(c[0],"hidden"))}"Y"!=this.params.DELIVERY_NO_AJAX&&(this.deliveryCachedInfo[t.ID]=t)}},getDeliveryPriceNodes:function(e){return void 0!==e.DELIVERY_DISCOUNT_PRICE&&parseFloat(e.DELIVERY_DISCOUNT_PRICE)!=parseFloat(e.PRICE)?parseFloat(e.DELIVERY_DISCOUNT_PRICE)>parseFloat(e.PRICE)?[e.DELIVERY_DISCOUNT_PRICE_FORMATED]:[e.DELIVERY_DISCOUNT_PRICE_FORMATED,BX.create("BR"),BX.create("SPAN",{props:{className:"bx-price-old"},html:e.PRICE_FORMATED})]:[e.PRICE_FORMATED]},getDeliveryExtraServices:function(e){var t,i,s,a,o,r=[],l=!1;for(t in e.EXTRA_SERVICES)e.EXTRA_SERVICES.hasOwnProperty(t)&&(i=e.EXTRA_SERVICES[t]).canUserEditValue&&(-1==i.editControl.indexOf("this.checked")?(a=BX.create("LABEL",{html:BX.util.htmlspecialchars(i.name)+(i.price?" ("+i.priceFormatted+")":"")}),0==t&&(l=!0),s=BX.create("DIV",{props:{className:"form-group bx-soa-pp-field"},html:i.editControl+(i.description&&i.description.length?'<div class="bx-soa-service-small">'+BX.util.htmlspecialchars(i.description)+"</div>":"")}),BX.prepend(a,s),(o=(o=s.querySelector("input[type=text]"))||s.querySelector("select"))&&BX.addClass(o,"form-control")):s=BX.create("DIV",{props:{className:"checkbox"},children:[BX.create("LABEL",{html:i.editControl+BX.util.htmlspecialchars(i.name)+(i.price?" ("+i.priceFormatted+")":"")+(i.description&&i.description.length?'<div class="bx-soa-service-small">'+BX.util.htmlspecialchars(i.description)+"</div>":"")})]}),r.push(s));return l&&r.unshift(BX.create("BR")),r},editFadeDeliveryBlock:function(){var e,t=this.deliveryBlockNode.querySelector(".bx-soa-section-content");if(this.initialized.delivery||(this.editActiveDeliveryBlock(!1),BX.remove(BX.lastChild(this.deliveryBlockNode))),e=this.getNewContainer(!0),this.deliveryBlockNode.appendChild(e),this.editFadeDeliveryContent(e),"Y"==this.params.SHOW_COUPONS_DELIVERY){this.editCoupons(t);var i=BX.findChildren(BX("bx-soa-coupon"),{className:"bx-soa-section-content"});i&&i.length&&(BX.cleanNode(i[0]),this.editCoupons(i[0]))}},createDeliveryItem:function(e){var t,i,s,a,o,r,l,n,c="Y"==e.CHECKED,p=parseInt(e.ID),h=[BX.create("INPUT",{props:{id:"ID_DELIVERY_ID_"+p,name:"DELIVERY_ID",type:"checkbox",className:"bx-soa-pp-company-checkbox",value:p,checked:c}})],d=this.deliveryCachedInfo[p],u=!1;0<=e.PRICE||void 0!==e.DELIVERY_DISCOUNT_PRICE?(u=!0,a=BX.create("DIV",{props:{className:"bx-soa-pp-delivery-cost"},html:'<div class="bx-soa-pp-list-termin" lang="ru">'+this.params.MESS_PRICE+':</div><div class="bx-soa-pp-list-description" lang="ru">'+(0<e.PRICE?void 0!==e.DELIVERY_DISCOUNT_PRICE?e.DELIVERY_DISCOUNT_PRICE_FORMATED:e.PRICE_FORMATED:this.params.MESS_PRICE_FREE)+"</div>"})):d&&(0<=d.PRICE||void 0!==d.DELIVERY_DISCOUNT_PRICE)&&(u=!0,a=BX.create("DIV",{props:{className:"bx-soa-pp-delivery-cost"},html:'<div class="bx-soa-pp-list-termin" lang="ru">'+this.params.MESS_PRICE+':</div><div class="bx-soa-pp-list-description" lang="ru">'+(0<d.PRICE?void 0!==d.DELIVERY_DISCOUNT_PRICE?d.DELIVERY_DISCOUNT_PRICE_FORMATED:d.PRICE_FORMATED:this.params.MESS_PRICE_FREE)+"</div>"})),t=BX.create("DIV",{props:{className:"bx-soa-pp-company-graf-container"+(e.CALCULATE_ERRORS||d&&d.CALCULATE_ERRORS?" bx-bd-waring":"")},children:h}),"Y"==this.params.SHOW_DELIVERY_LIST_NAMES&&(i=BX.create("DIV",{props:{className:"bx-soa-pp-company-smalltitle"},text:"N"!=this.params.SHOW_DELIVERY_PARENT_NAMES?e.NAME:e.OWN_NAME})).setAttribute("lang","ru"),o=BX.create("DIV",{props:{className:"bx-soa-pp-company-description"},html:e.DESCRIPTION}),n=BX.create("DIV",{props:{className:"bx-soa-pp-company-inject clearfix hidden"},html:""});var B="PERIOD_TEXT"in e&&e.PERIOD_TEXT.length;B&&(r=BX.create("DIV",{props:{className:"bx-soa-pp-delivery-period"},html:'<div class="bx-soa-pp-list-termin" lang="ru">'+this.params.MESS_PERIOD+':</div><div class="bx-soa-pp-list-description" lang="ru">'+e.PERIOD_TEXT+"</div>"})).setAttribute("lang","ru");var m="CALCULATE_DESCRIPTION"in e&&e.CALCULATE_DESCRIPTION.length;return m&&(l=BX.create("DIV",{props:{className:"bx-soa-pp-delivery-calculate"},html:'<div class="bx-soa-pp-list-termin" lang="ru">'+this.params.MESS_PRICE+':</div><div class="bx-soa-pp-list-description" lang="ru">'+e.CALCULATE_DESCRIPTION+"</div>"})).setAttribute("lang","ru"),(s=BX.create("DIV",{props:{className:"bx-soa-pp-company bx-soa-pp-company-item"+(u?" bx-soa-pp-company--hasprice":"")+(B?" bx-soa-pp-company--hasperiod":"")+(m?" bx-soa-pp-company--hascalculate":"")+" col-lg-4 col-sm-4 col-xs-6"},children:[t,i,a,r,l,n,o],events:{click:BX.proxy(this.selectDelivery,this)}})).setAttribute("data-id",e.ID),c&&BX.addClass(s,"bx-selected"),c&&this.result.LAST_ORDER_DATA.PICK_UP&&(this.lastSelectedDelivery=p),s},editFadeDeliveryContent:function(e){var t=this.getSelectedDelivery(),i=("N"!=this.params.SHOW_DELIVERY_PARENT_NAMES?t.NAME:t.OWN_NAME,this.deliveryHiddenBlockNode.querySelector("div.alert.alert-danger")),s=this.deliveryHiddenBlockNode.querySelector("div.alert.alert-warning.alert-show");i&&i.innerHTML?e.appendChild(i.cloneNode(!0)):this.getErrorContainer(e),s&&s.innerHTML&&e.appendChild(s.cloneNode(!0)),t&&t.NAME||e.appendChild(BX.create("STRONG",{text:BX.message("SOA_DELIVERY_SELECT_ERROR")}))},selectDelivery:function(e){if(this.orderBlockNode){var t,i,s=e.target||e.srcElement,a=BX.findParent(s,{className:"bx-soa-pp-company-inject"}),o=BX.hasClass(s,"bx-soa-pp-company-item")?s:BX.findParent(s,{className:"bx-soa-pp-company-item"}),r=this.deliveryBlockNode.querySelector(".bx-soa-pp-company-item.bx-selected");if(!a){if(BX.hasClass(o,"bx-selected"))return"INPUT"==s.nodeName||"A"==s.nodeName||"LABEL"==s.nodeName?void 0:BX.PreventDefault(e);o&&(t=o.querySelector("input[type=checkbox]"),BX.addClass(o,"bx-selected"),t.checked=!0),r&&(i=r.querySelector("input[type=checkbox]"),BX.removeClass(r,"bx-selected"),i.checked=!1),this.isDeliveryChanged=!0,this.sendRequest()}}},getSelectedDelivery:function(){var e,t,i=this.deliveryBlockNode.querySelector("input[type=checkbox][name=DELIVERY_ID]:checked"),s=!1;if(i=(i=i||this.deliveryHiddenBlockNode.querySelector("input[type=checkbox][name=DELIVERY_ID]:checked"))||this.deliveryHiddenBlockNode.querySelector("input[type=hidden][name=DELIVERY_ID]"))for(t in e=i.value,this.result.DELIVERY)if(this.result.DELIVERY[t].ID==e){s=this.result.DELIVERY[t];break}return s},activatePickUp:function(e){this.pickUpBlockNode&&this.pickUpHiddenBlockNode&&(this.pickUpBlockNode.style.display="",this.pickUpBlockNode.querySelector("h2.bx-soa-section-title").innerHTML='<span class="bx-soa-section-title-count"></span>'+BX.util.htmlspecialchars(e),BX.hasClass(this.pickUpBlockNode,"bx-active")||(BX.addClass(this.pickUpBlockNode,"bx-active"),this.pickUpBlockNode.style.display=""))},deactivatePickUp:function(){this.pickUpBlockNode&&this.pickUpHiddenBlockNode&&BX.hasClass(this.pickUpBlockNode,"bx-active")&&(BX.removeClass(this.pickUpBlockNode,"bx-active"),this.pickUpBlockNode.style.display="none")},editPickUpBlock:function(e){this.pickUpBlockNode&&this.pickUpHiddenBlockNode&&BX.hasClass(this.pickUpBlockNode,"bx-active")&&this.result.DELIVERY&&(this.initialized.pickup=!1,e?this.editActivePickUpBlock(!0):this.editFadePickUpBlock(),this.initialized.pickup=!0)},editActivePickUpBlock:function(e){var t,i,s=e?this.pickUpBlockNode:this.pickUpHiddenBlockNode;this.initialized.pickup?("Y"===this.params.SHOW_NEAREST_PICKUP&&this.maps&&!this.maps.maxWaitTimeExpired&&(this.maps.maxWaitTimeExpired=!0,this.initPickUpPagination(),this.editPickUpList(!0),this.pickUpFinalAction()),this.maps&&!this.pickUpMapFocused&&(this.pickUpMapFocused=!0,setTimeout(BX.proxy(this.maps.pickUpMapFocusWaiter,this.maps),200))):((t=s.querySelector(".bx-soa-section-content"))||(t=this.getNewContainer(),s.appendChild(t)),BX.cleanNode(t),i=BX.create("DIV",{props:{className:"col-xs-12"}}),this.editPickUpMap(i),this.editPickUpLoader(i),t.appendChild(BX.create("DIV",{props:{className:"bx_soa_pickup row"},children:[i]})),"Y"==this.params.SHOW_PICKUP_MAP&&"Y"==this.params.SHOW_NEAREST_PICKUP||(this.initPickUpPagination(),this.editPickUpList(!0),this.pickUpFinalAction()),this.getBlockFooter(t))},editFadePickUpBlock:function(){var e;this.pickUpBlockNode.querySelector(".bx-soa-section-content");this.initialized.pickup||(this.editActivePickUpBlock(!1),BX.remove(BX.lastChild(this.pickUpBlockNode))),e=this.getNewContainer(),this.pickUpBlockNode.appendChild(e),this.editFadePickUpContent(e)},editFadePickUpContent:function(e){var t=this.getSelectedPickUp();t&&("Y"==this.params.SHOW_STORES_IMAGES&&(this.getImageSources(t,"IMAGE_ID").src_1x||this.defaultStoreLogo),BX.util.htmlspecialchars(t.TITLE),t.ADDRESS&&(BX.message("SOA_PICKUP_ADDRESS"),BX.util.htmlspecialchars(t.ADDRESS)),t.PHONE&&(BX.message("SOA_PICKUP_PHONE"),BX.util.htmlspecialchars(t.PHONE)),t.SCHEDULE&&(BX.message("SOA_PICKUP_WORK"),BX.util.htmlspecialchars(t.SCHEDULE)),t.DESCRIPTION&&(BX.message("SOA_PICKUP_DESC"),BX.util.htmlspecialchars(t.DESCRIPTION)))},getPickUpInfoArray:function(e){if(!e||e.length<=0)return[];var t,i=[];for(t=0;t<e.length;t++)this.result.STORE_LIST[e[t]]&&i.push(this.result.STORE_LIST[e[t]]);return i},getSelectedPickUp:function(){var e,t,i,s=BX("BUYER_STORE"),a=this.result.STORE_LIST;if(s&&!(e=a[s.value])&&(t=this.getSelectedDelivery().STORE))for(i in t)if(t.hasOwnProperty(i)){e=a[t[i]],s.setAttribute("value",t[i]);break}return e},checkPickUpShow:function(){var e,t,i=this.getSelectedDelivery();i&&i.STORE&&i.STORE.length&&(t=this.getPickUpInfoArray(i.STORE)),t&&t.length?(e="N"!=this.params.SHOW_DELIVERY_PARENT_NAMES?i.NAME:i.OWN_NAME,i.STORE_MAIN=i.STORE,this.activatePickUp(e),this.editSection(this.pickUpBlockNode)):this.deactivatePickUp()},geoLocationSuccessCallback:function(e){var t,i=this.getSelectedDelivery();i&&i.STORE&&(t=this.getPickUpInfoArray(i.STORE)),t&&t.length>=this.options.pickUpMap.minToShowNearestBlock&&e&&this.editPickUpRecommendList(e.geoObjects.get(0)),this.initPickUpPagination(),this.editPickUpList(!0),this.pickUpFinalAction()},geoLocationFailCallback:function(){this.initPickUpPagination(),this.editPickUpList(!0),this.pickUpFinalAction()},initMaps:function(){if(this.maps=BX.Sale.OrderAjaxComponent.Maps.init(this),this.maps){if(this.mapsReady=!0,this.resizeMapContainers(),"Y"===this.params.SHOW_PICKUP_MAP&&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),this.maps&&!this.pickUpMapFocused&&(this.pickUpMapFocused=!0,setTimeout(BX.proxy(this.maps.pickUpMapFocusWaiter,this.maps),200)),"Y"===this.params.SHOW_NEAREST_PICKUP&&this.maps.showNearestPickups(BX.proxy(this.geoLocationSuccessCallback,this),BX.proxy(this.geoLocationFailCallback,this)),this.maps.buildBalloons(t)}}if("Y"===this.params.SHOW_MAP_IN_PROPS&&BX("propsMap")){var s=this.getPropertyMapData();this.maps.initializePropsMap(s)}}},getPropertyMapData:function(){var e,t,i,s=this.options.propertyMap.defaultMapPosition;for(i in this.result.ORDER_PROP.properties)if(this.result.ORDER_PROP.properties.hasOwnProperty(i)&&"Y"==(e=this.result.ORDER_PROP.properties[i]).IS_LOCATION){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),o=parseFloat(e.LATITUDE);isNaN(a)||isNaN(o)||0==a||0==o||(s.lon=a,s.lat=o)}return s},resizeMapContainers:function(){var e,t,i=BX("pickUpMap"),s=BX("propsMap"),a=this.propsBlockNode;a&&(i||s)&&(e=a.clientWidth,t=parseInt(e/16*9),"Y"===this.params.SHOW_PICKUP_MAP&&i&&(i.style.height=t+"px"),"Y"===this.params.SHOW_MAP_IN_PROPS&&s&&(s.style.height=t+"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){BX.remove(BX("pickUpLoader"));var t,i,s,a,o,r,l,n=BX.create("DIV",{props:{className:"bx-soa-pickup-list main"}}),c=BX("BUYER_STORE"),p=!1;if(c&&(t=c.value),(a=(a=this.pickUpBlockNode.querySelector(".bx-soa-pickup-list.recommend"))||this.pickUpHiddenBlockNode.querySelector(".bx-soa-pickup-list.recommend"))&&a.querySelector(".bx-soa-pickup-list-item.bx-selected"))p=!0;else if((o=this.getSelectedDelivery())&&o.STORE)for(s=0;s<o.STORE.length;s++)o.STORE[s]==t&&(p=!0);for(s=0;s<this.pickUpPagination.currentPage.length;s++)(r=this.pickUpPagination.currentPage[s]).ID!=t&&0!=parseInt(t)&&p||(t=c.value=r.ID,p=!0),l=this.createPickUpItem(r,{selected:r.ID==t}),n.appendChild(l);e?((i=(i=this.pickUpHiddenBlockNode.querySelector(".bx_soa_pickup>.col-xs-12"))||this.pickUpBlockNode.querySelector(".bx_soa_pickup>.col-xs-12")).appendChild(BX.create("DIV",{props:{className:"bx-soa-pickup-subTitle"},html:this.params.MESS_PICKUP_LIST})),i.appendChild(n)):(i=this.pickUpBlockNode.querySelector(".bx-soa-pickup-list.main"),BX.insertAfter(n,i),BX.remove(i)),this.pickUpPagination.show&&this.showPagination("pickUp",n)}},pickUpFinalAction:function(){var e,t=this.getSelectedDelivery();t&&(e=this.lastSelectedDelivery!==parseInt(t.ID),this.lastSelectedDelivery=parseInt(t.ID)),e&&this.pickUpBlockNode.id!==this.activeSectionId&&(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="";return e.ADDRESS&&(t+=BX.message("SOA_PICKUP_ADDRESS")+": "+BX.util.htmlspecialchars(e.ADDRESS)+"<br>"),e.PHONE&&(t+=BX.message("SOA_PICKUP_PHONE")+": "+BX.util.htmlspecialchars(e.PHONE)+"<br>"),e.SCHEDULE&&(t+=BX.message("SOA_PICKUP_WORK")+": "+BX.util.htmlspecialchars(e.SCHEDULE)+"<br>"),e.DESCRIPTION&&(t+=BX.message("SOA_PICKUP_DESC")+": "+BX.util.htmlspecialchars(e.DESCRIPTION)+"<br>"),t},createPickUpItem:function(e,t){t=t||{};var i,s,a,o,r,l="bx-soa-pickup-l-item-detail",n="bx-soa-pickup-l-item-btn";return"Y"===this.params.SHOW_STORES_IMAGES?(s=this.getImageSources(e,"IMAGE_ID"),r=s&&s.src_1x||this.defaultStoreLogo,i=BX.create("IMG",{props:{src:r,className:"bx-soa-pickup-l-item-img"},events:{click:BX.delegate(function(e){this.popupShow(e,s&&s.src_orig||r)},this)}})):(l+=" no-image",n+=" no-image"),a=this.getStoreInfoHtml(e),o=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:l},children:[i,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:a})]}),BX.create("DIV",{props:{className:n},children:[BX.create("A",{props:{href:"javascript:;",className:"btn btn-sm btn-default"},html:t.selected?this.params.MESS_SELECTED_PICKUP: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)}}),t.selected&&BX.addClass(o,"bx-selected"),o},editPickUpRecommendList:function(e){if(this.maps&&this.maps.canUseRecommendList()&&e){BX.remove(BX("pickUpLoader"));var t,i,s,a,o,r,l=BX.create("DIV",{props:{className:"bx-soa-pickup-list recommend"}}),n=BX("BUYER_STORE"),c=this.getSelectedDelivery(),p=this.maps.getRecommendedStoreIds(e);for(t=0;t<p.length;t++)s=p[t],i=this.getPickUpInfoArray([s])[0],0===t&&parseInt(c.ID)!==this.lastSelectedDelivery&&(n.value=parseInt(s)),a=this.maps.getDistance(e,s),o=this.createPickUpItem(i,{selected:n.value===s,distance:a}),l.appendChild(o),c.STORE_MAIN&&c.STORE_MAIN.splice(c.STORE_MAIN.indexOf(s),1);(r=(r=this.pickUpHiddenBlockNode.querySelector(".bx_soa_pickup>.col-xs-12"))||this.pickUpBlockNode.querySelector(".bx_soa_pickup>.col-xs-12")).appendChild(BX.create("DIV",{props:{className:"bx-soa-pickup-subTitle"},html:this.params.MESS_NEAREST_PICKUP_LIST})),r.appendChild(l)}},selectStore:function(e){var t,i,s,a,o,r,l,n,c,p=BX("BUYER_STORE");if(BX.type.isString(e)){if(!(t=BX("store-"+e))){for(a=0;a<this.pickUpPagination.pages.length;a++)for(r=this.pickUpPagination.pages[a],o=0;o<r.length;o++)if(r[o].ID==e){this.showPickUpItemsPage(++a);break}t=BX("store-"+e)}}else l=e.target||e.srcElement,t=BX.hasClass(l,"bx-soa-pickup-list-item")?l:BX.findParent(l,{className:"bx-soa-pickup-list-item"});if(t&&p){if(BX.hasClass(t,"bx-selected"))return;s=t.id.substr("store-".length),(i=this.pickUpBlockNode.querySelector(".bx-selected"))&&(i.querySelector(".bx-soa-pickup-l-item-btn .btn").innerText=this.params.MESS_SELECT_PICKUP,BX.removeClass(i,"bx-selected")),n=t.clientHeight,t.style.overflow="hidden",BX.addClass(t,"bx-selected"),c=t.clientHeight,t.style.height=n+"px",t.querySelector(".bx-soa-pickup-l-item-btn .btn").innerText=this.params.MESS_SELECTED_PICKUP,new BX.easing({duration:300,start:{height:n,opacity:0},finish:{height:c,opacity:100},transition:BX.easing.transitions.quad,step:function(e){t.style.height=e.height+"px"},complete:function(){t.removeAttribute("style")}}).animate(),p.setAttribute("value",s),this.maps&&this.maps.selectBalloon(s)}},getDeliverySortedArray:function(e){function t(e,t){var i=parseInt(e.SORT)-parseInt(t.SORT);return 0==i?e.OWN_NAME.toLowerCase()>t.OWN_NAME.toLowerCase()?1:e.OWN_NAME.toLowerCase()<t.OWN_NAME.toLowerCase()?-1:0:i}var i,s=[],a=[];for(i in e)e.hasOwnProperty(i)&&("L"===this.params.SHOW_NOT_CALCULATED_DELIVERIES&&e[i].CALCULATE_ERRORS?a.push(e[i]):s.push(e[i]));return s.sort(t),a.sort(t),s.concat(a)},editPropsBlock:function(e){this.propsBlockNode&&this.propsHiddenBlockNode&&this.result.ORDER_PROP&&(e?this.editActivePropsBlock(!0):this.editFadePropsBlock(),this.initialized.props=!0)},editActivePropsBlock:function(e){var t,i,s,a,o=e?this.propsBlockNode:this.propsHiddenBlockNode,r=!1;if(this.initialized.props)this.maps&&setTimeout(BX.proxy(this.maps.propsMapFocusWaiter,this.maps),200);else{if((t=o.querySelector(".bx-soa-section-content"))?BX.cleanNode(t):(t=this.getNewContainer(),o.appendChild(t)),this.getErrorContainer(t),i=BX.create("DIV",{props:{className:"row"}}),(s=this.getSelectedDelivery())&&"Y"===this.params.SHOW_MAP_IN_PROPS&&this.params.SHOW_MAP_FOR_DELIVERIES&&this.params.SHOW_MAP_FOR_DELIVERIES.length)for(a=0;a<this.params.SHOW_MAP_FOR_DELIVERIES.length;a++)if(parseInt(s.ID)===parseInt(this.params.SHOW_MAP_FOR_DELIVERIES[a])){r=!0;break}this.editPropsItems(i),r&&this.editPropsMap(i),"Y"!==this.params.HIDE_ORDER_DESCRIPTION&&this.editPropsComment(i),t.appendChild(i),this.getBlockFooter(t)}},editFadePropsBlock:function(){var e;this.propsBlockNode.querySelector(".bx-soa-section-content");this.initialized.props||(this.editActivePropsBlock(!1),BX.remove(BX.lastChild(this.propsBlockNode))),e=this.getNewContainer(),this.propsBlockNode.appendChild(e),this.editFadePropsContent(e)},editFadePropsContent:function(e){if(e&&this.locationsInitialized){var t,i,s=this.propsHiddenBlockNode.querySelector(".alert"),a=this.getSelectedPersonType();s&&e.appendChild(s.cloneNode(!0)),a&&(t="PROPS_FADE_LIST_"+a.ID,i=this.params[t]),i&&i.length,this.propsBlockNode.getAttribute("data-visited")}},editPropsItems:function(e){if(this.result.ORDER_PROP&&this.propertyCollection){var t,i,s,a=BX.create("DIV",{props:{className:"col-sm-12 bx-soa-customer"}}),o=this.propertyCollection.getGroupIterator();for(a=a||this.propsBlockNode.querySelector(".col-sm-12.bx-soa-customer");t=o();)for(s=t.getIterator();i=s();)this.deliveryLocationInfo.loc!=i.getId()&&this.deliveryLocationInfo.zip!=i.getId()&&this.deliveryLocationInfo.city!=i.getId()&&this.getPropertyRowNode(i,a,!1);e.appendChild(a)}},getPropertyRowNode:function(e,t,i){var s,a=BX.create("DIV"),o="",r=e.getType()||"",l=e.getDescription()||"";switch(i?a.innerHTML="<strong>"+BX.util.htmlspecialchars(e.getName())+":</strong> ":(BX.addClass(a,"form-group bx-soa-customer-field"),e.isRequired()&&(o+='<span class="bx-authform-starrequired">*</span> '),o+=BX.util.htmlspecialchars(e.getName()),l.length&&"STRING"!=r&&"NUMBER"!=r&&"DATE"!=r&&(o+=" <small>("+BX.util.htmlspecialchars(l)+")</small>"),s=BX.create("LABEL",{attrs:{for:"soa-property-"+e.getId()},props:{className:"bx-soa-custom-label"},html:o}),a.setAttribute("data-property-id-row",e.getId()),a.appendChild(s)),r){case"LOCATION":this.insertLocationProperty(e,a,i);break;case"DATE":this.insertDateProperty(e,a,i);break;case"FILE":this.insertFileProperty(e,a,i);break;case"STRING":this.insertStringProperty(e,a,i);break;case"ENUM":this.insertEnumProperty(e,a,i);break;case"Y/N":this.insertYNProperty(e,a,i);break;case"NUMBER":this.insertNumberProperty(e,a,i)}t.appendChild(a)},insertLocationProperty:function(e,t,i){var s,a,o,r,l,n,c,p,h=[];if(e.getId()in this.locations)if(i){if(s=this.propsHiddenBlockNode.querySelector('[data-property-id-row="'+e.getId()+'"]'))for(a=s.querySelectorAll("div.bx-soa-loc"),c=0;c<a.length;c++)o=this.getLocationString(a[c]),h.push(o.length?BX.util.htmlspecialchars(o):BX.message("SOA_NOT_SELECTED"));t.innerHTML+=h.join("<br>")}else{for(n=BX.create("DIV",{props:{className:"soa-property-container"}}),s=this.locations[e.getId()],c=0;c<s.length;c++)for(p in r=s[c]?s[c].output:{},l=BX.create("DIV",{props:{className:"bx-soa-loc"},html:r.HTML}),e.isMultiple()&&(l.style.marginBottom="search"==this.locationsTemplate?"5px":"20px"),n.appendChild(l),r.SCRIPT)r.SCRIPT.hasOwnProperty(p)&&BX.evalGlobal(r.SCRIPT[p].JS);e.isMultiple()&&n.appendChild(BX.create("DIV",{attrs:{"data-prop-id":e.getId()},props:{className:"btn btn-sm btn-default"},text:BX.message("ADD_DEFAULT"),events:{click:BX.proxy(this.addLocationProperty,this)}})),t.appendChild(n)}},addLocationProperty:function(e){var t,i,s,a=e.target||e.srcElement,o=a.getAttribute("data-prop-id"),r=BX.previousSibling(a),l=0,n=BX.util.getRandomString(5);if(BX.hasClass(r,"bx-soa-loc")&&("search"==this.locationsTemplate?(s=r.querySelector("input[type=text][class=dropdown-field]"))&&(l=parseInt(s.name.substring(s.name.indexOf("[")+1,s.name.indexOf("]")))+1):(s=r.querySelectorAll("input[type=hidden]")).length&&(s=s[s.length-1],l=parseInt(s.name.substring(s.name.indexOf("[")+1,s.name.indexOf("]")))+1)),this.cleanLocations[o]){for(i in t=BX.create("DIV",{props:{className:"bx-soa-loc"},style:{marginBottom:"search"==this.locationsTemplate?"5px":"20px"},html:this.cleanLocations[o].HTML.split("#key#").join(l).replace(/sls-\d{5}/g,"sls-"+n)}),a.parentNode.insertBefore(t,a),BX.saleOrderAjax.addPropertyDesc({id:o+"_"+l,attributes:{id:o+"_"+l,type:"LOCATION",valueSource:"form"}}),this.cleanLocations[o].SCRIPT)this.cleanLocations[o].SCRIPT.hasOwnProperty(i)&&BX.evalGlobal(this.cleanLocations[o].SCRIPT[i].JS.split("_key__").join("_"+l).replace(/sls-\d{5}/g,"sls-"+n));BX.saleOrderAjax.initDeferredControl()}},insertDateProperty:function(e,t,i){var s,a,o,r,l,n;if(i){if(s=this.propsHiddenBlockNode.querySelector('div[data-property-id-row="'+e.getId()+'"]')){for(o=[],a=s.querySelectorAll("input[type=text]"),r=0;r<a.length;r++)a[r].value&&a[r].value.length&&o.push(a[r].value);t.innerHTML+=this.valuesToString(o)}}else{for(l=BX.create("DIV",{props:{className:"soa-property-container"}}),e.appendTo(l),t.appendChild(l),n=l.querySelectorAll("input[type=text]"),r=0;r<n.length;r++)this.alterDateProperty(e.getSettings(),n[r]);this.alterProperty(e.getSettings(),l),this.bindValidation(e.getId(),l)}},insertFileProperty:function(e,t,i){var s,a,o,r,l,n,c;if(i){if(s=this.propsHiddenBlockNode.querySelector('div[data-property-id-row="'+e.getId()+'"]')){for(o=[],a=s.querySelectorAll("a"),r=0;r<a.length;r++)(l=a[r].innerHTML).length&&o.push(l);t.innerHTML+=this.valuesToString(o)}}else(n=this.savedFilesBlockNode.querySelector('div[data-property-id-row="'+e.getId()+'"]'))&&(c=n.querySelector("div.soa-property-container")),c?t.appendChild(c):(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,o,r,l;if(i){if(s=this.propsHiddenBlockNode.querySelector('div[data-property-id-row="'+e.getId()+'"]')){if(o=[],0==(a=s.querySelectorAll("input[type=text]")).length&&(a=s.querySelectorAll("textarea")),a.length)for(r=0;r<a.length;r++)a[r].value.length&&o.push(a[r].value);t.innerHTML+=this.valuesToString(o)}}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,o,r,l;if(i){if(s=this.propsHiddenBlockNode.querySelector('div[data-property-id-row="'+e.getId()+'"]')){if(o=[],(a=s.querySelectorAll("input[type=radio]")).length)for(r=0;r<a.length;r++)a[r].checked&&o.push(a[r].nextSibling.nodeValue);if((a=s.querySelectorAll("option")).length)for(r=0;r<a.length;r++)a[r].selected&&o.push(a[r].innerHTML);t.innerHTML+=this.valuesToString(o)}}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,o,r,l;if(i){if(s=this.propsHiddenBlockNode.querySelector('div[data-property-id-row="'+e.getId()+'"]')){for(o=[],a=s.querySelectorAll("input[type=checkbox]"),r=0;r<a.length;r+=2)o.push(a[r].checked?BX.message("SOA_YES"):BX.message("SOA_NO"));t.innerHTML+=this.valuesToString(o)}}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,o,r,l;if(i){if(s=this.propsHiddenBlockNode.querySelector('div[data-property-id-row="'+e.getId()+'"]')){for(o=[],a=s.querySelectorAll("input[type=text]"),r=0;r<a.length;r++)a[r].value.length&&o.push(a[r].value);t.innerHTML+=this.valuesToString(o)}}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(d,u){var e,t,i,s,a,o,r,l,n=BX.findChildren(u,{tagName:"DIV"});if(n&&n.length)for(e=0;e<n.length;e++)n[e].style.margin="5px 0";for((t=(t=u.querySelector("input[type=text]"))||u.querySelector("textarea"))&&(t.id="soa-property-"+d.ID,"Y"==d.IS_ADDRESS&&t.setAttribute("autocomplete","address"),"Y"==d.IS_EMAIL&&t.setAttribute("autocomplete","email"),"Y"==d.IS_PAYER&&t.setAttribute("autocomplete","name"),"Y"==d.IS_PHONE&&t.setAttribute("autocomplete","tel"),d.PATTERN&&d.PATTERN.length&&t.removeAttribute("pattern")),i=u.querySelectorAll("input[type=text]"),e=0;e<i.length;e++)i[e].placeholder=d.DESCRIPTION,BX.addClass(i[e],"form-control bx-soa-customer-input bx-ios-fix");for(i=u.querySelectorAll("select"),e=0;e<i.length;e++)BX.addClass(i[e],"form-control");for(i=u.querySelectorAll("textarea"),e=0;e<i.length;e++)i[e].placeholder=d.DESCRIPTION,BX.addClass(i[e],"form-control bx-ios-fix");for(s=u.querySelectorAll("label"),e=0;e<s.length;e++)BX.remove(s[e]);if("FILE"==d.TYPE){if(d.ACCEPT&&d.ACCEPT.length)for(o=u.querySelectorAll("input[type=file]"),r=this.getFileAccepts(d.ACCEPT),e=0;e<o.length;e++)o[e].setAttribute("accept",r);for(l=u.querySelectorAll("a"),e=0;e<l.length;e++)BX.bind(l[e],"click",function(e){var t=e.target||e.srcElement,i=t&&t.nextSibling&&t.nextSibling.nextSibling;i&&BX.fireEvent(i,"change")})}for(a=u.querySelectorAll("input[type=button]"),e=0;e<a.length;e++)BX.addClass(a[e],"btn btn-default btn-sm"),"Y"==d.MULTIPLE&&e==a.length-1||"FILE"==d.TYPE&&(BX.prepend(a[e],a[e].parentNode),a[e].style.marginRight="10px");a.length&&(a=a[a.length-1],BX.bind(a,"click",BX.delegate(function(e){var t,i,s,a,o=e.target||e.srcElement,r=BX.findParent(o,{tagName:"div",className:"soa-property-container"}),l=r.querySelector("label"),n=r.querySelectorAll("input[type=button]"),c=r.querySelectorAll("input[type=text]"),p=r.querySelectorAll("textarea"),h=BX.findChildren(r,{tagName:"DIV"});if(h&&h.length)for(t=0;t<h.length;t++)h[t].style.margin="5px 0";if(this.bindValidation(d.ID,r),n.length&&n[n.length-2]&&(BX.prepend(n[n.length-2],n[n.length-2].parentNode),n[n.length-2].style.marginRight="10px",BX.addClass(n[n.length-2],"btn btn-default btn-sm")),l&&BX.remove(l),c.length&&(c[c.length-1].placeholder=d.DESCRIPTION,BX.addClass(c[c.length-1],"form-control bx-soa-customer-input bx-ios-fix"),"DATE"==d.TYPE&&this.alterDateProperty(d,c[c.length-1]),d.PATTERN&&d.PATTERN.length&&c[c.length-1].removeAttribute("pattern")),p.length&&(p[p.length-1].placeholder=d.DESCRIPTION,BX.addClass(p[p.length-1],"form-control bx-ios-fix")),"FILE"==d.TYPE){if(d.ACCEPT&&d.ACCEPT.length)for(s=u.querySelectorAll("input[type=file]"),a=this.getFileAccepts(d.ACCEPT),t=0;t<s.length;t++)s[t].setAttribute("accept",a);i=r.querySelectorAll("a"),BX.bind(i[i.length-1],"click",function(e){var t=e.target||e.srcElement,i=t&&t.nextSibling&&t.nextSibling.nextSibling;i&&setTimeout(function(){BX.fireEvent(i,"change")},10)})}},this)))},alterDateProperty:function(s,e){var t,i=BX.findParent(e,{tagName:"DIV"});BX.addClass(i,"input-group"),t=BX.create("DIV",{props:{className:"input-group-addon"},children:[BX.create("I",{props:{className:"bx-calendar"}})]}),BX.insertAfter(t,e),BX.remove(i.querySelector("input[type=button]")),BX.bind(t,"click",BX.delegate(function(e){var t=e.target||e.srcElement,i=BX.findParent(t,{tagName:"DIV",className:"input-group"});BX.calendar({node:i.querySelector(".input-group-addon"),field:i.querySelector("input[type=text]").name,form:"",bTime:"Y"==s.TIME,bHideTime:!1})},this))},isValidForm:function(){if(!this.options.propertyValidation)return!0;var e,t,i=this.isValidRegionBlock(),s=this.isValidPropertiesBlock(),a=!1;if(i.length&&(a=!0,this.animateScrollTo(this.regionBlockNode,800,50)),s.length&&!a)if(this.activeSectionId==this.propsBlockNode.id){for(e=this.propsBlockNode.querySelectorAll("div.tooltip"),t=0;t<e.length;t++)if("opened"==e[t].getAttribute("data-state")){this.animateScrollTo(BX.findParent(e[t],{className:"form-group bx-soa-customer-field"}),800,50);break}}else this.animateScrollTo(this.propsBlockNode,800,50);return i.length?(this.showError(this.regionBlockNode,i),BX.addClass(this.regionBlockNode,"bx-step-error")):(this.regionBlockNode.querySelector(".alert.alert-danger").style.display="none",BX.cleanNode(this.regionBlockNode.querySelector(".alert.alert-danger")),BX.removeClass(this.regionBlockNode,"bx-step-error")),s.length?(this.showError(this.propsBlockNode,s),BX.addClass(this.propsBlockNode,"bx-step-error")):(this.propsBlockNode.querySelector(".alert.alert-danger").style.display="none",BX.cleanNode(this.propsBlockNode.querySelector(".alert.alert-danger")),BX.removeClass(this.propsBlockNode,"bx-step-error")),!(i.length+s.length)},isValidRegionBlock:function(){if(!this.options.propertyValidation)return[];var e,t,i,s,a=this.orderBlockNode.querySelectorAll(".bx-soa-location-input-container[data-property-id-row]"),o=[];for(s=0;s<a.length;s++)e=a[s].getAttribute("data-property-id-row"),t=this.validation.properties[e],i=this.getValidationData(t,a[s]),o=o.concat(this.isValidProperty(i,!0));return o},isValidPropertiesBlock:function(e){if(!this.options.propertyValidation)return[];var t,i,s,a,o,r=this.orderBlockNode.querySelectorAll(".bx-soa-customer-field[data-property-id-row]"),l=[];for(o=0;o<r.length;o++)t=r[o].getAttribute("data-property-id-row"),e&&this.locations[t]||(i=r[o].querySelector(".soa-property-container"))&&(s=this.validation.properties[t],a=this.getValidationData(s,i),l=l.concat(this.isValidProperty(a,!0)));return l},isValidProperty:function(e,t){var i,s,a=[];if(!e||!e.inputs)return a;for(s=0;s<e.inputs.length;s++)(i=e.func(e.inputs[s],!!t)).length&&(a[s]=i.join("<br>"));return this.showValidationResult(e.inputs,a),a},bindValidation:function(e,t){if(this.validation.properties&&this.validation.properties[e]){var i,s,a=this.validation.properties[e],o=this.getValidationData(a,t);if(o&&o.inputs&&o.action)for(i=0;i<o.inputs.length;i++)if(BX.type.isElementNode(o.inputs[i]))BX.bind(o.inputs[i],o.action,BX.delegate(function(){this.isValidProperty(o)},this));else for(s=0;s<o.inputs[i].length;s++)BX.bind(o.inputs[i][s],o.action,BX.delegate(function(){this.isValidProperty(o)},this))}},getValidationData:function(i,e){if(i&&e){var t,s={};switch(i.TYPE){case"STRING":if(s.action="change",s.func=BX.delegate(function(e,t){return this.validateString(e,i,t)},this),(t=e.querySelectorAll("input[type=text]")).length){s.inputs=t;break}(t=e.querySelectorAll("textarea")).length&&(s.inputs=t);break;case"LOCATION":if(s.func=BX.delegate(function(e,t){return this.validateLocation(e,i,t)},this),(t=e.querySelectorAll("input.bx-ui-sls-fake[type=text]")).length){s.inputs=t,s.action="keyup";break}(t=e.querySelectorAll("div.bx-ui-slst-pool")).length&&(s.inputs=t);break;case"Y/N":s.inputs=e.querySelectorAll("input[type=checkbox]"),s.action="change",s.func=BX.delegate(function(e,t){return this.validateCheckbox(e,i,t)},this);break;case"NUMBER":s.inputs=e.querySelectorAll("input[type=text]"),s.action="blur",s.func=BX.delegate(function(e,t){return this.validateNumber(e,i,t)},this);break;case"ENUM":if((t=e.querySelectorAll("input[type=radio]")).length||(t=e.querySelectorAll("input[type=checkbox]")),t.length){s.inputs=[t],s.action="change",s.func=BX.delegate(function(e,t){return this.validateEnum(e,i,t)},this);break}(t=e.querySelectorAll("option")).length&&(s.inputs=[t],s.action="click",s.func=BX.delegate(function(e,t){return this.validateSelect(e,i,t)},this));break;case"FILE":s.inputs=e.querySelectorAll("input[type=file]"),s.action="change",s.func=BX.delegate(function(e,t){return this.validateFile(e,i,t)},this);break;case"DATE":s.inputs=e.querySelectorAll("input[type=text]"),s.action="change",s.func=BX.delegate(function(e,t){return this.validateDate(e,i,t)},this)}return s}},showErrorTooltip:function(e,t,i){if(e&&t&&i){var s,a,o=BX("tooltip-"+e);i=this.uniqueText(i,"<br>"),o?s=o.querySelector("div.tooltip-inner"):(s=BX.create("DIV",{props:{className:"tooltip-inner"}}),o=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"}}),s]}),(a=t.parentNode.querySelector("div.quick-locations"))&&(t=a),BX.insertAfter(o,t)),s.innerHTML=i,"opened"!=o.getAttribute("data-state")&&(o.setAttribute("data-state","opened"),o.style.opacity=0,o.style.display="block",new BX.easing({duration:150,start:{opacity:0},finish:{opacity:100},transition:BX.easing.transitions.quad,step:function(e){o.style.opacity=e.opacity/100}}).animate())}},closeErrorTooltip:function(e){var t=BX("tooltip-"+e);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){var i,s,a,o=BX.type.isElementNode(e[0])?e[0]:e[0][0],r=BX.findParent(o,{tagName:"DIV",className:"form-group"}).querySelector("label");for(r&&(i=r.getAttribute("for")),a=0;a<e.length;a++)s=BX.findParent(e[a],{tagName:"DIV",className:"form-group"}),t[a]&&t[a].length?BX.addClass(s,"has-error"):BX.removeClass(s,"has-error");t.length?this.showErrorTooltip(i,r,t.join("<br>")):this.closeErrorTooltip(i)}},validateString:function(e,t,i){if(!e||!t)return[];var s=e.value,a=[],o=BX.util.htmlspecialchars(t.NAME),r=i?BX.message("SOA_FIELD")+' "'+o+'"':BX.message("SOA_FIELD");return"Y"===t.MULTIPLE||("Y"===t.REQUIRED&&0===s.length&&a.push(r+" "+BX.message("SOA_REQUIRED")),s.length&&(t.MINLENGTH&&t.MINLENGTH>s.length&&a.push(BX.message("SOA_MIN_LENGTH")+' "'+o+'" '+BX.message("SOA_LESS")+" "+t.MINLENGTH+" "+BX.message("SOA_SYMBOLS")),t.MAXLENGTH&&t.MAXLENGTH<s.length&&a.push(BX.message("SOA_MAX_LENGTH")+' "'+o+'" '+BX.message("SOA_MORE")+" "+t.MAXLENGTH+" "+BX.message("SOA_SYMBOLS")),"Y"===t.IS_EMAIL&&(e.value=s=BX.util.trim(s),s.length&&(/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i.test(s)||a.push(BX.message("SOA_INVALID_EMAIL")))),0<s.length&&t.PATTERN&&t.PATTERN.length&&(new RegExp(t.PATTERN).test(s)||a.push(r+" "+BX.message("SOA_INVALID_PATTERN"))))),a},validateLocation:function(e,t,i){if(!e||!t)return[];var s=BX.findParent(e,{tagName:"DIV",className:"form-group"}),a=this.getLocationString(s),o=[],r=i?BX.message("SOA_FIELD")+' "'+BX.util.htmlspecialchars(t.NAME)+'"':BX.message("SOA_FIELD");return"Y"==t.MULTIPLE&&"Y"!==t.IS_LOCATION||"Y"!=t.REQUIRED||0!=a.length&&a!=BX.message("SOA_NOT_SPECIFIED")||o.push(r+" "+BX.message("SOA_REQUIRED")),o},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");return"Y"==t.MULTIPLE||"Y"!=t.REQUIRED||e.checked||s.push(a+" "+BX.message("SOA_REQUIRED")),s},validateNumber:function(e,t,i){if(!e||!t)return[];var s,a=e.value,o=[],r=BX.util.htmlspecialchars(t.NAME),l=i?BX.message("SOA_FIELD")+' "'+r+'"':BX.message("SOA_FIELD");return"Y"==t.MULTIPLE||("Y"==t.REQUIRED&&0==a.length&&o.push(l+" "+BX.message("SOA_REQUIRED")),a.length&&(/[0-9]|\./.test(a)||o.push(l+" "+BX.message("SOA_NOT_NUMERIC")),t.MIN&&parseFloat(t.MIN)>parseFloat(a)&&o.push(BX.message("SOA_MIN_VALUE")+' "'+r+'" '+parseFloat(t.MIN)),t.MAX&&parseFloat(t.MAX)<parseFloat(a)&&o.push(BX.message("SOA_MAX_VALUE")+' "'+r+'" '+parseFloat(t.MAX)),t.STEP&&0<parseFloat(t.STEP)&&(s=(Math.abs(parseFloat(a)-(t.MIN&&0<parseFloat(t.MIN)?parseFloat(t.MIN):0))/parseFloat(t.STEP)).toPrecision(12))!=parseInt(s)&&o.push(l+" "+BX.message("SOA_NUM_STEP")+" "+t.STEP))),o},validateEnum:function(e,t,i){if(!e||!t)return[];var s,a=[],o=[],r=i?BX.message("SOA_FIELD")+' "'+BX.util.htmlspecialchars(t.NAME)+'"':BX.message("SOA_FIELD");if("Y"==t.MULTIPLE)return o;for(s=0;s<e.length;s++)(e[s].checked||e[s].selected)&&a.push(s);return"Y"==t.REQUIRED&&0==a.length&&o.push(r+" "+BX.message("SOA_REQUIRED")),o},validateSelect:function(e,t,i){if(!e||!t)return[];var s,a=[],o=[],r=i?BX.message("SOA_FIELD")+' "'+BX.util.htmlspecialchars(t.NAME)+'"':BX.message("SOA_FIELD");if("Y"==t.MULTIPLE)return o;for(s=0;s<e.length;s++)e[s].selected&&a.push(s);return"Y"==t.REQUIRED&&0==a.length&&o.push(r+" "+BX.message("SOA_REQUIRED")),o},validateFile:function(e,t,i){if(!e||!t)return[];var s,a,o,r,l,n=[],c=e.files||[],p=i?BX.message("SOA_FIELD")+' "'+BX.util.htmlspecialchars(t.NAME)+'"':BX.message("SOA_FIELD"),h=e.previousSibling.value;if("Y"==t.MULTIPLE)return n;if("Y"!=t.REQUIRED||0!=c.length||""!=h||t.DEFAULT_VALUE&&t.DEFAULT_VALUE.length)for(s=0;s<c.length;s++)a=c[s],o=BX.util.htmlspecialchars(a.name),l=1<(r=a.name.split(".")).length?r[r.length-1].toLowerCase():"",0<t.ACCEPT.length&&(0==l.length||"-1"==t.ACCEPT.indexOf(l))&&n.push(BX.message("SOA_BAD_EXTENSION")+' "'+o+'" ('+BX.util.htmlspecialchars(t.ACCEPT)+")"),a.size>parseInt(t.MAXSIZE)&&n.push(BX.message("SOA_MAX_SIZE")+' "'+o+'" ('+this.getSizeString(t.MAXSIZE,1)+")");else n.push(p+" "+BX.message("SOA_REQUIRED"));return n},validateDate:function(e,t,i){if(!e||!t)return[];var s=e.value,a=[],o=BX.util.htmlspecialchars(t.NAME),r=i?BX.message("SOA_FIELD")+' "'+o+'"':BX.message("SOA_FIELD");return"Y"==t.MULTIPLE||"Y"==t.REQUIRED&&0==s.length&&a.push(r+" "+BX.message("SOA_REQUIRED")),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){var e,t,i,s,a,o,r,l=this.result.TOTAL,n={},c="Y"===this.params.SHOW_TOTAL_ORDER_BUTTON;if(BX.cleanNode(this.totalInfoBlockNode),0===parseFloat(l.ORDER_PRICE)?(e=this.params.MESS_PRICE_FREE,n.free=!0):e=l.ORDER_PRICE_FORMATED,this.options.showPriceWithoutDiscount&&(e+='<br><span class="bx-price-old">'+l.PRICE_WITHOUT_DISCOUNT+"</span>"),this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message("SOA_SUM_SUMMARY"),e,n)),this.options.showOrderWeight&&this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message("SOA_SUM_WEIGHT_SUM"),l.ORDER_WEIGHT_FORMATED)),this.options.showTaxList)for(s=0;s<l.TAX_LIST.length;s++)i=l.TAX_LIST[s].VALUE_MONEY_FORMATED||"",this.totalInfoBlockNode.appendChild(this.createTotalUnit(l.TAX_LIST[s].NAME+(l.TAX_LIST[s].VALUE_FORMATED?" "+l.TAX_LIST[s].VALUE_FORMATED:"")+":",i));n={},(o=(a=this.getSelectedDelivery())&&a.CALCULATE_ERRORS&&a.CALCULATE_ERRORS.length)?(r=BX.message("SOA_NOT_CALCULATED"),n.error=o):(0===parseFloat(l.DELIVERY_PRICE)?(r=this.params.MESS_PRICE_FREE,n.free=!0):r=l.DELIVERY_PRICE_FORMATED,a&&void 0!==a.DELIVERY_DISCOUNT_PRICE&&parseFloat(a.PRICE)>parseFloat(a.DELIVERY_DISCOUNT_PRICE)&&(r+='<br><span class="bx-price-old">'+a.PRICE_FORMATED+"</span>")),this.result.DELIVERY.length&&this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message("SOA_SUM_DELIVERY"),r,n)),this.options.showDiscountPrice&&(t=this.params.MESS_ECONOMY,l.DISCOUNT_PERCENT_FORMATED&&0<parseFloat(l.DISCOUNT_PERCENT_FORMATED)&&(t+=l.DISCOUNT_PERCENT_FORMATED),this.totalInfoBlockNode.appendChild(this.createTotalUnit(t+":",l.DISCOUNT_PRICE_FORMATED,{highlighted:!0}))),this.options.showPayedFromInnerBudget?(this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message("SOA_SUM_IT"),l.ORDER_TOTAL_PRICE_FORMATED)),this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message("SOA_SUM_PAYED"),l.PAYED_FROM_ACCOUNT_FORMATED)),this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message("SOA_SUM_LEFT_TO_PAY"),l.ORDER_TOTAL_LEFT_TO_PAY_FORMATED,{total:!0}))):this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message("SOA_SUM_IT"),l.ORDER_TOTAL_PRICE_FORMATED,{total:!0})),0<=parseFloat(l.PAY_SYSTEM_PRICE)&&this.result.DELIVERY.length&&this.totalInfoBlockNode.appendChild(this.createTotalUnit(BX.message("SOA_PAYSYSTEM_PRICE"),"~"+l.PAY_SYSTEM_PRICE_FORMATTED)),this.result.SHOW_AUTH||this.totalInfoBlockNode.appendChild(BX.create("DIV",{props:{className:"bx-soa-cart-total-button-container lic_condition"+(c?"":" visible-xs")},children:[BX.create("A",{props:{href:"javascript:void(0)",className:"btn btn-default btn-lg btn-order-save"},html:this.params.MESS_ORDER,events:{click:BX.proxy(this.clickOrderSaveAction,this)}})]})),this.editMobileTotalBlock()}},editMobileTotalBlock:function(){this.result.SHOW_AUTH?BX.removeClass(this.mobileTotalBlockNode,"visible-xs"):BX.addClass(this.mobileTotalBlockNode,"visible-xs"),BX.cleanNode(this.mobileTotalBlockNode),this.mobileTotalBlockNode.appendChild(this.totalInfoBlockNode.cloneNode(!0)),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";return e=e||"",t=t||"",s=(i=i||{}).error?[BX.create("A",{props:{className:"bx-soa-price-not-calc"},html:t,events:{click:BX.delegate(function(){this.animateScrollTo(this.deliveryBlockNode)},this)}})]:i.free?[BX.create("SPAN",{props:{className:"bx-soa-price-free"},html:t})]:[t],i.total&&(a+=" bx-soa-cart-total-line-total"),i.highlighted&&(a+=" bx-soa-cart-total-line-highlighted"),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;0==i?BX.removeClass(a,"bx-soa-table-fade-left"):BX.addClass(a,"bx-soa-table-fade-left"),0==s?BX.removeClass(a,"bx-soa-table-fade-right"):BX.addClass(a,"bx-soa-table-fade-right")},basketBlockScrollCheck:function(){var e,t,i,s,a,o,r,l,n=this.orderBlockNode.querySelectorAll("div.bx-soa-table-fade"),c=!1;for(a=0;a<n.length;a++)i=(e=n[a]).querySelector("div.bx-soa-item-table"),t=e.clientWidth,s=i.clientWidth||0,(c=c||t<s)?(r=(o=BX.firstChild(e)).scrollLeft,l=o.scrollWidth-(r+o.clientWidth),0==r?BX.removeClass(e,"bx-soa-table-fade-left"):BX.addClass(e,"bx-soa-table-fade-left"),0==l?BX.removeClass(e,"bx-soa-table-fade-right"):BX.addClass(e,"bx-soa-table-fade-right"),0==r&&0==l&&BX.addClass(e,"bx-soa-table-fade-right")):BX.removeClass(e,"bx-soa-table-fade-left bx-soa-table-fade-right")},totalBlockScrollCheck:function(){if(this.totalInfoBlockNode&&this.totalGhostBlockNode){var e,t=BX.GetWindowScrollPos().scrollTop,i=BX.pos(this.totalGhostBlockNode).top,s=BX.pos(this.orderBlockNode).bottom,a=0,o=BX("headerfixed");o&&BX.hasClass(o,"fixed")&&(a=o.offsetHeight+20),s-this.totalBlockNode.offsetHeight<t+20?BX.addClass(this.totalInfoBlockNode,"bx-soa-cart-total-bottom"):BX.removeClass(this.totalInfoBlockNode,"bx-soa-cart-total-bottom"),i<t+a&&!BX.hasClass(this.totalInfoBlockNode,"bx-soa-cart-total-fixed")?(e=this.totalInfoBlockNode.offsetWidth,BX.addClass(this.totalInfoBlockNode,"bx-soa-cart-total-fixed"),this.totalGhostBlockNode.style.paddingTop=this.totalInfoBlockNode.offsetHeight+"px",this.totalInfoBlockNode.style.width=e+"px"):t+a<i&&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(){this.totalInfoBlockNode&&this.totalGhostBlockNode&&BX.hasClass(this.totalInfoBlockNode,"bx-soa-cart-total-fixed")&&(this.totalInfoBlockNode.style.width=this.totalGhostBlockNode.offsetWidth+"px")},totalBlockFixFont:function(){var e,t,i=this.totalInfoBlockNode.querySelector(".bx-soa-cart-total-line.bx-soa-cart-total-line-total"),s=[];i&&(t=BX.lastChild(i),s.push({node:t,maxFontSize:28,smallestValue:!1,scaleBy:t.parentNode})),"Y"==this.params.SHOW_TOTAL_ORDER_BUTTON&&(e=this.totalInfoBlockNode.querySelector(".bx-soa-cart-total-button-container"))&&(t=BX.lastChild(e),s.push({node:t,maxFontSize:18,smallestValue:!1})),s.length&&BX.FixFontSize.init({objList:s,onAdaptiveResize:!0})},setAnalyticsDataLayer:function(e,t){if(this.params.DATA_LAYER_NAME){var i,s,a,o,r=[];for(s in this.result.GRID.ROWS)if(this.result.GRID.ROWS.hasOwnProperty(s)){for(o=this.result.GRID.ROWS[s],a=[],s=0;s<o.data.PROPS.length;s++)a.push(o.data.PROPS[s].VALUE);r.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:a.join("/"),quantity:o.data.QUANTITY})}switch(e){case"checkout":i={event:"checkout",ecommerce:{checkout:{products:r}}};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:r}}}}window[this.params.DATA_LAYER_NAME]=window[this.params.DATA_LAYER_NAME]||[],window[this.params.DATA_LAYER_NAME].push(i)}},isOrderSaveAllowed:function(){return!0===this.orderSaveAllowed},allowOrderSave:function(){this.orderSaveAllowed=!0},disallowOrderSave:function(){this.orderSaveAllowed=!1},initUserConsent:function(){BX.ready(BX.delegate(function(){var e=BX.UserConsent&&BX.UserConsent.load(this.orderBlockNode);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))}}}();
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.26 |
proxy
|
phpinfo
|
Settings