dojo.provide("parus.balanceRemarksDialog");dojo.require("dijit.Dialog");dojo.require("dijit.form.Button");dojo.require("dojox.grid.DataGrid");dojo.require("dojo.data.ItemFileReadStore");dojo.require("parus.parus8");dojo.require("parus.dialog");dojo.require("parus.gridSettingsDialog");dojo.declare("parus.balanceRemarksDialog",[parus.Dialog],{store:null,queryInfo:null,pane:null,readonly:false,postCreate:function(){this.inherited(arguments);this.remarksGrid.attr("store",this.store);this.remarksGrid.setQuery(this.queryInfo);this.remarksGrid.selection.select(0);this.remarksGridPopupMenu.bindDomNode(this.remarksGrid.viewsNode);parus.balance._createActionsButton(this.remarksGridPopupMenu,this.headerPane);var a=parus.userdata.get(this.declaredClass);if(a){parus.gridSettingsDialog.mergeMenuSettings(this.remarksGridPopupMenu,a.actionSettings,a.userProcsActions,a.userReportsActions,a.userAppsActions);parus.gridSettingsDialog.mergeGridSettings(this.remarksGrid,a.gridSettings);parus.gridSettingsDialog.mergeColorConditions(this.remarksGrid,a.colorConditions);parus.gridSettingsDialog.mergeFilterBar(this.remarksGrid,a.showFilterBar,a.filterValues,a.sortInfo)}this.noteEdit.attr("value",null);setTimeout(dojo.hitch(this,function(){this._selected()}),100)},_selected:function(){var a=this.remarksGrid.getItem(this.remarksGrid.selection.getSelectedIndex());this.noteEdit.attr("value",this.store.getValue(a,"NOTE"));dojo.forEach(this.remarksGridPopupMenu.getChildren(),function(c){var b=a?false:true;if(!c.itemAction){b=false}if(c.declaredClass!="dijit.MenuSeparator"){c.attr("disabled",b)}});if(this.readonly){this.addRemerkMenuItem.attr("disabled",true);this.duplicateRemerkMenuItem.attr("disabled",true);this.clearRemarksMenuItem.attr("disabled",true)}parus.parus8.checkMenuSeparators(this.remarksGridPopupMenu)},clearRemarks:function(){this.pane.clearRemarks(dojo.clone(this.queryInfo),dojo.hitch(this,dojo.hitch(this,this._remarkCreated)))},addRemark:function(){this.pane.createRemark(dojo.clone(this.queryInfo),dojo.hitch(this,dojo.hitch(this,this._remarkCreated)))},duplicateRemark:function(){var b=this.remarksGrid.getItem(this.remarksGrid.selection.getSelectedIndex());var a={NOTE:this.store.getValue(b,"NOTE"),CODE:this.store.getValue(b,"CODE")};dojo.mixin(a,this.queryInfo);this.pane.createRemark(a,dojo.hitch(this,this._remarkCreated))},_remarkCreated:function(){var a=dojo.clone(this.queryInfo);dojo.mixin(a,{onComplete:dojo.hitch(this,function(){this.remarksGrid.selection.select(this.remarksGrid._by_idx.length-1);this.remarksGrid.updateRow(this.remarksGrid._by_idx.length-1);this.remarksGrid.scrollToRow(this.remarksGrid._by_idx.length-1)})});this.remarksGrid.setQuery(a)},settings:function(){parus.balance.executeSettings(this.remarksGrid,this.remarksGridPopupMenu,this.declaredClass)},destroy:function(){this.store=null;this.inherited(arguments)},gridFilterChanged:function(b,a){parus.balance.gridFilterChanged(this.declaredClass,b,a)}});