Ext.define("KSWN.meta.settings.automatAnalyze.model.Group",{extend:"KSWN.core.data.TreeModel",fields:[{name:"object",type:"int"},{name:"name",type:"string"},{name:"link_up",type:"int",allowNull:!0},{name:"orders",type:"int"}]}),Ext.define("KSWN.meta.settings.automatAnalyze.store.Outcome",{extend:"KSWN.meta.settings.newVariantEdit.store.Outcome",alias:"store.ks-meta-settings-automatanalyze-store-outcome",loadUrl:"/Automat/LoadOutcomeANALYZE",infoTableName:"fpo",tablesForSave:["fpo","grp","ctrl_data"]}),Ext.define("KSWN.meta.settings.automatAnalyze.ViewController",{extend:"Ext.app.ViewController",alias:"controller.ks-meta-settings-automatanalyze",onOutcomeStoreLoad:function(store){const vm=this.getViewModel(),groupsTreeStore=vm.get("groupsTreeStore"),{fpo:fpo,grp:grp,ctrl_data:ctrl_data}=store.getTablesMap(),fpoInfo=_.head(fpo);vm.set({...fpoInfo,controls:ctrl_data,forceSetCheckboxDisabled:!fpoInfo.hasOwnProperty("force_set")}),groupsTreeStore.setOutcomeData(grp)},onControlsPanelSelectControlDictValue:function(controlsPanel,ctrl,dictResult){var _dictResult$configPar;const vm=this.getViewModel(),row=dictResult.rows[0];if(!row)return;const value=row[(null===(_dictResult$configPar=dictResult.configParams.DictFields)||void 0===_dictResult$configPar?void 0:_dictResult$configPar.split(",")[0])||"code"];vm.set(ctrl.field_data.toLowerCase(),value)}}),Ext.define("KSWN.meta.settings.automatAnalyze.ViewModel",{extend:"Ext.app.ViewModel",alias:"viewmodel.ks-meta-settings-automatanalyze",data:{loadParams:null,link:null,name:null,controls:null,forceSetCheckboxDisabled:!1},stores:{outcomeStore:{type:"ks-meta-settings-automatanalyze-store-outcome",loadParams:"{loadParams}",listeners:{outcomeload:"onOutcomeStoreLoad"}},groupsTreeStore:{type:"ks-core-data-tree",model:"KSWN.meta.settings.automatAnalyze.model.Group",setUpdateOnCheckChange:!0,nodeIconCls:KSWN.Constant.iconClsPrefix+"document",root:{}}}}),Ext.define("KSWN.meta.settings.automatAnalyze.view.Title",{extend:"Ext.Container",xtype:"ks-meta-settings-automatanalyze-view-title",layout:{type:"hbox",align:"center"},height:50,padding:"6 12",items:[{xtype:"textfield",labelAlign:"left",labelWidth:180,flex:1,fieldLabel:KSWN.Locale.naimenovanievarianta,bind:{value:"{name}"}}]}),Ext.define("KSWN.meta.settings.automatAnalyze.view.ControlsPanel",{extend:"Ext.form.FieldContainer",xtype:"ks-meta-settings-automatanalyze-view-controlspanel",scrollable:"y",labelWidth:100,layout:{type:"table",columns:2},defaults:{style:"padding:3px 6px;"},renderConfig:{controls:null},updateControls:function(controls,prevControls){prevControls&&this.removeAll();const textfields=controls.map(ctrl=>this.createTextField(ctrl));this.add(textfields)},createTextField:function(ctrl){var _ctrl$field_data;const alias=ctrl.field_alias,name=(null===(_ctrl$field_data=ctrl.field_data)||void 0===_ctrl$field_data?void 0:_ctrl$field_data.toLowerCase())??"",config={xtype:"textfield",fieldLabel:ctrl.title,labelAlign:"left",labelStyle:"white-space: nowrap; width: 50%!important; text-overflow:ellipsis;",editable:!1,width:"100%",macro:{cbFN:this.SetDictValues.bind(this,ctrl)},Info:{Alias:alias}};if(ctrl.control_dict_method){var funcs=new XMLFunctionsHandler(ctrl.control_dict_method);config.triggers={dict:{cls:"ks-icon-get_dictionary",handler:function(){KSWN.core.document.control.Helpers.doMacros({fns:funcs.Functions,ctrl:this})}}}}return name&&(config.bind={value:`{${name}}`}),config},SetDictValues:function(ctrl,dictResult){dictResult&&this.fireEvent("selectcontroldictvalue",this,ctrl,dictResult)}}),Ext.define("KSWN.meta.settings.automatAnalyze.Panel",{extend:"Ext.panel.Panel",mixins:["KSWN.core.toolbar.ToolbarOwner","KSWN.meta.settings.mixin.AutomatNewVariantEditor"],xtype:"ks-meta-settings-automatanalyze-panel",viewModel:"ks-meta-settings-automatanalyze",controller:"ks-meta-settings-automatanalyze",tablesForSaveVMAliases:{grp:"groupsTreeStore"},syncInfoHead:!0,layout:{type:"vbox",align:"stretch"},items:[{xtype:"ks-meta-settings-automatanalyze-view-title",flex:0},{xtype:"panel",title:KSWN.Locale.nastroikarekvizitov,layout:{type:"vbox",align:"stretch"},flex:1,items:[{xtype:"ks-core-tree-treepanel",flex:1,reference:"groupsTree",rootVisible:!1,bind:{store:"{groupsTreeStore}",selection:"{groupsTreeSelection}"}},{xtype:"fieldcontainer",padding:"6 12",flex:0,items:[{xtype:"ks-ux-field-iocheckbox",boxLabel:KSWN.Locale.vsegda_zamenyat_tekushie_znacheniya_v_dokumente,bind:{disabled:"{forceSetCheckboxDisabled}",value:"{force_set}"}}]},{xtype:"ks-meta-settings-automatanalyze-view-controlspanel",flex:1,reference:"controlsPanel",listeners:{selectcontroldictvalue:"onControlsPanelSelectControlDictValue"},bind:{controls:"{controls}"}}]}],initComponent:function(){this.callParent(),this.objx.tree=this.lookupReference("groupsTree")}});