Ext.define("KSWN.meta.toolbarAccess.model.TreeModel",{extend:"KSWN.core.data.TreeModel",fields:[{name:"checked",type:"boolean"},{name:"link",type:"string",mapping:data=>null==data?void 0:data.INode.Link},{name:"linkSelf",type:"string",mapping:data=>null==data?void 0:data.INode.SelfLink},{name:"code",type:"string",mapping:data=>null==data?void 0:data.INode.Code}],getDataForSave:function(){const{checked:checked,code:code}=this.data;return{Checked:checked,Code:code}}}),Ext.define("KSWN.meta.toolbarAccess.store.TreeStore",{extend:"KSWN.core.data.TreeStore",model:"KSWN.meta.toolbarAccess.model.TreeModel",alias:"store.ks-meta-toolbaraccess-tree",linkField:"Link",linkSelfField:"SelfLink",getDataForSave:function(){return this.getModifiedRecords().map(node=>node.getDataForSave())}}),Ext.define("KSWN.meta.toolbarAccess.view.Tree",{extend:"KSWN.core.tree.TreePanel",xtype:"ks-meta-toolbaraccess-tree",rootVisible:!1}),Ext.define("KSWN.meta.toolbarAccess.view.ViewController",{extend:"KSWN.core.document.view.ViewController",alias:"controller.ks-meta-toolbaraccess",onOkBtnClick:function(){this.getDocument().close()},onCancelBtnClick:function(){this.getDocument().close()},onApplyBtnClick:function(){this.getDocument().save()}}),Ext.define("KSWN.meta.toolbarAccess.view.ViewModel",{extend:"KSWN.core.document.view.ViewModel",alias:"viewmodel.ks-meta-toolbaraccess",data:{objName:null,userName:null,treeSelection:null,isModified:!1},formulas:{isModified:{bind:{bindTo:"{treeStore}",deep:!0},get:store=>store.isModified()}},stores:{treeStore:{type:"ks-meta-toolbaraccess-tree"}},getTreeStore:function(){return this.get("treeStore")}}),Ext.define("KSWN.meta.toolbarAccess.view.View",{extend:"KSWN.core.document.view.View",xtype:"ks-meta-toolbaraccess-view",viewModel:"ks-meta-toolbaraccess",controller:"ks-meta-toolbaraccess",layout:{type:"vbox",align:"stretch"},items:[{xtype:"container",layout:"form",padding:7,defaultType:"textfield",defaults:{editable:!1,readOnly:!0,labelWidth:200},items:[{fieldLabel:KSWN.Locale.obekt,bind:"{objName}"},{fieldLabel:KSWN.Locale.polzovatelgruppa,bind:"{userName}"}]},{xtype:"ks-meta-toolbaraccess-tree",flex:1,bind:{store:"{treeStore}",selection:"{treeSelection}"}}],fbar:[{text:"OK",handler:"onOkBtnClick"},{text:KSWN.Locale.otmena,handler:"onCancelBtnClick"},{text:KSWN.Locale.primenit,handler:"onApplyBtnClick",bind:{disabled:"{!isModified}"}}]}),Ext.define("KSWN.meta.toolbarAccess.ToolbarAccess",{extend:"KSWN.core.document.AbstractDocument",statics:{defaultObjXConfig:{isWin:!0,width:560,height:520,objCode:"TOOLBAR_ACCESS",documentLink:-1},iconCls:KSWN.Constant.iconClsPrefix+"edit",title:KSWN.Locale.naznacheniyapravdostupakpaneliinstrumentov},uid:null,userName:null,objName:null,objCode:null,linkVar:null,fromMaket:null,viewType:"ks-meta-toolbaraccess-view",loadUrl:"/ToolbarAccess/LoadOutcome",saveUrl:"/ToolbarAccess/Save",getLoadParams:function(){return{identifier:{User:this.uid,Name:this.userName,ObjCode:this.objCode,ObjectName:this.objName,LinkVar:this.linkVar??0}}},applyLoadDataToViewModel:function(data){const vm=this.viewModel;vm.get("treeStore").loadTree(data),vm.set({objName:this.objName,userName:this.userName})},getParamsForSave:function(){const{uid:uid,fromMaket:fromMaket,linkVar:linkVar}=this,data=this.viewModel.get("treeStore").getDataForSave();return{linkVar:this.linkVar||null,data:data,uid:uid,fromMaket:fromMaket}},onSuccessSave:function(){this.viewModel.getTreeStore().resetModifiedState()},isModified:function(){return this.viewModel.getTreeStore().isModified()}});