"use strict";(self["webpackChunkcarabi_x2"]=self["webpackChunkcarabi_x2"]||[]).push([[6693],{4338:function(e,t,s){s.r(t),s.d(t,{default:function(){return u}});var l=function(){var e=this,t=e._self._c;return t("Modal",{ref:"modal",attrs:{title:e.field.DOCPROP_NAME,fullHeight:!0,large:!1,autoOpen:!0},on:{opened:e.opened,closing:e.closing}},[e.loaded?t("tree",{ref:"tree",attrs:{selectKind:e.selectKind,value:e.value,DocKindId:e.docKindId,DocKindName:e.docKindName},on:{change:function(t){return e.treeChange(t)}}}):e._e(),e.selectKind?t("div",{staticClass:"uk-padding-small",staticStyle:{"padding-bottom":"0"}},[t("label",[t("input",{directives:[{name:"model",rawName:"v-model",value:e.selectRoot,expression:"selectRoot"}],staticClass:"pos-checkbox xsmall",attrs:{type:"checkbox"},domProps:{checked:Array.isArray(e.selectRoot)?e._i(e.selectRoot,null)>-1:e.selectRoot},on:{change:[function(t){var s=e.selectRoot,l=t.target,a=!!l.checked;if(Array.isArray(s)){var i=null,o=e._i(s,i);l.checked?o<0&&(e.selectRoot=s.concat([i])):o>-1&&(e.selectRoot=s.slice(0,o).concat(s.slice(o+1)))}else e.selectRoot=a},e.rootChecked]}}),e._v(" Выбрать корневой документ ")])]):e._e(),t("div",{},[t("div",{staticClass:"uk-padding-small",staticStyle:{"padding-bottom":"0"}},[t("input",{directives:[{name:"model",rawName:"v-model",value:e.newValue,expression:"newValue"}],staticClass:"uk-input flex-grow",domProps:{value:e.newValue},on:{input:function(t){t.target.composing||(e.newValue=t.target.value)}}})]),t("div",{staticClass:"uk-padding-small uk-text-center"},[t("button",{staticClass:"uk-modal-close uk-button",attrs:{disabled:e.saving}},[t("i",{staticClass:"uk-icon-close"}),e._v(" Отмена ")]),t("button",{staticClass:"uk-button uk-button-primary uk-margin-small-left",attrs:{disabled:e.saving},on:{click:e.save}},[t("i",{staticClass:"uk-icon-floppy-o"}),e._v(" Применить ")])])])],1)},a=[],i=s(3216),o={name:"DocPathModal",components:{Modal:()=>s.e(8362).then(s.bind(s,2215)),Tree:()=>Promise.all([s.e(5607),s.e(6417)]).then(s.bind(s,3858))},props:{field:Object,value:{type:String,default:null}},data(){return{loaded:!1,docKindId:null,docKindName:null,newValue:null,saving:!1,selectRoot:!1}},computed:{selectKind(){return"DOC_KIND_PATH"===this.field.DOCPROP_PRESENTATION}},created(){this.newValue=this.value},async mounted(){let e=await i.vd.selectRow("CRM_GET_VALUE_CS",{DOCUMENT_ID:this.field.DOCUMENT_ID,FIELD_NAME:this.field.DOCPROP_PRESENTATION_OPTIONS});this.docKindId=parseInt(e.VALUE);let t=await i.vd.selectRow("GET_DOCKIND_NAME_BY_DOCKIND_ID_CS",{dockind_id:this.docKindId});this.docKindName=t.DOCKIND_NAME,this.selectKind&&this.newValue===this.docKindName+".*"&&(this.selectRoot=!0),this.loaded=!0},methods:{opened(){},save(){this.saving=!0,this.close()},closing(){this.saving?this.$emit("change",{value:this.newValue,display:this.newValue}):this.$emit("close")},close(){this.$refs.modal.close()},rootChecked(){console.log("rootChecked",this.selectRoot),this.selectRoot&&(this.newValue=this.docKindName+".*",this.$refs.tree.unselect())},fillRoot(){},treeChange(e){this.newValue=e,this.selectRoot&&(this.selectRoot=!1)}}},n=o,c=s(1656),d=(0,c.A)(n,l,a,!1,null,null,null),u=d.exports}}]);
//# sourceMappingURL=DocPathModal.882a2c8c.js.map