"use strict";(self["webpackChunkcarabi_x2"]=self["webpackChunkcarabi_x2"]||[]).push([[9274],{6580:function(t,e,i){i.r(e),i.d(e,{default:function(){return c}});var n=function(){var t=this,e=t._self._c;return t.curNode?e("div",{staticClass:"uk-margin-small-bottom uk-flex uk-flex-row",staticStyle:{"overflow-y":"auto","max-height":"150px"}},[t.editing?t._e():e("div",{staticStyle:{flex:"1","min-width":"1px"}},[e("h4",{staticClass:"uk-text-center uk-margin-remove"},[t._v(t._s(t.newTitle))])]),t.editing?e("div",{staticStyle:{flex:"1","min-width":"1px"}},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.newTitle,expression:"newTitle"}],ref:"editTitle",staticClass:"uk-input uk-text-center uk-text-bold",domProps:{value:t.newTitle},on:{keydown:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:(e.preventDefault(),t.renameDirectory.apply(null,arguments))},input:function(e){e.target.composing||(t.newTitle=e.target.value)}}})]):t._e(),t.editing?e("div",{staticClass:"uk-margin-small-left",staticStyle:{flex:"1","min-width":"1px"}},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.newCode,expression:"newCode"}],ref:"editCode",staticClass:"uk-input uk-text-center uk-text-bold",attrs:{placeholder:"Системное имя"},domProps:{value:t.newCode},on:{keydown:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:(e.preventDefault(),t.renameDirectory.apply(null,arguments))},input:function(e){e.target.composing||(t.newCode=e.target.value)}}})]):t._e(),t.writable?e("div",{staticClass:"uk-margin-small-left",staticStyle:{width:"60px"}},[t.editing?t._e():e("button",{staticClass:"uk-button uk-button-small uk-width-1-2",on:{click:function(e){return t.startEdit()}}},[e("i",{staticClass:"far fa-edit"})]),t.editing?t._e():e("button",{staticClass:"uk-button uk-button-small uk-width-1-2",on:{click:t.deleteDirectory}},[e("i",{staticClass:"far fa-trash-alt"})]),t.editing?e("button",{staticClass:"uk-button uk-button-success uk-width-1-1",on:{click:t.renameDirectory}},[e("i",{staticClass:"fas fa-check"})]):t._e()]):t._e()]):t._e()},r=[],a=i(3216),s=i(4041)["A"],l={name:"ClassificatorTitle",props:{model:Object,writable:{type:Boolean,default:!1}},data(){return{editing:!1,newTitle:"",newCode:""}},computed:{curNode(){return this.model.data.curNode},curPath(){return[]},title(){return this.curPath.length>0?this.curPath.map((t=>t.RES_NAME)).join(" / "):this.curNode?this.curNode.row.RES_NAME:""}},watch:{curNode(){console.log("curNode watch"),this.editing=!1,this.curNode&&(this.newTitle=this.curNode.row.RES_NAME||"",this.newCode=this.curNode.row.RES_CODE||"")}},mounted(){},methods:{async startEdit(){this.writable&&(this.newTitle=this.curNode.row.RES_NAME||"",this.newCode=this.curNode.row.RES_CODE||"",this.editing=!0,await this.$nextTick(),this.$refs.editTitle.focus(),this.$refs.editTitle.select())},async deleteDirectory(){try{await s.confirm(`Удалить директорию "${this.curNode.row.RES_NAME}"?`)}catch(e){return}await a.FH.queries.query("APPL_RESOURCES_CS.DELETE_RESOURCE",{RS_ID:this.curNode.row.RS_ID});let t=this.curNode.parent||null;this.model.setCurNode(t),await this.model.reloadChildren(t)},async renameDirectory(){await a.FH.queries.query("APPL_RESOURCES_CS.RENAME_RESOURCE",{RS_ID:this.curNode.row.RS_ID,NAME:this.newTitle,CODE:this.newCode}),this.editing=!1,await this.model.reloadChildren(this.curNode.parent||null)}}},o=l,u=i(1656),d=(0,u.A)(o,n,r,!1,null,null,null),c=d.exports}}]);
//# sourceMappingURL=ClassificatorTitle.7949e5b6.js.map