Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/catalog/product-form/dist/ |
Upload File : |
this.BX=this.BX||{};(function(t,e,s,i,o,a,n,r,l,c,d,u,p,h,m,g,I,b,T,f,E,O,C,P,_,A,R,v,y,k){"use strict";class L{}L.TOP="TOP";L.BOTTOM="BOTTOM";class S extends p.VuexBuilderModel{getName(){return"productList"}getState(){return{currency:"",taxIncluded:"N",basket:[],total:{sum:0,discount:0,taxSum:0,result:0}}}static getBaseProduct(){const t=R.Text.getRandom();return{offerId:null,selectorId:t,fields:{innerId:t,productId:null,skuId:null,code:null,type:null,module:null,sort:0,price:null,basePrice:null,priceExclusive:null,quantity:1,name:"",discount:0,discountRate:0,discountInfos:[],discountType:k.DiscountType.PERCENTAGE,tax:0,taxSum:0,taxIncluded:"N",measureCode:0,measureName:"",measureRatio:1,isCustomPrice:"N",additionalFields:[],properties:[],brands:[],weight:0,dimensions:{}},calculatedFields:[],catalogFields:{},showDiscount:"N",showTax:"N",skuTree:[],image:null,sum:0,catalogPrice:null,discountSum:0,detailUrl:"",encodedFields:null,errors:[]}}getActions(){return{resetBasket({commit:t}){t("clearBasket");t("addItem",{})},removeItem({dispatch:t,commit:e,state:s},i){e("deleteItem",i);if(s.basket.length===0){e("addItem",{})}else{s.basket.forEach(((t,s)=>{e("updateItem",{index:s,fields:{sort:s}})}))}t("calculateTotal")},changeItem:({dispatch:t,commit:e},s)=>{e("updateItem",s);t("calculateTotal")},setCurrency:({commit:t},e)=>{const s=e||"";t("setCurrency",s)},addItem:({dispatch:t,commit:e},s)=>{const i=s.item||{fields:{}};e("addItem",{item:i,position:s.position||L.TOP});t("calculateTotal")},calculateTotal:({commit:t,state:e})=>{const s={sum:0,taxSum:0,discount:0,result:0};e.basket.forEach((t=>{const e=R.Text.toNumber(t.fields.basePrice||0);const i=R.Text.toNumber(t.fields.quantity||0);const o=R.Text.toNumber(t.fields.discount||0);const a=R.Text.toNumber(t.fields.taxSum||0);s.sum+=e*i;s.result+=R.Text.toNumber(t.sum);s.discount+=o*i;s.taxSum+=a*i}));s.discount=s.discount>s.sum?s.sum:s.discount;t("setTotal",s)}}}getGetters(){return{getBasket:t=>()=>t.basket,getBaseProduct:()=>()=>S.getBaseProduct()}}getMutations(){return{addItem:(t,e)=>{let s=S.getBaseProduct();s=Object.assign(s,e.item);if(e.position===L.BOTTOM){t.basket.push(s)}else{t.basket.unshift(s)}t.basket.forEach(((t,e)=>{t.fields.sort=e}))},updateItem:(t,e)=>{if(R.Type.isNil(t.basket[e.index])){A.Vue.set(t.basket,e.index,S.getBaseProduct())}t.basket[e.index]=Object.assign(t.basket[e.index],e.product)},clearBasket:t=>{t.basket=[]},deleteItem:(t,e)=>{t.basket.splice(e.index,1);t.basket.forEach(((t,e)=>{t.fields.sort=e}))},setErrors:(t,e)=>{t.errors=e},clearErrors:t=>{t.errors=[]},setCurrency:(t,e)=>{t.currency=e},setTotal:(t,e)=>{const s=e;if(R.Type.isStringFilled(t.currency)){for(const i in e){if(e.hasOwnProperty(i)){s[i]=y.CurrencyCore.currencyFormat(e[i],t.currency)}}}t.total=Object.assign(t.total,s)}}}}const M=Object.freeze({databaseConfig:{name:"catalog.product-form"},templateName:"bx-form",templatePanelButtons:"bx-panel-buttons",templatePanelCompilation:"bx-panel-compilation",templateRowName:"bx-form-row",templateFieldInlineSelector:"bx-field-inline-selector",templateFieldPrice:"bx-field-price",templateFieldResultSum:"bx-field-result-sum",templateFieldQuantity:"bx-field-quantity",templateFieldDiscount:"bx-field-discount",templateFieldTax:"bx-field-tax",templateFieldBrand:"bx-field-brand",templateSummaryTotal:"bx-summary-total",moduleId:"catalog"});class D{}D.PRODUCT_SELECTOR="product-selector";D.IMAGE_EDITOR="image-editor";D.QUANTITY="quantity";D.PRICE="price";D.RESULT="result";D.DISCOUNT="discount";D.TAX="tax";D.BRAND="brand";D.MEASURE="measure";class N{}N.EMPTY_PRODUCT_SELECTOR=0;N.EMPTY_IMAGE=1;N.EMPTY_QUANTITY=2;N.EMPTY_PRICE=3;N.EMPTY_BRAND=4;N.IS_NULLABLE_PRICE=5;class B{}B.REGULAR="REGULAR";B.READ_ONLY="READ_ONLY";B.COMPILATION="COMPILATION";B.COMPILATION_READ_ONLY="COMPILATION_READ_ONLY";A.Vue.component(M.templateFieldQuantity,{props:{measureCode:Number,measureRatio:Number,measureName:String,quantity:Number,editable:Boolean,saveableMeasure:Boolean,hasError:Boolean,options:Object},created(){this.onInputQuantityHandler=R.Runtime.debounce(this.onInputQuantity,500,this)},methods:{onInputQuantity(t){if(!this.editable){return}t.target.value=t.target.value.replace(/[^.\d]/g,".");const e=R.Text.toNumber(t.target.value);const s=t.target.value.substr(-1);if(s==="."){return}this.changeQuantity(e)},calculateCorrectionFactor(t,e){let s=t;let i=e;let o=1;while(!(Number.isInteger(s)&&Number.isInteger(i))){o*=10;s=t*o;i=e*o}return o},incrementValue(){if(!this.editable){return}const t=this.calculateCorrectionFactor(this.quantity,this.measureRatio);const e=(this.quantity*t+this.measureRatio*t)/t;this.changeQuantity(e)},decrementValue(){if(this.quantity>this.measureRatio&&this.editable){const t=this.calculateCorrectionFactor(this.quantity,this.measureRatio);const e=(this.quantity*t-this.measureRatio*t)/t;this.changeQuantity(e)}},changeQuantity(t){this.$emit("onChangeQuantity",t)},showPopupMenu(t){if(!this.editable||!R.Type.isArray(this.options.measures)){return}const e=[];this.options.measures.forEach((t=>{e.push({text:t.SYMBOL,item:t,onclick:this.selectMeasure})}));if(e.length>0){this.popupMenu=new h.Menu({bindElement:t,items:e});this.popupMenu.show()}},selectMeasure(t,e){var s,i;this.$emit("onSelectMeasure",{code:(s=e.options)==null?void 0:s.item.CODE,name:(i=e.options)==null?void 0:i.item.SYMBOL});if(this.popupMenu){this.popupMenu.close()}}},template:`\n\t\t<div class="catalog-pf-product-input-wrapper" v-bind:class="{ 'ui-ctl-danger': hasError }">\n\t\t\t<input \t\n\t\t\t\ttype="text" class="catalog-pf-product-input"\n\t\t\t\tv-bind:class="{ 'catalog-pf-product-input--disabled': !editable }"\n\t\t\t\t:value="quantity"\n\t\t\t\t@input="onInputQuantityHandler"\n\t\t\t\t:disabled="!editable"\n\t\t\t\tdata-name="quantity"\n\t\t\t\t:data-value="quantity"\n\t\t\t>\n\t\t\t<div \n\t\t\t\tclass="catalog-pf-product-input-info catalog-pf-product-input-info--action" \n\t\t\t\t@click="showPopupMenu($event.target)"\n\t\t\t>\n\t\t\t\t<span :title="measureName">{{ measureName }}</span>\n\t\t\t</div>\n\t\t</div>\n\t`});A.Vue.component(M.templateFieldPrice,{props:{selectorId:String,price:Number,editable:Boolean,hasError:Boolean,options:Object},created(){this.onInputPriceHandler=R.Runtime.debounce(this.onInputPrice,500,this)},mounted(){BX.UI.Hint.init()},methods:{onInputPrice(t){if(!this.editable){return}t.target.value=t.target.value.replace(/[^.,\d]/g,"");if(t.target.value===""){t.target.value=0}const e=t.target.value.substr(-1);if(e===","){t.target.value=t.target.value.replace(",",".")}let s=R.Text.toNumber(t.target.value);if(e==="."||e===","){return}if(s<0){s*=-1}this.$emit("onChangePrice",s)}},computed:{localize(){return A.Vue.getFilteredPhrases("CATALOG_")},currencySymbol(){return this.options.currencySymbol||""},hintText(){var t;if(!this.editable&&!((t=this.options)!=null&&t.isCatalogPriceEditEnabled)){return R.Loc.getMessage("CATALOG_FORM_PRICE_ACCESS_DENIED_HINT")}return null}},template:`\n\t\t<div \n\t\t\tclass="catalog-pf-product-input-wrapper" \n\t\t\t:class="{ 'ui-ctl-danger': hasError, '.catalog-pf-product-input-wrapper--disabled': !editable }"\n\t\t\t:data-hint="hintText"\n\t\t\tdata-hint-no-icon\n\t\t>\n\t\t\t<input \ttype="text" class="catalog-pf-product-input catalog-pf-product-input--align-right"\n\t\t\t\t\tv-bind:class="{ 'catalog-pf-product-input--disabled': !editable }"\n\t\t\t\t\tv-model.lazy="price"\n\t\t\t\t\t@input="onInputPriceHandler"\n\t\t\t\t\t:disabled="!editable"\n\t\t\t\t\tdata-name="price"\n\t\t\t\t\t:data-value="price"\n\t\t\t>\n\t\t\t<div class="catalog-pf-product-input-info" v-html="currencySymbol"></div>\n\t\t</div>\n\t`});A.Vue.component(M.templateFieldDiscount,{props:{editable:Boolean,options:Object,discount:Number,discountType:Number,discountRate:Number},created(){this.onInputDiscount=R.Runtime.debounce(this.onChangeDiscount,500,this);this.currencySymbol=this.options.currencySymbol},mounted(){BX.UI.Hint.init()},methods:{onChangeType(t,e){var s;if(!this.editable){return}const i=R.Text.toNumber(e==null?void 0:(s=e.options)==null?void 0:s.type)===k.DiscountType.MONETARY?k.DiscountType.MONETARY:k.DiscountType.PERCENTAGE;this.$emit("changeDiscountType",i);if(this.popupMenu){this.popupMenu.close()}},onChangeDiscount(t){const e=R.Text.toNumber(t.target.value)||0;if(e===R.Text.toNumber(this.discount)||!this.editable){return}this.$emit("changeDiscount",e)},showPopupMenu(t){if(!this.editable||!R.Type.isArray(this.options.allowedDiscountTypes)){return}const e=[];if(this.options.allowedDiscountTypes.includes(k.DiscountType.PERCENTAGE)){e.push({text:"%",onclick:this.onChangeType,type:k.DiscountType.PERCENTAGE})}if(this.options.allowedDiscountTypes.includes(k.DiscountType.MONETARY)){e.push({text:this.currencySymbol,onclick:this.onChangeType,type:k.DiscountType.MONETARY})}if(e.length>0){this.popupMenu=new h.Menu({bindElement:t,items:e});this.popupMenu.show()}}},computed:{getDiscountInputValue(){if(R.Text.toNumber(this.discountType)===k.DiscountType.PERCENTAGE){return R.Text.toNumber(this.discountRate)}return R.Text.toNumber(this.discount)},getDiscountSymbol(){return R.Text.toNumber(this.discountType)===k.DiscountType.PERCENTAGE?"%":this.currencySymbol},wrapperClasses(){return{"catalog-pf-product-input-wrapper--disabled":!this.editable}},hintText(){var t;if(!this.editable&&!((t=this.options)!=null&&t.isCatalogDiscountSetEnabled)){return R.Loc.getMessage("CATALOG_FORM_DISCOUNT_ACCESS_DENIED_HINT")}return null}},template:`\n\t\t<div\n\t\t\tclass="catalog-pf-product-input-wrapper catalog-pf-product-input-wrapper--left"\n\t\t\t:class="wrapperClasses"\n\t\t\t:data-hint="hintText"\n\t\t\tdata-hint-no-icon\n\t\t>\n\t\t\t<input class="catalog-pf-product-input catalog-pf-product-input--align-right catalog-pf-product-input--right"\n\t\t\t\tref="discountInput"\n\t\t\t\tv-bind:class="{ 'catalog-pf-product-input--disabled': !editable }"\n\t\t\t\t:value="getDiscountInputValue"\n\t\t\t\t:v-model="discountRate"\n\t\t\t\t@input="onInputDiscount"\n\t\t\t\tplaceholder="0"\n\t\t\t\t:disabled="!editable"\n\t\t\t\tdata-name="discount"\n\t\t\t\t:data-value="getDiscountInputValue"\n\t\t\t/>\n\t\t\t<div class="catalog-pf-product-input-info catalog-pf-product-input-info--action"\n\t\t\t\t@click="showPopupMenu">\n\t\t\t\t<span v-html="getDiscountSymbol"></span>\n\t\t\t</div>\n\t\t</div>\n\t`});A.Vue.component(M.templateFieldTax,{props:{taxId:Number,editable:Boolean,options:Object},data(){return{taxValue:this.getTaxList()[this.taxId]||0}},methods:{onChangeValue(t,e){var s,i;const o=R.Text.toNumber(e==null?void 0:(s=e.options)==null?void 0:s.item);if(o===R.Text.toNumber(this.taxValue)||!this.editable){return}this.$emit("changeTax",{taxValue:o,taxId:e==null?void 0:(i=e.options)==null?void 0:i.id});if(this.popupMenu){this.popupMenu.close()}},getTaxList(){return R.Type.isArray(this.options.taxList)?this.options.taxList:[]},showPopupMenu(t){if(!this.editable||!R.Type.isArray(this.options.taxList)){return}const e=[];this.options.taxList.forEach(((t,s)=>{e.push({id:s,text:t+"%",item:t,onclick:this.onChangeValue})}));if(e.length>0){this.popupMenu=new h.Menu({bindElement:t,items:e});this.popupMenu.show()}}},template:`\n\t\t<div class="catalog-pf-product-input-wrapper catalog-pf-product-input-wrapper--right" @click="showPopupMenu">\n\t\t\t<div class="catalog-pf-product-input">{{this.taxValue}}%</div>\n\t\t\t<div class="catalog-pf-product-input-info catalog-pf-product-input-info--dropdown"></div>\n\t\t</div>\n\t`});A.Vue.component(M.templateFieldInlineSelector,{props:{editable:Boolean,basketLength:Number,options:Object,basketItem:Object,model:Object},data(){return{currencySymbol:null,productSelector:null,imageControlId:null,selectorId:this.basketItem.selectorId}},created(){v.EventEmitter.subscribe("BX.Catalog.ProductSelector:onProductSelect",this.onProductSelect.bind(this));v.EventEmitter.subscribe("BX.Catalog.ProductSelector:onChange",this.onProductChange.bind(this));v.EventEmitter.subscribe("BX.Catalog.ProductSelector:onClear",this.onProductClear.bind(this));v.EventEmitter.subscribe(this.$root.$app,"onChangeCompilationMode",this.changeProductSelectorImageRequire.bind(this))},mounted(){this.productSelector=new c.ProductSelector(this.selectorId,this.prepareSelectorParams());this.productSelector.renderTo(this.$refs.selectorWrapper)},methods:{changeProductSelectorImageRequire(t){var e,s;const i=(e=t.getData())==null?void 0:e.isCompilationMode;const o=(s=t.getData())==null?void 0:s.isFacebookForm;this.productSelector.setConfig("ENABLE_EMPTY_IMAGES_ERROR",i&&o);this.productSelector.checkEmptyImageError();this.productSelector.layoutErrors()},prepareSelectorParams(){const t={NAME:this.getField("name")||""};if(!R.Type.isNil(this.getField("basePrice"))){t.PRICE=this.getField("basePrice");t.CURRENCY=this.options.currency}const e=this.basketItem.offerId;const s=this.options.facebookFailProducts;const i=R.Type.isObject(s)&&s.hasOwnProperty(e);const o={iblockId:this.options.iblockId,basePriceId:this.options.basePriceId,currency:this.options.currency,skuTree:this.getDefaultSkuTree(),fileInputId:"",morePhotoValues:[],fileInput:"",model:this.model,config:{DETAIL_PATH:this.basketItem.detailUrl||"",ENABLE_SEARCH:true,ENABLE_INPUT_DETAIL_LINK:true,ENABLE_IMAGE_CHANGE_SAVING:true,ENABLE_EMPTY_PRODUCT_ERROR:this.options.enableEmptyProductError||this.isRequiredField(D.PRODUCT_SELECTOR),ENABLE_EMPTY_IMAGES_ERROR:this.isRequiredField(D.IMAGE_EDITOR),ROW_ID:this.selectorId,ENABLE_SKU_SELECTION:this.editable,HIDE_UNSELECTED_ITEMS:this.options.hideUnselectedProperties,URL_BUILDER_CONTEXT:this.options.urlBuilderContext,VIEW_FORMAT:this.options.isShortProductViewFormat?c.ProductSelector.SHORT_VIEW_FORMAT:c.ProductSelector.FULL_VIEW_FORMAT},failedProduct:i,mode:this.editable?c.ProductSelector.MODE_EDIT:c.ProductSelector.MODE_VIEW,fields:t};const a=this.basketItem.image;if(R.Type.isObject(a)){o.fileView=a.preview;o.fileInput=a.input;o.fileInputId=a.id;o.morePhotoValues=a.values}return o},isEnabledSaving(){return this.options.enableCatalogSaving&&this.basketItem.hasEditRights},isRequiredField(t){return R.Type.isArray(this.options.requiredFields)&&this.options.requiredFields.includes(t)},getDefaultSkuTree(){let t=this.basketItem.skuTree||{};if(R.Type.isStringFilled(t)){t=JSON.parse(t)}return t},getField(t,e=null){return this.basketItem.fields[t]||e},onProductSelect(t){const e=t.getData();if(R.Type.isStringFilled(e.selectorId)&&e.selectorId===this.productSelector.getId()){this.$emit("onProductSelect")}},onProductChange(t){const e=t.getData();if(R.Type.isStringFilled(e.selectorId)&&e.selectorId===this.productSelector.getId()){const t=e.fields.BASE_PRICE;const s={BASE_PRICE:t,MODULE:"catalog",NAME:e.fields.NAME,ID:e.fields.ID,PRODUCT_ID:e.fields.PRODUCT_ID,TYPE:e.fields.TYPE,SKU_ID:e.fields.SKU_ID,PROPERTIES:e.fields.PROPERTIES,URL_BUILDER_CONTEXT:this.options.urlBuilderContext,CUSTOMIZED:R.Type.isNil(e.fields.PRICE)||e.fields.CUSTOMIZED==="Y"?"Y":"N",MEASURE_CODE:e.fields.MEASURE_CODE,MEASURE_NAME:e.fields.MEASURE_NAME,MORE_PHOTO:e.morePhoto,BRANDS:e.fields.BRANDS,IS_NEW:e.isNew};this.$emit("onProductChange",s)}},onProductClear(t){const e=t.getData();if(R.Type.isStringFilled(e.selectorId)&&e.selectorId===this.productSelector.getId()){this.$emit("onProductClear")}}},template:`\n\t\t\t<div class='catalog-pf-product-item-section' :id='selectorId' ref='selectorWrapper'></div>\n\t\t`});let F=t=>t,x,w,U;A.Vue.component(M.templateFieldBrand,{props:{brands:[Array,String],options:Object,editable:Boolean,hasError:Boolean,selectorId:String},data(){return{cache:new R.Cache.MemoryCache}},created(){if(this.editable){this.selector=new d.TagSelector({id:this.selectorId,dialogOptions:{id:this.selectorId,context:"CATALOG_BRANDS",preselectedItems:this.getPreselectedBrands(),events:{"Item:onSelect":this.onBrandChange.bind(this),"Item:onDeselect":this.onBrandChange.bind(this),"Search:onItemCreateAsync":this.createBrand.bind(this)},searchTabOptions:{stub:true,stubOptions:{title:R.Tag.message(x||(x=F`${0}`),"CATALOG_FORM_BRAND_SELECTOR_IS_EMPTY_TITLE"),subtitle:R.Tag.message(w||(w=F`${0}`),"CATALOG_FORM_BRAND_SELECTOR_IS_EMPTY_SUBTITLE"),arrow:true}},searchOptions:{allowCreateItem:true},entities:[{id:"brand",options:{iblockId:this.options.iblockId},dynamicSearch:true,dynamicLoad:true}]}});this.isSelectedByProductChange=false;this.$parent.$on("onInlineSelectorProductChange",this.selectCurrentBrands.bind(this))}},mounted(){if(this.editable){this.selector.renderTo(this.$refs.brandSelectorWrapper)}else{this.brands.forEach(((t,e,s)=>{const i=e<s.length-1?", ":"";this.$refs.brandSelectorWrapper.appendChild(R.Tag.render(U||(U=F` <span> <span class="catalog-pf-product-input-brand-read-only-item" style="background-image:url('${0}');" ></span> ${0} </span> `),t["IMAGE_SRC"],t["NAME"]+i))}))}},methods:{selectCurrentBrands(t){this.isSelectedByProductChange=true;this.brands=t;if(this.selector.getDialog().isLoaded()){this.selector.getDialog().deselectAll();this.selectDialogItems()}else{this.selector.getDialog().load();v.EventEmitter.subscribe(this.selector.getDialog(),"onLoad",this.selectDialogItems.bind(this))}},selectDialogItems(){this.brands.forEach((t=>{const e=this.selector.getDialog().getItem({id:t["VALUE"],entityId:"brand"});e.select()}));this.isSelectedByProductChange=false},getPreselectedBrands(){if(!R.Type.isArray(this.brands)||this.brands.length===0){return[]}return this.brands.map((t=>["brand",t["VALUE"]]))},onBrandChange(t){const e=t.getTarget().getSelectedItems();const s=[];if(R.Type.isArray(e)){e.forEach((t=>{s.push({VALUE:t.getId(),NAME:t.getTitle(),IMAGE_SRC:t.getAvatar()})}))}const i={resultValues:s,isSelectedByProductChange:this.isSelectedByProductChange};this.$emit("changeBrand",i)},createBrand(t){const{searchQuery:e}=t.getData();const s=this.options.iblockId;return new Promise(((i,o)=>{const a=t.getTarget();const n={name:e.getQuery(),iblockId:s};a.showLoader();R.ajax.runAction("catalog.productForm.createBrand",{data:{fields:n}}).then((t=>{a.hideLoader();const s=a.addItem({id:t.data.id,entityId:"brand",title:e.getQuery(),tabs:a.getRecentTab().getId()});if(s){s.select()}a.hide();i()})).catch((()=>o()))}))}},computed:{localize(){return A.Vue.getFilteredPhrases("CATALOG_")}},template:`\n\t\t<div class="catalog-pf-product-control ui-ctl-w100" v-bind:class="{ 'ui-ctl-danger': hasError }">\n\t\t\t<div class="catalog-pf-product-input-wrapper" ref="brandSelectorWrapper" :id="selectorId"></div>\n\t\t</div>\n\t`});A.Vue.component(M.templateFieldResultSum,{props:{sum:Number,editable:Boolean,options:Object},created(){this.onInputSumHandler=R.Runtime.debounce(this.onInputSum,500,this)},methods:{onInputSum(t){if(!this.editable){return}t.target.value=t.target.value.replace(/[^.,\d]/g,"");if(t.target.value===""){t.target.value=0}const e=t.target.value.substr(-1);if(e===","){t.target.value=t.target.value.replace(",",".")}let s=R.Text.toNumber(t.target.value);if(e==="."||e===","){return}if(s<0){s*=-1}this.$emit("onChangeSum",s)}},computed:{localize(){return A.Vue.getFilteredPhrases("CATALOG_")},currencySymbol(){return this.options.currencySymbol||""}},template:`\n\t\t<div class="catalog-pf-product-input-wrapper">\n\t\t\t<input \ttype="text" \n\t\t\t\t\tclass="catalog-pf-product-input catalog-pf-product-input--align-right"\n\t\t\t\t\t:class="{ 'catalog-pf-product-input--disabled': !editable }"\n\t\t\t\t\t:value="sum"\n\t\t\t\t\t@input="onInputSumHandler"\n\t\t\t\t\t:disabled="!editable"\n\t\t\t\t\tdata-name="sum"\n\t\t\t\t\t:data-value="sum"\n\t\t\t>\n\t\t\t<div class="catalog-pf-product-input-info"\n\t\t\t\t :class="{ 'catalog-pf-product-input--disabled': !editable }"\n\t\t\t\t v-html="currencySymbol"\n\t\t\t></div>\n\t\t</div>\n\t`});A.Vue.component(M.templateRowName,{props:{basketItem:Object,basketItemIndex:Number,basketLength:Number,countItems:Number,options:Object,mode:String},data(){return{model:null,currencySymbol:null,productSelector:null,imageControlId:null,selectorId:this.basketItem.selectorId,defaultMeasure:{name:"",id:null},blocks:{productSelector:D.PRODUCT_SELECTOR,quantity:D.QUANTITY,price:D.PRICE,result:D.RESULT,discount:D.DISCOUNT,tax:D.TAX,brand:D.BRAND,measure:D.MEASURE},errorCodes:{emptyProductSelector:N.EMPTY_PRODUCT_SELECTOR,emptyImage:N.EMPTY_IMAGE,emptyQuantity:N.EMPTY_QUANTITY,emptyPrice:N.EMPTY_PRICE,emptyBrand:N.EMPTY_BRAND}}},created(){this.currencySymbol=this.options.currencySymbol;this.model=this.initModel();if(R.Type.isArray(this.options.measures)){this.options.measures.map((t=>{if(t["IS_DEFAULT"]==="Y"){this.defaultMeasure.name=t.SYMBOL;this.defaultMeasure.code=t.CODE;if(!this.basketItem.fields.measureName&&!this.basketItem.fields.measureCode){this.changeProductFields({measureCode:this.defaultMeasure.code,measureName:this.defaultMeasure.name})}}}))}},methods:{prepareModelFields(){var t,e,s,i,o,a,n,r;const l=this.basketItem.fields;const c=R.Text.toNumber(l.price);let d=l.basePrice?l.basePrice:l.price;if(!R.Type.isNil(d)){d=R.Text.toNumber(d)}return{NAME:((t=this.basketItem.fields)==null?void 0:t.name)||"",MODULE:((e=this.basketItem.fields)==null?void 0:e.module)||"",PROPERTIES:((s=this.basketItem.fields)==null?void 0:s.properties)||{},BRAND:((i=this.basketItem.fields)==null?void 0:i.brand)||{},PRODUCT_ID:(o=this.basketItem.fields)==null?void 0:o.productId,ID:((a=this.basketItem.fields)==null?void 0:a.skuId)||((n=this.basketItem.fields)==null?void 0:n.productId),SKU_ID:(r=this.basketItem.fields)==null?void 0:r.skuId,QUANTITY:R.Text.toNumber(l.quantity),BASE_PRICE:d,PRICE:c,PRICE_NETTO:d,PRICE_BRUTTO:c,PRICE_EXCLUSIVE:this.basketItem.fields.priceExclusive||c,DISCOUNT_TYPE_ID:R.Text.toNumber(l.discountType)||k.DiscountType.PERCENTAGE,DISCOUNT_RATE:R.Text.toNumber(l.discountRate),DISCOUNT_SUM:R.Text.toNumber(l.discount),TAX_INCLUDED:l.taxIncluded||this.options.taxIncluded,TAX_RATE:l.tax||0,CUSTOMIZED:l.isCustomPrice||"N",MEASURE_CODE:l.measureCode||this.defaultMeasure.code,MEASURE_NAME:l.measureName||this.defaultMeasure.name}},initModel(){var t,e,s;const i=R.Text.toNumber((t=this.basketItem.fields)==null?void 0:t.productId);const o=R.Text.toNumber((e=this.basketItem.fields)==null?void 0:e.skuId);const a=new u.ProductModel({iblockId:R.Text.toNumber(this.options.iblockId),basePriceId:R.Text.toNumber(this.options.basePriceId),currency:this.options.currency,isStoreCollectable:false,isSimpleModel:R.Type.isStringFilled((s=this.basketItem.fields)==null?void 0:s.name)&&i<=0&&o<=0,fields:this.prepareModelFields()});v.EventEmitter.subscribe(a,"onErrorsChange",this.onErrorsChange);return a},onErrorsChange(){const t=Object.values(this.model.getErrorCollection().getErrors());this.changeRowData({errors:t});this.$emit("emitErrorsChange",{index:this.basketItemIndex,errors:t})},setCalculatedFields(t){this.model.getCalculator().setFields(t);const e={calculatedFields:t};if(R.Text.toNumber(t.SUM)>=0){e.sum=R.Text.toNumber(t.SUM)}if(!R.Type.isNil(t.ID)){e.offerId=R.Text.toNumber(t.ID)}this.changeRowData(e)},getProductFieldsFromModel(){const t=this.model.getFields();return{productId:t.PRODUCT_ID,skuId:t.SKU_ID,name:t.NAME,module:t.MODULE,basePrice:t.BASE_PRICE,price:t.PRICE,priceExclusive:t.PRICE_EXCLUSIVE,quantity:t.QUANTITY,discountRate:t.DISCOUNT_RATE,discount:t.DISCOUNT_SUM,discountType:t.DISCOUNT_TYPE_ID,isCustomPrice:t.CUSTOMIZED||"N",measureCode:t.MEASURE_CODE||"",measureName:t.MEASURE_NAME||"",properties:t.PROPERTIES||{},brands:t.BRANDS||[],taxId:t.TAX_ID,type:t.TYPE,morePhoto:t.MORE_PHOTO}},changeRowData(t){this.$emit("changeRowData",{index:this.basketItemIndex,product:t})},changeProductFields(t){t=Object.assign(this.basketItem.fields,t);this.$emit("changeProduct",{index:this.basketItemIndex,product:{fields:t},skipFieldChecking:this.model.isSimple()&&this.basketLength===1})},saveCatalogField(t){return this.model.save(t)},onProductChange(t){t=Object.assign(this.model.getCalculator().calculateBasePrice(t.BASE_PRICE),t);this.changeRowData({catalogPrice:t.BASE_PRICE});this.processFields(t);this.setCalculatedFields(t);this.$emit("onInlineSelectorProductChange",this.basketItem.fields.brands)},onProductSelect(){this.changeProductFields({additionalFields:{originBasketId:"",originProductId:""}})},onProductClear(){if(R.Type.isPlainObject(this.options.facebookFailProducts)){delete this.options.facebookFailProducts[this.basketItem.offerId]}},onChangeSum(t){const e=t/R.Text.toNumber(this.basketItem.fields.quantity);if(this.isEditablePrice()){const t=e+R.Text.toNumber(this.basketItem.fields.discount);this.onChangePrice(t)}else if(this.isEditableDiscount()){const t=this.basketItem.fields.basePrice-e;this.toggleDiscount("Y");this.changeDiscountType(k.DiscountType.MONETARY);this.changeDiscount(t)}},onChangePrice(t){this.changeBasePrice(t);if(this.isSaveablePrice()){this.saveCatalogField(["BASE_PRICE"]).then((()=>{this.changeRowData({catalogPrice:t})}))}},onSelectMeasure(t){this.changeMeasure(t);this.model.showSaveNotifier("measureChanger_"+this.selectorId,{title:R.Loc.getMessage("CATALOG_PRODUCT_MODEL_SAVING_NOTIFICATION_MEASURE_CHANGED_QUERY"),events:{onSave:()=>{this.saveCatalogField(["MEASURE_CODE","MEASURE_NAME"])}}})},toggleDiscount(t){if(this.isReadOnly){return}this.changeRowData({showDiscount:t});if(t==="Y"){setTimeout((()=>{var t,e,s,i;return(t=this.$refs)==null?void 0:(e=t.discountWrapper)==null?void 0:(s=e.$refs)==null?void 0:(i=s.discountInput)==null?void 0:i.focus()}))}},toggleTax(t){this.changeRowData({showTax:t})},processFields(t){this.model.getCalculator().setFields(t);this.model.setFields(t);this.changeProductFields({...this.basketItem.fields,...this.getProductFieldsFromModel()});if(!R.Type.isNil(t.SUM)){this.changeRowData({sum:t.SUM})}},changeBrand(t){const e=R.Type.isArray(t.resultValues)?t.resultValues:[];const s=t.isSelectedByProductChange;this.processFields({BRANDS:e});if(!s){this.saveCatalogField(["BRANDS"])}},onChangeQuantity(t){this.model.getCalculator().setFields();this.processFields(this.model.getCalculator().calculateQuantity(t))},changeMeasure(t){const e=this.basketItem.fields;e["measureCode"]=t.code;e["measureName"]=t.name;this.processFields({MEASURE_CODE:t.code,MEASURE_NAME:t.name})},changeBasePrice(t){this.model.setField("BASE_PRICE",t);this.processFields(this.model.getCalculator().calculateBasePrice(t))},changePrice(t){this.model.getCalculator().setFields(this.model.getCalculator().calculateBasePrice(this.basketItem.catalogPrice));const e=this.model.getCalculator().calculatePrice(t);this.processFields(e);return e},changeDiscountType(t){const e=R.Text.toNumber(t)===k.DiscountType.MONETARY?k.DiscountType.MONETARY:k.DiscountType.PERCENTAGE;const s=this.model.getCalculator().calculateDiscountType(e);this.processFields(s);return s},changeDiscount(t){const e=this.model.getCalculator().calculateDiscount(t);this.processFields(e);return e},changeTax(t){const e=this.model.getCalculator().calculateTax(t.taxValue);e.TAX_ID=t.taxId;this.processFields(e);return e},changeTaxIncluded(t){if(t===this.basketItem.taxIncluded||!this.isEditableField(this.blocks.tax)){return}const e=this.model.getCalculator().calculateTaxIncluded(t);this.processFields(e);return e},removeItem(){if(R.Type.isPlainObject(this.options.facebookFailProducts)){delete this.options.facebookFailProducts[this.basketItem.offerId]}this.$emit("removeItem",{index:this.basketItemIndex})},isRequiredField(t){return R.Type.isArray(this.options.requiredFields)&&this.options.requiredFields.includes(t)},isVisibleBlock(t){return R.Type.isArray(this.options.visibleBlocks)&&this.options.visibleBlocks.includes(t)},isCompilationMode(){return this.mode===B.COMPILATION_READ_ONLY||this.mode===B.COMPILATION},getPriceValue(){if(this.isCompilationMode()){return this.isEditableField(this.blocks.price)?this.basketItem.fields.basePrice:this.basketItem.catalogPrice}return this.basketItem.fields.basePrice},getQuantityValue(){if(this.isCompilationMode()){return this.isEditableField(this.blocks.quantity)?this.basketItem.fields.quantity:1}return this.basketItem.fields.quantity},getSumValue(){if(this.isCompilationMode()){return this.isEditableField(this.blocks.result)?this.basketItem.sum:this.basketItem.catalogPrice}return this.basketItem.sum},getDiscountValue(){if(this.isCompilationMode()){return this.isEditableField(this.blocks.discount)?this.basketItem.fields.discount:0}return this.basketItem.fields.discount},getDiscountRateValue(){if(this.isCompilationMode()){return this.isEditableField(this.blocks.discount)?this.basketItem.fields.discountRate:0}return this.basketItem.fields.discountRate},hasError(t){if(this.basketItem.errors.length===0||this.model.isEmpty()&&!this.model.isChanged()){return false}const e=this.basketItem.errors.filter((e=>e.code===t));return e.length>0},isEditablePrice(){var t,e;return((t=this.options)==null?void 0:t.editableFields.includes(D.PRICE))&&(this.model.isNew()||!this.model.isCatalogExisted()||((e=this.options)==null?void 0:e.isCatalogPriceEditEnabled))},isEditableDiscount(){var t;return(t=this.options)==null?void 0:t.isCatalogDiscountSetEnabled},isSaveablePrice(){return this.options.isCatalogPriceEditEnabled&&this.options.isCatalogPriceSaveEnabled&&this.model.isNew()},isEditableField(t){var e,s;if(t===D.PRICE&&!this.isEditablePrice()){return false}else if(t===D.DISCOUNT&&!this.isEditableDiscount()){return false}else if(t===D.RESULT&&!((e=this.options)!=null&&e.isCatalogDiscountSetEnabled)&&!this.isEditablePrice()){return false}return(s=this.options)==null?void 0:s.editableFields.includes(t)},getHint(t){var e;return(e=this.options)==null?void 0:e.fieldHints[t]},hasHint(t){var e;if(t===D.PRICE&&!((e=this.options)!=null&&e.isCatalogPriceEditEnabled)){return!this.isEditablePrice()}return false}},watch:{taxIncluded(t,e){if(t!==e){this.changeTaxIncluded(t)}}},computed:{localize(){return A.Vue.getFilteredPhrases("CATALOG_FORM_")},showDiscount(){return this.showDiscountBlock&&this.basketItem.showDiscount==="Y"},getBrandsSelectorId(){return this.basketItem.selectorId+"_brands"},getPriceExclusive(){return this.basketItem.fields.priceExclusive||this.basketItem.fields.price},showDiscountBlock(){return this.options.showDiscountBlock==="Y"&&this.isVisibleBlock(this.blocks.discount)&&!this.isReadOnly},showTaxBlock(){return this.options.showTaxBlock==="Y"&&this.getTaxList.length>0&&this.isVisibleBlock(this.blocks.tax)&&!this.isReadOnly},showRemoveIcon(){if(this.isReadOnly){return false}if(this.countItems>1){return true}return!R.Type.isNil(this.basketItem.offerId)},showTaxSelector(){return this.basketItem.showTax==="Y"},showBasePrice(){return this.basketItem.fields.discount>0||R.Text.toNumber(this.basketItem.fields.price)!==R.Text.toNumber(this.basketItem.fields.basePrice)},getMeasureName(){return this.basketItem.fields.measureName||this.defaultMeasure.name},getMeasureCode(){return this.basketItem.fields.measureCode||this.defaultMeasure.code},getTaxList(){return R.Type.isArray(this.options.taxList)?this.options.taxList:[]},taxIncluded(){return this.basketItem.fields.taxIncluded},isTaxIncluded(){return this.taxIncluded==="Y"},isReadOnly(){return this.mode===B.READ_ONLY||this.mode===B.COMPILATION_READ_ONLY},getErrorsText(){let t=this.basketItem.errors.length!==0&&!this.model.isEmpty()&&this.model.isChanged()?R.Loc.getMessage("CATALOG_PRODUCT_MODEL_ERROR_NOTIFICATION"):"";const e=this.basketItem.offerId;const s=this.options.facebookFailProducts;const i=R.Type.isObject(s)?s[e]:null;if(i){if(t){t+="<br>"}t+=R.Loc.getMessage("CATALOG_FORM_FACEBOOK_ERROR")+":<br>"+i}return t},hasSku(){return this.basketItem.skuTree!==""}},template:`\n\t\t<div>\n\t\t\t<div class="catalog-pf-product-item" v-bind:class="{ 'catalog-pf-product-item--borderless': !isReadOnly && basketItemIndex === 0 }">\n\t\t\t\t<div class="catalog-pf-product-item--remove" @click="removeItem" v-if="showRemoveIcon"></div>\n\t\t\t\t<div class="catalog-pf-product-item--num">\n\t\t\t\t\t<div class="catalog-pf-product-index">{{basketItemIndex + 1}}</div>\n\t\t\t\t</div>\n\t\t\t\t<div class="catalog-pf-product-item--left">\n\t\t\t\t\t<div v-if="isVisibleBlock(blocks.productSelector)" class="catalog-pf-product-item-inline-selector">\n\t\t\t\t\t\t<div v-if="!this.isReadOnly" class="catalog-pf-product-item-section">\n\t\t\t\t\t\t\t<div class="catalog-pf-product-label">{{localize.CATALOG_FORM_NAME}}</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<${M.templateFieldInlineSelector}\n\t\t\t\t\t\t\t:basketItem="basketItem"\n\t\t\t\t\t\t\t:basketLength="basketLength"\n\t\t\t\t\t\t\t:options="options"\n\t\t\t\t\t\t\t:model="model"\n\t\t\t\t\t\t\t:editable="isEditableField(blocks.productSelector)"\n\t\t\t\t\t\t\t@onProductChange="onProductChange"\n\t\t\t\t\t\t\t@onProductSelect="onProductSelect"\n\t\t\t\t\t\t\t@onProductClear="onProductClear"\n\t\t\t\t\t\t\t@saveCatalogField="saveCatalogField"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div\n\t\t\t\t\t\tv-if="isVisibleBlock(blocks.brand)"\n\t\t\t\t\t\tclass="catalog-pf-product-input-brand-wrapper"\n\t\t\t\t\t\tv-bind:class="[\n\t\t\t\t\t\t\t{ 'catalog-pf-product-input-brand-wrapper-readonly': this.isReadOnly},\n\t\t\t\t\t\t\t{ 'catalog-pf-product-input-brand-wrapper-readonly-no-sku': this.isReadOnly && !this.hasSku}\n\t\t\t\t\t\t]"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div class="catalog-pf-product-item-section">\n\t\t\t\t\t\t\t<div class="catalog-pf-product-label">{{localize.CATALOG_FORM_BRAND_TITLE}}</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<${M.templateFieldBrand}\n\t\t\t\t\t\t\t:brands="basketItem.fields.brands"\n\t\t\t\t\t\t\t:selectorId="getBrandsSelectorId"\n\t\t\t\t\t\t\t:hasError="hasError(errorCodes.emptyBrand)"\n\t\t\t\t\t\t\t:options="options"\n\t\t\t\t\t\t\t:editable="isEditableField(blocks.brand)"\n\t\t\t\t\t\t\t@changeBrand="changeBrand"\n\t\t\t\t\t\t\t@saveCatalogField="saveCatalogField"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<div v-if="hasError(errorCodes.emptyBrand)" class="catalog-pf-product-item-section">\n\t\t\t\t\t\t\t<div class="catalog-product-error">{{localize.CATALOG_FORM_ERROR_EMPTY_BRAND_1}}</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\n\t\t\t\t</div>\n\t\t\t\t<div class="catalog-pf-product-item--right">\n\t\t\t\t\t<div class="catalog-pf-product-item-section">\n\t\t\t\t\t\t<div v-if="isVisibleBlock(blocks.price)" class="catalog-pf-product-label" style="width: 94px">\n\t\t\t\t\t\t\t{{localize.CATALOG_FORM_PRICE}}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div v-if="isVisibleBlock(blocks.quantity)" class="catalog-pf-product-label" style="width: 72px">\n\t\t\t\t\t\t\t{{localize.CATALOG_FORM_QUANTITY}}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div v-if="isVisibleBlock(blocks.result)" class="catalog-pf-product-label" style="width: 94px">\n\t\t\t\t\t\t\t{{localize.CATALOG_FORM_RESULT}}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="catalog-pf-product-item-section">\n\t\n\t\t\t\t\t\t<div v-if="isVisibleBlock(blocks.price)" class="catalog-pf-product-control" style="width: 94px">\n\t\t\t\t\t\t\t<${M.templateFieldPrice}\n\t\t\t\t\t\t\t\t:selectorId="basketItem.selectorId"\n\t\t\t\t\t\t\t\t:price="getPriceValue()"\n\t\t\t\t\t\t\t\t:options="options"\n\t\t\t\t\t\t\t\t:editable="isEditableField(blocks.price)"\n\t\t\t\t\t\t\t\t:hasError="hasError(errorCodes.emptyPrice)"\n\t\t\t\t\t\t\t\t@onChangePrice="onChangePrice"\n\t\t\t\t\t\t\t\t@saveCatalogField="saveCatalogField"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\n\t\t\t\t\t\t<div v-if="isVisibleBlock(blocks.quantity)" class="catalog-pf-product-control" style="width: 72px">\n\t\t\t\t\t\t\t<${M.templateFieldQuantity}\n\t\t\t\t\t\t\t\t:quantity="getQuantityValue()"\n\t\t\t\t\t\t\t\t:measureCode="getMeasureCode"\n\t\t\t\t\t\t\t\t:measureRatio="basketItem.fields.measureRatio"\n\t\t\t\t\t\t\t\t:measureName="getMeasureName"\n\t\t\t\t\t\t\t\t:hasError="hasError(errorCodes.emptyQuantity)"\n\t\t\t\t\t\t\t\t:options="options"\n\t\t\t\t\t\t\t\t:editable="isEditableField(blocks.quantity)"\n\t\t\t\t\t\t\t\t@onChangeQuantity="onChangeQuantity"\n\t\t\t\t\t\t\t\t@onSelectMeasure="onSelectMeasure"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\n\t\t\t\t\t\t<div v-if="isVisibleBlock(blocks.result)" class="catalog-pf-product-control" style="width: 94px">\n\t\t\t\t\t\t\t<${M.templateFieldResultSum}\n\t\t\t\t\t\t\t\t\t:sum="getSumValue()"\n\t\t\t\t\t\t\t\t\t:options="options"\n\t\t\t\t\t\t\t\t\t:editable="isEditableField(blocks.result)"\n\t\t\t\t\t\t\t\t\t@onChangeSum="onChangeSum"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div v-if="hasError(errorCodes.emptyQuantity)" class="catalog-pf-product-item-section">\n\t\t\t\t\t\t<div class="catalog-product-error">{{localize.CATALOG_FORM_ERROR_EMPTY_QUANTITY_1}}</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div v-if="hasError(errorCodes.emptyPrice)" class="catalog-pf-product-item-section">\n\t\t\t\t\t\t<div v-if="isEditableField(blocks.price)" class="catalog-product-error">{{localize.CATALOG_FORM_ERROR_EMPTY_PRICE_1}}</div>\n\t\t\t\t\t\t<div v-else class="catalog-product-error">{{localize.CATALOG_FORM_ERROR_EMPTY_PRICE_FILL_IN_CARD}}</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div v-if="showDiscountBlock" class="catalog-pf-product-item-section">\n\t\t\t\t\t\t<div v-if="showDiscount" class="catalog-pf-product-link-toggler catalog-pf-product-link-toggler--hide" @click="toggleDiscount('N')">{{localize.CATALOG_FORM_DISCOUNT_TITLE}}</div>\n\t\t\t\t\t\t<div v-else class="catalog-pf-product-link-toggler catalog-pf-product-link-toggler--show" @click="toggleDiscount('Y')">{{localize.CATALOG_FORM_DISCOUNT_TITLE}}</div>\n\t\t\t\t\t</div>\n\t\n\t\t\t\t\t<div v-if="showDiscount" class="catalog-pf-product-item-section">\n\t\t\t\t\t\t<${M.templateFieldDiscount}\n\t\t\t\t\t\t\t:discount="getDiscountValue()"\n\t\t\t\t\t\t\t:discountType="basketItem.fields.discountType"\n\t\t\t\t\t\t\t:discountRate="getDiscountRateValue()"\n\t\t\t\t\t\t\t:options="options"\n\t\t\t\t\t\t\t:editable="isEditableField(blocks.discount)"\n\t\t\t\t\t\t\tref="discountWrapper"\n\t\t\t\t\t\t\t@changeDiscount="changeDiscount"\n\t\t\t\t\t\t\t@changeDiscountType="changeDiscountType"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\n\t\t\t\t\t<div v-if="showTaxBlock" class="catalog-pf-product-item-section catalog-pf-product-item-section--dashed">\n\t\t\t\t\t\t<div v-if="showTaxSelector" class="catalog-pf-product-link-toggler catalog-pf-product-link-toggler--hide" @click="toggleTax('N')">{{localize.CATALOG_FORM_TAX_TITLE}}</div>\n\t\t\t\t\t\t<div v-else class="catalog-pf-product-link-toggler catalog-pf-product-link-toggler--show" @click="toggleTax('Y')">{{localize.CATALOG_FORM_TAX_TITLE}}</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div v-if="showTaxSelector && showTaxBlock" class="catalog-pf-product-item-section">\n\t\t\t\t\t\t<${M.templateFieldTax}\n\t\t\t\t\t\t\t:taxId="basketItem.fields.taxId"\n\t\t\t\t\t\t\t:options="options"\n\t\t\t\t\t\t\t:editable="isEditableField(blocks.tax)"\n\t\t\t\t\t\t\t@changeProduct="changeProduct"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="catalog-pf-product-item-section catalog-pf-product-item-section--dashed"></div>\n\t\t\t\t</div>\n\t\t\t\t<div class="catalog-pf-product-item">\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div>\n\t\t\t\t<div class="catalog-product-error" v-html="getErrorsText"></div>\n\t\t\t</div>\n\t\t</div>\n\t`});class G{}G.REGULAR="REGULAR";G.FACEBOOK="FACEBOOK";class ${}$.COMPILATION_FACEBOOK=13856526;$.COMMON_COMPILATION=13841876;let Y=t=>t,V,X,H,q,j,z,Q,K,W;A.Vue.component(M.templatePanelCompilation,{props:{compilationOptions:Object,mode:String},created(){this.newLabel=new g.Label({text:this.localize.CATALOG_FORM_COMPILATION_PRODUCT_NEW_LABEL,color:g.LabelColor.PRIMARY,fill:true});this.popup=null;this.compilationLink=null;const t=R.Tag.render(V||(V=Y` <a class="ui-btn ui-btn-primary">${0}</a> `),this.localize.CATALOG_FORM_COMPILATION_INFO_BUTTON_MORE);R.Event.bind(t,"click",this.openHelpDesk);let e="";let s="";if(this.isFacebookForm()){e=this.localize.CATALOG_FORM_COMPILATION_INFO_MESSAGE_TITLE_FACEBOOK;s=R.Tag.render(X||(X=Y` <p>${0}</p> <p>${0}</p> `),this.localize.CATALOG_FORM_COMPILATION_INFO_MESSAGE_BODY_FACEBOOK_FIRST_BLOCK,this.localize.CATALOG_FORM_COMPILATION_INFO_MESSAGE_BODY_FACEBOOK_SECOND_BLOCK)}else{e=this.localize.CATALOG_FORM_COMPILATION_INFO_MESSAGE_TITLE;s=this.localize.CATALOG_FORM_COMPILATION_INFO_MESSAGE_BODY_MARKETING_2}this.message=new I.MessageCard({id:"compilationInfo",header:e,description:s,angle:false,hidden:true,actionElements:[t]});v.EventEmitter.subscribe(this.message,"onClose",this.hideMessage)},mounted(){this.$refs.label.appendChild(this.newLabel.render());this.$refs.message.appendChild(this.message.getLayout())},data(){return{compilationLink:null}},methods:{isFacebookForm(){return this.compilationOptions.type===G.FACEBOOK},openHelpDesk(){this.helpdeskCode=this.isFacebookForm()?$.COMPILATION_FACEBOOK:$.COMMON_COMPILATION;top.BX.Helper.show("redirect=detail&code="+this.helpdeskCode)},showPopup(t){if(this.compilationOptions.disabledSwitcher){return}if(this.isFacebookForm()){this.openHelpDesk();return}if(this.popup instanceof h.Popup){this.popup.setBindElement(this.$refs.qrLink);this.popup.show();return}const e=this.$store.getters["productList/getBasket"]();const s=e.map((t=>{var e;return t==null?void 0:(e=t.fields)==null?void 0:e.skuId}));return new Promise(((e,i)=>{R.ajax.runAction("salescenter.compilation.createCompilation",{data:{productIds:s,options:{ownerId:this.$root.$app.options.ownerId,ownerTypeId:this.$root.$app.options.ownerTypeId,dialogId:this.$root.$app.options.dialogId,sessionId:this.$root.$app.options.sessionId}}}).then((s=>{var i,o,a;this.compilationLink=(i=s.data.link)!=null?i:null;v.EventEmitter.emit(this.$root.$app,"ProductForm:onCompilationCreated",{compilationId:(o=s.data.compilationId)!=null?o:null,ownerId:(a=s.data.ownerId)!=null?a:null});this.popup=new h.Popup({bindElement:t.target,content:this.getQRPopupContent(),width:375,closeIcon:{top:"5px",right:"5px"},padding:0,closeByEsc:true,autoHide:true,cacheable:true,animation:"fading-slide",angle:{offset:30}});this.popup.show();e()})).catch((()=>i()))}))},getQRPopupContent(){if(!this.compilationLink){return""}const t=R.Tag.render(H||(H=Y` <div class="catalog-pf-product-qr-popup-copy">${0}</div> `),this.localize.CATALOG_FORM_COMPILATION_QR_COPY);R.Event.bind(t,"click",(()=>{BX.clipboard.copy(this.compilationLink);BX.UI.Notification.Center.notify({content:this.localize.CATALOG_FORM_COMPILATION_QR_COPY_NOTIFY_MESSAGE,autoHideDelay:2e3})}));const e=R.Tag.render(q||(q=Y`<div class="catalog-pf-product-qr-popup-image"></div>`));const s=R.Tag.render(j||(j=Y` <div class="catalog-pf-product-qr-popup"> <div class="catalog-pf-product-qr-popup-content"> <div class="catalog-pf-product-qr-popup-text">${0}</div> ${0} <div class="catalog-pf-product-qr-popup-buttons"> <a href="${0}" target="_blank" class="ui-btn ui-btn-light-border ui-btn-round">${0}</a> </div> </div> <div class="catalog-pf-product-qr-popup-bottom"> <a href="${0}" target="_blank" class="catalog-pf-product-qr-popup--url">${0}</a> ${0} </div> </div> `),this.localize.CATALOG_FORM_COMPILATION_QR_POPUP_TITLE,e,this.compilationLink,this.localize.CATALOG_FORM_COMPILATION_QR_POPUP_INPUT_TITLE,this.compilationLink,this.compilationLink,t);new QRCode(e,{text:this.compilationLink,width:250,height:250});return s},setSetting(t){const e=t.target.checked?"Y":"N";this.$root.$app.changeFormOption("isCompilationMode",e)},getOnBeforeCreationStorePopupContent(){const t=R.Tag.render(z||(z=Y` <div class="catalog-product-form-popup--loader-block"></div> `));const e=R.Tag.render(Q||(Q=Y` <div class="catalog-product-form-popup--container"> <div class="catalog-product-form-popup--title">${0}</div> ${0} <div class="catalog-product-form-popup--text">${0}</div> </div> `),R.Loc.getMessage("CATALOG_FORM_POPUP_BEFORE_MARKET_CREATING1"),t,R.Loc.getMessage("CATALOG_FORM_POPUP_BEFORE_MARKET_CREATING_INFO1"));const s=new m.Loader({color:"#2fc6f6",target:t,size:40});s.show();return e},getOnAfterCreationStorePopupContent(t){const e=R.Tag.render(K||(K=Y` <button class="ui-btn ui-btn-md ui-btn-primary"> ${0} </button> `),R.Loc.getMessage("CATALOG_FORM_POPUP_AFTER_MARKET_CREATING_CONTINUE"));R.Event.bind(e,"click",this.closeCreationStorePopup.bind(this,t));return R.Tag.render(W||(W=Y` <div class="catalog-product-form-popup--container"> <div class="catalog-product-form-popup--title">${0}</div> <div class="catalog-product-form-popup--loader-block catalog-product-form-popup--done"></div> <div class="catalog-product-form-popup--text">${0}</div> <div class="catalog-product-form-popup--button-container">${0}</div> </div> `),R.Loc.getMessage("CATALOG_FORM_POPUP_AFTER_MARKET_CREATING1"),R.Loc.getMessage("CATALOG_FORM_POPUP_AFTER_MARKET_CREATING_INFO1"),e)},closeCreationStorePopup(t){t.close()},onNewLabelClick(t){t.preventDefault()},onLabelClick(){if(this.compilationOptions.isLimitedStore){BX.UI.InfoHelper.show("limit_sites_number")}},onClickHint(t){t.preventDefault();t.stopImmediatePropagation();if(!this.message){return}if(this.message.isShown()){this.hideMessage()}else{this.showMessage()}},showMessage(){if(this.message){R.Dom.addClass(this.$refs.hintIcon,"catalog-pf-product-panel-message-arrow-target");this.message.show()}},hideMessage(){if(this.message){R.Dom.removeClass(this.$refs.hintIcon,"catalog-pf-product-panel-message-arrow-target")}this.message.hide()}},computed:{localize(){return A.Vue.getFilteredPhrases("CATALOG_")},showQrLink(){return this.mode===B.COMPILATION},...p.Vuex.mapState({productList:t=>t.productList})},template:`\n\t\t<div>\n\t\t\t<div class="catalog-pf-product-panel-compilation">\n\t\t\t\t<div class="catalog-pf-product-panel-compilation-wrapper">\n\t\t\t\t\t<label class="ui-ctl ui-ctl-checkbox catalog-pf-product-panel-compilation-checkbox-container" @click="onLabelClick">\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\ttype="checkbox"\n\t\t\t\t\t\t\t:disabled="compilationOptions.disabledSwitcher"\n\t\t\t\t\t\t\tclass="ui-ctl-element"\n\t\t\t\t\t\t\t@change="setSetting"\n\t\t\t\t\t\t\tdata-setting-id="isCompilationMode"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<div class="ui-ctl-label-text">{{localize.CATALOG_FORM_COMPILATION_PRODUCT_SWITCHER_2}}</div>\n\t\t\t\t\t\t<div ref="hintIcon">\n\t\t\t\t\t\t\t<div data-hint-init="vue" class="ui-hint" @click="onClickHint">\n\t\t\t\t\t\t\t\t<span class="ui-hint-icon"></span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div ref="label" @click="onNewLabelClick"></div>\n\t\t\t\t\t\t<div class="tariff-lock" v-if="compilationOptions.isLimitedStore"></div>\n\t\t\t\t\t</label>\n\t\t\t\t</div>\n\t\t\t\t<div\n\t\t\t\t\tv-if="showQrLink"\n\t\t\t\t\tclass="catalog-pf-product-panel-compilation-link --icon-qr"\n\t\t\t\t\t@click="showPopup"\n\t\t\t\t\tref="qrLink"\n\t\t\t\t>\n\t\t\t\t\t{{localize.CATALOG_FORM_COMPILATION_QR_LINK}}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="catalog-pf-product-panel-compilation-message" ref="message"></div>\n\t\t\t<div class="catalog-pf-product-panel-compilation-price-info">{{localize.CATALOG_FORM_COMPILATION_PRICE_NOTIFICATION}}</div>\n\t\t</div>\n\t`});let Z=t=>t,J,tt,et,st;A.Vue.component(M.templatePanelButtons,{props:{options:Object,mode:String},data(){return{settings:[]}},methods:{refreshBasket(){this.$emit("refreshBasket")},changeBasketItem(t){this.$emit("changeRowData",t)},addBasketItemForm(){this.$emit("addItem")},getInternalIndexByProductId(t){const e=this.$store.getters["productList/getBasket"]();return Object.keys(e).findIndex((s=>parseInt(e[s].skuId)===parseInt(t)))},handleAddItem(t,e){const s=4;if(R.Text.toNumber(e.type)===s){R.ajax.runAction("catalog.productSelector.getSelectedSku",{json:{variationId:t,options:{priceId:this.options.basePriceId,urlBuilder:this.options.urlBuilder,currency:this.options.currency,resetSku:true}}}).then((t=>this.processResponse(t,e.isAddAnyway)))}else{R.ajax.runAction("catalog.productSelector.getProduct",{json:{productId:t,options:{priceId:this.options.basePriceId,urlBuilder:this.options.urlBuilder,currency:this.options.currency}}}).then((t=>this.processResponse(t,e.isAddAnyway)))}},processResponse(t,e){const s=e?-1:this.getInternalIndexByProductId(t.data.skuId);if(s<0){const e=t.data;const s=R.Text.toNumber(e.fields.BASE_PRICE);e.fields=e.fields||{};let i=this.$store.getters["productList/getBaseProduct"]();i.fields=Object.assign(i.fields,{price:s,priceExclusive:s,basePrice:s,name:e.fields.NAME||"",productId:e.productId,skuId:e.skuId,measureCode:e.fields.MEASURE_CODE,measureName:e.fields.MEASURE_NAME,measureRatio:e.fields.MEASURE_RATIO,properties:e.fields.PROPERTIES,offerId:e.skuId>0?e.skuId:e.productId,module:"catalog",isCustomPrice:R.Type.isNil(e.fields.PRICE)?"Y":"N",discountType:this.options.defaultDiscountType});delete e.fields;i=Object.assign(i,e);i.sum=s;this.$root.$app.addProduct(i)}},onUpdateBasketItem(t,e){this.$store.dispatch("productList/changeRowData",{index:t,fields:e});this.$store.dispatch("productList/changeProduct",{index:t,fields:e.fields})},removeEmptyItems(){const t=this.$store.getters["productList/getBasket"]();t.forEach(((e,s)=>{if(t[s].name===""&&t[s].price<1e-10){this.$store.commit("productList/deleteItem",{index:s})}}))},modifyBasketItem(t){const e=parseInt(t.id);if(e>0){const s=this.getInternalIndexByProductId(e);if(s>=0){this.showDialogProductExists(t)}else{this.removeEmptyItems();this.handleAddItem(e,t)}}},showDialogProductExists(t){_.MessageBox.confirm(R.Loc.getMessage("CATALOG_FORM_BLOCK_PROD_EXIST_DLG_TEXT_FOR_DOUBLE").replace("#NAME#",t.name),R.Loc.getMessage("CATALOG_FORM_BLOCK_PROD_EXIST_DLG_TITLE"),(e=>{const s=parseInt(t.id,10);const i=this.getInternalIndexByProductId(s);if(i>=0){this.handleAddItem(s,{...t,isAddAnyway:true})}e.close()}),R.Loc.getMessage("CATALOG_FORM_BLOCK_PROD_EXIST_DLG_OK"),(t=>t.close()),R.Loc.getMessage("CATALOG_FORM_BLOCK_PROD_EXIST_DLG_NO"))},showDialogProductSearch(){const t="addBasketItemFromDialogProductSearch";window[t]=t=>this.modifyBasketItem(t);const e=new BX.CDialog({content_url:"/bitrix/tools/sale/product_search_dialog.php?"+"&caller=order_edit"+"&func_name="+t+"&STORE_FROM_ID=0"+"&public_mode=Y",height:Math.max(500,window.innerHeight-400),width:Math.max(800,window.innerWidth-400),draggable:true,resizable:true,min_height:500,min_width:800,zIndex:3100});e.Show()},setSetting(t){if(t.target.dataset.settingId==="taxIncludedOption"){const e=t.target.checked?"Y":"N";this.$root.$app.changeFormOption("taxIncluded",e)}else if(t.target.dataset.settingId==="showDiscountInputOption"){const e=t.target.checked?"Y":"N";this.$root.$app.changeFormOption("showDiscountBlock",e)}else if(t.target.dataset.settingId==="showTaxInputOption"){const e=t.target.checked?"Y":"N";this.$root.$app.changeFormOption("showTaxBlock",e)}},getSettingItem(t){var e;const s=R.Tag.render(J||(J=Z` <input type="checkbox" class="ui-ctl-element"> `));s.checked=t.checked;s.disabled=(e=t.disabled)!=null?e:false;s.dataset.settingId=t.id;const i=R.Type.isStringFilled(t.hint)?R.Tag.render(tt||(tt=Z`<span class="catalog-product-form-setting-hint" data-hint="${0}"></span>`),t.hint):"";const o=R.Tag.render(et||(et=Z` <label class="ui-ctl ui-ctl-checkbox ui-ctl-w100"> ${0} <div class="ui-ctl-label-text ${0}">${0}${0}</div> </label> `),s,t.disabled?"catalog-product-form-disabled-setting":"",t.title,i);BX.UI.Hint.init(o);R.Event.bind(o,"change",this.setSetting.bind(this));return o},getSettingItems(){const t=[{id:"showDiscountInputOption",checked:this.options.showDiscountBlock!=="N",title:this.localize.CATALOG_FORM_ADD_SHOW_DISCOUNTS_OPTION}];return t},prepareSettingsContent(){const t=R.Tag.render(st||(st=Z` <div class='catalog-pf-product-config-popup'></div> `));this.settings.forEach((e=>{t.append(this.getSettingItem(e))}));return t},showConfigPopup(t){this.popupMenu=new h.Popup(null,t.target,{autoHide:true,draggable:false,offsetLeft:0,offsetTop:0,noAllPaddings:true,bindOptions:{forceBindPosition:true},closeByEsc:true,content:this.prepareSettingsContent()});this.popupMenu.show()},openSlider(t,e){if(!R.Type.isPlainObject(e)){e={}}e={...{cacheable:false,allowChangeHistory:false,events:{}},...e};return new Promise((s=>{if(R.Type.isString(t)&&t.length>1){e.events.onClose=function(t){s(t.getSlider())};BX.SidePanel.Instance.open(t,e)}else{s()}}))}},computed:{hasAccessToCatalog(){return this.options.isCatalogAccess},localize(){return A.Vue.getFilteredPhrases("CATALOG_")},countItems(){return this.order.basket.length},isCatalogHidden(){return this.options.isCatalogHidden},...p.Vuex.mapState({productList:t=>t.productList})},mounted(){this.settings=this.getSettingItems();BX.UI.Hint.init()},template:`\n\t\t<div>\n\t\t\t<div class="catalog-pf-product-add">\n\t\t\t\t<div class="catalog-pf-product-add-wrapper">\n\t\t\t\t\t<span class="catalog-pf-product-add-link" @click="addBasketItemForm">{{localize.CATALOG_FORM_ADD_PRODUCT}}</span>\n\t\t\t\t\t<span\n\t\t\t\t\t\tv-if="hasAccessToCatalog && !isCatalogHidden"\n\t\t\t\t\t\tclass="catalog-pf-product-add-link catalog-pf-product-add-link--gray"\n\t\t\t\t\t\t@click="showDialogProductSearch"\n\t\t\t\t\t>{{localize.CATALOG_FORM_ADD_PRODUCT_FROM_CATALOG}}</span>\n\t\t\t\t\t<span\n\t\t\t\t\t\tv-else-if="!isCatalogHidden"\n\t\t\t\t\t\tclass="catalog-pf-product-add-link catalog-pf-product-add-link--gray catalog-pf-product-add-link--disabled"\n\t\t\t\t\t\t:data-hint="localize.CATALOG_FORM_ADD_PRODUCT_FROM_CATALOG_DENIED_HINT"\n\t\t\t\t\t\tdata-hint-no-icon\n\t\t\t\t\t>{{localize.CATALOG_FORM_ADD_PRODUCT_FROM_CATALOG}}</span>\n\t\t\t\t</div>\n\t\t\t\t<div class="catalog-pf-product-configure-link" @click="showConfigPopup">{{localize.CATALOG_FORM_DISCOUNT_EDIT_PAGE_URL_TITLE}}</div>\n\t\t\t</div>\n\t\t</div>\n\t`});let it=t=>t,ot;A.Vue.component(M.templateSummaryTotal,{props:{currency:{type:String,required:true},sum:{required:true},sumAdditionalClass:String,currencyAdditionalClass:String},computed:{formattedSum(){var t;const e=R.Tag.render(ot||(ot=it`<span class="catalog-pf-text ${0}">${0}</span>`),(t=this.sumAdditionalClass)!=null?t:"",this.sum);return y.CurrencyCore.getPriceControl(e,this.currency)}},template:`\n\t<span class="catalog-pf-symbol" :class="currencyAdditionalClass" v-html="formattedSum"></span>\n\t`});A.Vue.component(M.templateName,{props:{options:Object,mode:String},created(){BX.ajax.runAction("catalog.productSelector.getFileInput",{json:{iblockId:this.options.iblockId}})},methods:{refreshBasket(){this.$store.dispatch("productList/refreshBasket")},changeProduct(t){this.$root.$app.changeProduct(t)},emitErrorsChange(){this.$root.$app.emitErrorsChange()},changeRowData(t){delete t.product.fields;this.$store.commit("productList/updateItem",t)},removeItem(t){this.$root.$app.removeProduct(t)},addItem(){this.$root.$app.addProduct()}},computed:{localize(){return A.Vue.getFilteredPhrases("CATALOG_")},showTaxResult(){return this.options.showTaxBlock!=="N"},showResults(){return this.options.showResults!==false},showButtonsTop(){return this.options.singleProductMode!==true&&this.mode!==B.READ_ONLY&&this.mode!==B.COMPILATION_READ_ONLY&&this.options.buttonsPosition!==L.BOTTOM},showButtonsBottom(){return this.options.singleProductMode!==true&&this.mode!==B.READ_ONLY&&this.mode!==B.COMPILATION_READ_ONLY&&this.options.buttonsPosition===L.BOTTOM},showResultBlock(){return this.showResults||this.enableAddButtons},countItems(){return this.productList.basket.length},totalResultLabel(){return this.options.hasOwnProperty("totalResultLabel")&&this.options.totalResultLabel?this.options.totalResultLabel:this.localize.CATALOG_FORM_TOTAL_RESULT},...p.Vuex.mapState({productList:t=>t.productList})},template:`\n\t<div class="catalog-product-form-container">\n\t\t<${M.templatePanelButtons}\n\t\t\t:options="options"\n\t\t\t:mode="mode"\n\t\t\t@refreshBasket="refreshBasket"\n\t\t\t@addItem="addItem"\n\t\t\t@changeRowData="changeRowData"\n\t\t\t@changeProduct="changeProduct"\n\t\t\tv-if="showButtonsTop"\n\t\t/>\n\t\t<div v-for="(item, index) in productList.basket" :key="item.selectorId">\n\t\t\t<${M.templateRowName}\n\t\t\t\t:basketItem="item"\n\t\t\t\t:basketItemIndex="index"\n\t\t\t\t:basketLength="productList.basket.length"\n\t\t\t\t:countItems="countItems"\n\t\t\t\t:options="options"\n\t\t\t\t:mode="mode"\n\t\t\t\t@changeProduct="changeProduct"\n\t\t\t\t@changeRowData="changeRowData"\n\t\t\t\t@removeItem="removeItem"\n\t\t\t\t@refreshBasket="refreshBasket"\n\t\t\t\t@emitErrorsChange="emitErrorsChange"\n\t\t\t/>\n\t\t</div>\n\t\t<${M.templatePanelButtons}\n\t\t\t:options="options"\n\t\t\t:mode="mode"\n\t\t\t@refreshBasket="refreshBasket"\n\t\t\t@addItem="addItem"\n\t\t\t@changeRowData="changeRowData"\n\t\t\t@changeProduct="changeProduct"\n\t\t\tv-if="showButtonsBottom"\n\t\t/>\n\t\t<${M.templatePanelCompilation}\n\t\t\tv-if="options.showCompilationModeSwitcher"\n\t\t\t:compilationOptions="options.compilationFormOption"\n\t\t\t:mode="mode"\n\t\t/>\n\t\t<div class="catalog-pf-result-line"></div>\n\t\t<div class="catalog-pf-result-wrapper" v-if="showResultBlock">\n\t\t\t<table class="catalog-pf-result">\n\t\t\t\t<tr>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<span class="catalog-pf-text">{{localize.CATALOG_FORM_PRODUCTS_PRICE}}:</span>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<${M.templateSummaryTotal}\n\t\t\t\t\t\t\t:sum="productList.total.sum"\n\t\t\t\t\t\t\t:currency="options.currency"\n\t\t\t\t\t\t\t:sumAdditionalClass="productList.total.result !== productList.total.sum ? 'catalog-pf-text--line-through' : ''"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class="catalog-pf-result-padding-bottom">\n\t\t\t\t\t\t<span class="catalog-pf-text catalog-pf-text--discount">{{localize.CATALOG_FORM_TOTAL_DISCOUNT}}:</span>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class="catalog-pf-result-padding-bottom">\n\t\t\t\t\t\t<${M.templateSummaryTotal}\n\t\t\t\t\t\t\t:sum="productList.total.discount"\n\t\t\t\t\t\t\t:currency="options.currency"\n\t\t\t\t\t\t\t:sumAdditionalClass="'catalog-pf-text--discount'"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr v-if="showTaxResult">\n\t\t\t\t\t<td class="catalog-pf-tax">\n\t\t\t\t\t\t<span class="catalog-pf-text catalog-pf-text--tax">{{localize.CATALOG_FORM_TAX_TITLE}}:</span>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class="catalog-pf-tax">\n\t\t\t\t\t\t<${M.templateSummaryTotal}\n\t\t\t\t\t\t\t:sum="productList.total.taxSum"\n\t\t\t\t\t\t\t:currency="options.currency"\n\t\t\t\t\t\t\t:sumAdditionalClass="'catalog-pf-text--tax'"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class="catalog-pf-result-padding">\n\t\t\t\t\t\t<span class="catalog-pf-text catalog-pf-text--total catalog-pf-text--border">{{totalResultLabel}}:</span>\n\t\t\t\t\t</td>\n\t\t\t\t\t<td class="catalog-pf-result-padding">\n\t\t\t\t\t\t<${M.templateSummaryTotal}\n\t\t\t\t\t\t\t:sum="productList.total.result"\n\t\t\t\t\t\t\t:currency="options.currency"\n\t\t\t\t\t\t\t:sumAdditionalClass="'catalog-pf-text--total'"\n\t\t\t\t\t\t\t:currencyAdditionalClass="'catalog-pf-symbol--total'"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t</div>\n\t</div>\n`});let at=t=>t,nt;var rt=babelHelpers.classPrivateFieldLooseKey("onBasketChange");var lt=babelHelpers.classPrivateFieldLooseKey("checkRequiredFields");var ct=babelHelpers.classPrivateFieldLooseKey("changeCompilationModeSetting");var dt=babelHelpers.classPrivateFieldLooseKey("setMode");class ut{constructor(t={}){Object.defineProperty(this,dt,{value:gt});Object.defineProperty(this,ct,{value:mt});Object.defineProperty(this,lt,{value:ht});Object.defineProperty(this,rt,{value:pt});this.options=this.prepareOptions(t);this.defaultOptions=Object.assign({},this.options);this.editable=true;babelHelpers.classPrivateFieldLooseBase(this,dt)[dt](B.REGULAR);this.wrapper=R.Tag.render(nt||(nt=at`<div class=""></div>`));if(R.Text.toNumber(t.iblockId)<=0){return}ut.initStore().then((t=>this.initTemplate(t))).catch((t=>ut.showError(t)))}static initStore(){const t=new p.VuexBuilder;return t.addModel(S.create()).build()}prepareOptions(t={}){const e=R.Extension.getSettings("catalog.product-form");const s={basket:[],measures:[],iblockId:null,basePriceId:e.get("basePriceId"),taxList:[],singleProductMode:false,showResults:true,showCompilationModeSwitcher:false,enableEmptyProductError:true,isShortProductViewFormat:false,pricePrecision:2,currency:e.get("currency"),currencySymbol:e.get("currencySymbol"),taxIncluded:e.get("taxIncluded"),warehouseOption:e.get("warehouseOption"),isCatalogHidden:e.get("isCatalogHidden"),showDiscountBlock:e.get("showDiscountBlock"),showTaxBlock:e.get("showTaxBlock"),allowedDiscountTypes:[k.DiscountType.PERCENTAGE,k.DiscountType.MONETARY],visibleBlocks:[D.PRODUCT_SELECTOR,D.IMAGE_EDITOR,D.PRICE,D.QUANTITY,D.RESULT,D.DISCOUNT],requiredFields:[],editableFields:[],newItemPosition:L.TOP,buttonsPosition:L.TOP,urlBuilderContext:"SHOP",hideUnselectedProperties:false,isCatalogDiscountSetEnabled:e.get("isCatalogDiscountSetEnabled"),isCatalogPriceEditEnabled:e.get("isCatalogPriceEditEnabled"),isCatalogPriceSaveEnabled:e.get("isCatalogPriceSaveEnabled"),isCatalogSettingAccess:e.get("isCatalogSettingAccess"),isCatalogAccess:e.get("isCatalogAccess"),fieldHints:e.get("fieldHints"),compilationFormType:G.REGULAR,compilationFormOption:{},facebookFailProducts:null,ownerId:null,ownerTypeId:null,dialogId:null,sessionId:null};if(t.visibleBlocks&&!R.Type.isArray(t.visibleBlocks)){delete t.visibleBlocks}if(t.requiredFields&&!R.Type.isArray(t.requiredFields)){delete t.requiredFields}t={...s,...t};t.showTaxBlock="N";if(e.get("isEnabledLanding")){t.compilationFormOption={type:t.compilationFormType,hasStore:e.get("hasLandingStore"),isLimitedStore:e.get("isLimitedLandingStore"),disabledSwitcher:e.get("isLimitedLandingStore")}}else{t.showCompilationModeSwitcher=false}t.defaultDiscountType="";if(R.Type.isArray(t.allowedDiscountTypes)){if(t.allowedDiscountTypes.includes(k.DiscountType.PERCENTAGE)){t.defaultDiscountType=k.DiscountType.PERCENTAGE}else if(t.allowedDiscountTypes.includes(k.DiscountType.MONETARY)){t.defaultDiscountType=k.DiscountType.MONETARY}}return t}layout(){return this.wrapper}initTemplate(t){return new Promise((e=>{const s=this;this.store=t.store;this.templateEngine=A.BitrixVue.createApp({el:this.wrapper,store:this.store,data:{options:this.options,mode:this.mode},created(){this.$app=s},mounted(){e()},template:`<${M.templateName} :options="options" :mode="mode"/>`});if(R.Type.isStringFilled(this.options.currency)){this.setData({currency:this.options.currency});y.CurrencyCore.loadCurrencyFormat(this.options.currency)}if(this.options.basket.length>0){this.setData({basket:this.options.basket},{newItemPosition:L.BOTTOM});if(R.Type.isObject(this.options.totals)){this.store.commit("productList/setTotal",this.options.totals)}else{this.store.dispatch("productList/calculateTotal")}}else{const t=this.store.getters["productList/getBaseProduct"]();t.fields.discountType=this.options.defaultDiscountType;this.addProduct(t)}v.EventEmitter.emit(this,"onAfterInit")}))}addProduct(t={}){this.store.dispatch("productList/addItem",{item:t,position:this.options.newItemPosition}).then((()=>{babelHelpers.classPrivateFieldLooseBase(this,rt)[rt]()}))}emitErrorsChange(){v.EventEmitter.emit(this,"ProductForm:onErrorsChange")}changeProduct(t){const e=t.product;e.errors=[];if(t.skipFieldChecking!==true){const t=babelHelpers.classPrivateFieldLooseBase(this,lt)[lt](e);e.errors=(t==null?void 0:t.errors)||[]}this.store.dispatch("productList/changeItem",{index:t.index,product:e}).then((()=>{babelHelpers.classPrivateFieldLooseBase(this,rt)[rt]()}))}removeProduct(t){this.store.dispatch("productList/removeItem",{index:t.index}).then((()=>{babelHelpers.classPrivateFieldLooseBase(this,rt)[rt]()}))}setData(t,e={}){if(R.Type.isObject(t.basket)){const s=this.store.getters["productList/getBasket"]();t.basket.forEach((t=>{if(!R.Type.isObject(t)){return}const i=e.newItemPosition||this.options.newItemPosition;const o=t.selectorId;if(R.Type.isNil(o)){this.store.dispatch("productList/addItem",{item:t,position:i});return}const a=s.findIndex((t=>t.selectorId===o));if(a===-1){this.store.dispatch("productList/addItem",{item:t,position:i})}else{this.store.dispatch("productList/changeItem",{basketIndex:a,fields:t})}}))}if(R.Type.isStringFilled(t.currency)){this.store.dispatch("productList/setCurrency",t.currency)}if(R.Type.isObject(t.total)){this.store.commit("productList/setTotal",{sum:t.total.sum,taxSum:t.total.taxSum,discount:t.total.discount,result:t.total.result})}if(R.Type.isObject(t.errors)){this.store.commit("productList/setErrors",t.errors)}}changeFormOption(t,e){e=e==="Y"?"Y":"N";if(t==="isCompilationMode"){if(!this.options.showCompilationModeSwitcher){return}v.EventEmitter.emit(this,"onChangeCompilationMode",{isCompilationMode:e==="Y",isFacebookForm:this.options.compilationFormType===G.FACEBOOK});const t=e==="Y"?B.COMPILATION:B.REGULAR;babelHelpers.classPrivateFieldLooseBase(this,ct)[ct](t);return}this.options[t]=e;const s=this.store.getters["productList/getBasket"]();s.forEach(((s,i)=>{if(t==="showDiscountBlock"){s.showDiscountBlock=e}else if(t==="showTaxBlock"){s.showTaxBlock=e}else if(t==="taxIncluded"){s.fields.taxIncluded=e}this.store.dispatch("productList/changeItem",{index:i,fields:s})}));R.ajax.runAction("catalog.productForm.setConfig",{data:{configName:t,value:e}})}getTotal(){this.store.dispatch("productList/getTotal")}setEditable(t,e){this.editable=t;if(!t&&!e){babelHelpers.classPrivateFieldLooseBase(this,dt)[dt](B.READ_ONLY)}else if(!t&&e){babelHelpers.classPrivateFieldLooseBase(this,dt)[dt](B.COMPILATION_READ_ONLY)}else if(t&&e){babelHelpers.classPrivateFieldLooseBase(this,dt)[dt](B.COMPILATION)}else{babelHelpers.classPrivateFieldLooseBase(this,dt)[dt](B.REGULAR)}}hasErrors(){if(!this.store){return false}const t=this.store.getters["productList/getBasket"]();const e=t.filter((t=>t.errors.length>0));return e.length>0}static showError(t){console.error(t)}}function pt(){v.EventEmitter.emit(this,"ProductForm:onBasketChange",{basket:this.store.getters["productList/getBasket"]()})}function ht(t){const e={};if(!R.Type.isArray(this.options.requiredFields)||this.options.requiredFields.length===0){return e}e.errors=[];this.options.requiredFields.forEach((s=>{switch(s){case D.PRICE:if(!this.options.isCatalogPriceSaveEnabled&&t.catalogPrice<=0){e.errors.push({code:N.EMPTY_PRICE,message:R.Loc.getMessage("CATALOG_FORM_ERROR_EMPTY_PRICE_FILL_IN_CARD")})}else if(t.fields.basePrice<=0){e.errors.push({code:N.EMPTY_PRICE,message:R.Loc.getMessage("CATALOG_FORM_ERROR_EMPTY_PRICE_1")})}break;case D.QUANTITY:if(t.fields.quantity<=0){e.errors.push({code:N.EMPTY_QUANTITY,message:R.Loc.getMessage("CATALOG_FORM_ERROR_EMPTY_QUANTITY_1")})}break;case D.BRAND:if(!R.Type.isArray(t.fields.brands)||t.fields.brands.length===0){e.errors.push({code:N.EMPTY_BRAND,message:R.Loc.getMessage("CATALOG_FORM_ERROR_EMPTY_BRAND_1")})}break;case D.IMAGE_EDITOR:if(!R.Type.isObject(t.fields.morePhoto)||Object.keys(t.fields.morePhoto).length===0){e.errors.push({code:N.EMPTY_IMAGE,message:R.Loc.getMessage("CATALOG_FORM_ERROR_EMPTY_PICTURE_1")})}break}}));return e}function mt(t){babelHelpers.classPrivateFieldLooseBase(this,dt)[dt](t);const e=this.store.getters["productList/getBasket"]();e.forEach(((t,s)=>this.changeProduct({index:s,product:t,skipFieldChecking:e.length===1&&s===0&&t.offerId===null})))}function gt(t){this.mode=t;if(t===B.READ_ONLY){this.options.editableFields=[]}else if(t===B.COMPILATION_READ_ONLY){this.options.editableFields=[];this.options.visibleBlocks=[D.PRODUCT_SELECTOR,D.IMAGE_EDITOR,D.PRICE,D.BRAND];this.options.showResults=false}else if(t===B.COMPILATION){this.options.editableFields=[D.PRODUCT_SELECTOR,D.BRAND];this.options.visibleBlocks=this.defaultOptions.visibleBlocks;if(this.options.compilationFormType===G.FACEBOOK){this.options.visibleBlocks=[D.PRODUCT_SELECTOR,D.IMAGE_EDITOR,D.PRICE,D.BRAND]}else{this.options.visibleBlocks=this.defaultOptions.visibleBlocks}this.options.showResults=false}else{t=B.REGULAR;this.options.visibleBlocks=this.defaultOptions.visibleBlocks;this.options.showResults=this.defaultOptions.showResults;this.options.editableFields=this.defaultOptions.visibleBlocks}if(this.templateEngine){this.templateEngine.mode=t}this.options.requiredFields=[];if(t===B.COMPILATION){const t=[D.PRODUCT_SELECTOR,D.PRICE];if(this.options.compilationFormType===G.FACEBOOK){t.push(D.IMAGE_EDITOR,D.BRAND)}this.options.requiredFields=this.options.visibleBlocks.filter((e=>t.includes(e)))}v.EventEmitter.emit(this,"ProductForm:onModeChange",{mode:t})}t.ProductForm=ut;t.FormMode=B})(this.BX.Catalog=this.BX.Catalog||{},BX,BX,BX,BX.UI,BX,BX.UI,BX,BX.UI,BX.Catalog,BX.UI.EntitySelector,BX.Catalog,BX,BX.Main,BX,BX.UI,BX.UI,window,BX,BX.UI,BX,BX,BX,BX,BX.UI.Dialogs,BX,BX,BX.Event,BX.Currency,BX.Catalog); //# sourceMappingURL=product-form.bundle.map.js