"use strict";(self["webpackChunkcarabi_x2"]=self["webpackChunkcarabi_x2"]||[]).push([[2844],{865:function(t,e,s){s.r(e),s.d(e,{default:function(){return c}});var i=function(){var t=this,e=t._self._c;return e("Modal",{ref:"modal",attrs:{title:t.title,autoOpen:!0,fullHeight:!1},on:{closed:function(e){return t.$emit("closed")},opened:t.opened}},[e("form",{staticClass:"uk-padding-small",staticStyle:{"flex-grow":"1","min-height":"1px",overflow:"auto"},on:{submit:function(e){return e.preventDefault(),t.submit.apply(null,arguments)}}},[e("div",{staticClass:"uk-form-horizontal"},[e("div",{staticClass:"uk-margin-small-bottom uk-clearfix"},[e("label",{staticClass:"uk-form-label"},[t._v("Название")]),e("div",{staticClass:"uk-form-controls"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.name,expression:"name"}],ref:"name",staticClass:"uk-input uk-width-1-1",attrs:{placeholder:"Имя файла"},domProps:{value:t.name},on:{input:function(e){e.target.composing||(t.name=e.target.value)}}})])]),t.isFolder?t._e():e("div",{staticClass:"uk-margin-small-bottom uk-clearfix"},[e("label",{staticClass:"uk-form-label"},[t._v("Описание")]),e("div",{staticClass:"uk-form-controls"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.description,expression:"description"}],staticClass:"uk-input uk-width-1-1",attrs:{placeholder:"Описание файла"},domProps:{value:t.description},on:{input:function(e){e.target.composing||(t.description=e.target.value)}}})])]),t.isFolder?t._e():e("div",{staticClass:"uk-margin-small-bottom uk-clearfix"},[e("label",{staticClass:"uk-form-label"},[t._v("Дата создания")]),e("div",{staticClass:"uk-form-controls uk-form-controls-text uk-text-left uk-text-bold"},[t._v(t._s(t.createDate))])]),t.isFolder?t._e():e("div",{staticClass:"uk-margin-small-bottom uk-clearfix"},[e("label",{staticClass:"uk-form-label"},[t._v("Размер")]),e("div",{staticClass:"uk-form-controls uk-form-controls-text uk-text-left uk-text-bold"},[t._v(t._s(t.size))])])]),e("div",{staticClass:"uk-text-center"},[e("button",{staticClass:"rename-submit uk-button uk-border-rounded uk-button-success",attrs:{type:"submit",disabled:t.submitting}},[t._v(" Сохранить ")])])])])},a=[],l=s(2598),r=s(3216),o={name:"FilesEdit",components:{Modal:()=>s.e(8362).then(s.bind(s,2215))},props:{params:{type:Object}},data:()=>({name:"",description:"",isFolder:!1,createDate:"",size:"",submitting:!1}),computed:{title(){return"newFolder"===this.params.operation?"Новая папка":this.isFolder?"Редактировать папку":"Редактировать файл"}},created(){"newFolder"!==this.params.operation?(this.isFolder="dir"===this.params.file.DOC_TYPE,this.name=this.params.file.DOC_NAME,this.isFolder||(this.description=this.params.file.DOC_DESCR,this.createDate=this.params.file.EVENT_DATE,this.size=(0,l.A)(this.params.file.FILE_SIZE))):this.isFolder=!0},methods:{opened(){this.$refs.name.focus(),this.$refs.name.select()},async submit(){if(!this.submitting){this.submitting=!0;try{"newFolder"===this.params.operation?await r.FH.fileStorage.createFolder(this.name,this.params.parentId,"folder"):this.isFolder?await r.vd.query("CRM_UPDATE_FODER_NAME_CS",{FOLDER_ID:this.params.file.DOCUMENT_ID,FOLDER_NAME:this.name}):await r.vd.query("CRM_UPDATE_FILE_NAME_CS",{DOC_NAME:this.name,DOC_DESCR:this.description,DOCUMENT_ID:this.params.file.DOCUMENT_ID})}catch(t){throw this.submitting=!1,t}this.submitting=!1,this.$emit("change"),this.$refs.modal.close()}}}},n=o,u=s(1656),m=(0,u.A)(n,i,a,!1,null,null,null),c=m.exports},2598:function(t,e,s){function i(t){let e=["Байт","KB","MB","GB","TB"];if(0==t)return"n/a";let s=parseInt(Math.floor(Math.log(t)/Math.log(1024)));return 0==s?t+" "+e[s]:(t/Math.pow(1024,s)).toFixed(1)+" "+e[s]}s.d(e,{A:function(){return i}})}}]);
//# sourceMappingURL=FilesEdit.8aa36956.js.map