GO.currencies.currenciesStore=new GO.data.JsonStore({url:GO.settings.modules.currencies.url+"json.php",baseParams:{task:"currencies"},root:"results",id:"code",totalProperty:"total",fields:["code","symbol","value"],remoteSort:true});GO.currencies.SelectCurrency=function(a){Ext.apply(this,a);this.store=GO.currencies.currenciesStore;GO.currencies.SelectCurrency.superclass.constructor.call(this,{valueField:"code",displayField:"code",width:50,triggerAction:"all",selectOnFocus:true,forceSelection:true,editable:false,mode:"local",lazyInit:false})};Ext.extend(GO.currencies.SelectCurrency,GO.form.ComboBox,{afterRender:function(){if(!this.store.loaded){this.store.load({callback:function(){var a=this.getValue();if(a){this.setValue(a)}},scope:this})}else{this.selectFirst()}GO.currencies.SelectCurrency.superclass.afterRender.call(this)}});GO.currencies.CurrenciesGrid=function(a){if(!a){a={}}a.title=GO.currencies.lang.currencies;a.layout="fit";a.autoScroll=true;a.store=GO.currencies.currenciesStore;var b=new Ext.grid.ColumnModel({defaults:{sortable:true},columns:[{header:GO.currencies.lang.code,dataIndex:"code",editor:new Ext.form.TextField()},{header:GO.currencies.lang.symbol,dataIndex:"symbol",editor:new Ext.form.TextField()},{header:GO.currencies.lang.value,dataIndex:"value",editor:new GO.form.NumberField()}]});a.cm=b;a.view=new Ext.grid.GridView({autoFill:true,forceFit:true,emptyText:GO.lang.strNoItems});a.sm=new Ext.grid.RowSelectionModel();a.loadMask=true;a.tbar=[{iconCls:"btn-add",text:GO.lang.cmdAdd,cls:"x-btn-text-icon",handler:function(){var c=new Ext.data.Record({code:"",value:1,symbol:""});this.stopEditing();this.store.insert(0,c);this.startEditing(0,0)},scope:this},{iconCls:"btn-delete",text:GO.lang.cmdDelete,cls:"x-btn-text-icon",handler:function(){var d=this.selModel.getSelections();for(var c=0;c<d.length;c++){d[c].commit();this.store.remove(d[c])}},scope:this},{iconCls:"btn-save",text:GO.lang.cmdSave,cls:"x-btn-text-icon",handler:function(){this.getEl().mask(GO.lang.waitMsgLoad);Ext.Ajax.request({url:GO.settings.modules.currencies.url+"action.php",params:{task:"save_currencies",currencies:Ext.encode(this.getGridData())},callback:function(d,e,c){this.store.commitChanges();this.getEl().unmask()},scope:this})},scope:this}];GO.currencies.CurrenciesGrid.superclass.constructor.call(this,a)};Ext.extend(GO.currencies.CurrenciesGrid,Ext.grid.EditorGridPanel,{afterRender:function(){GO.currencies.CurrenciesGrid.superclass.afterRender.call(this);this.store.load()},getGridData:function(){var d={};for(var b=0;b<this.store.data.items.length;b++){var c=this.store.data.items[b].data;d[b]={};for(var a in c){d[b][a]=c[a]}}return d},setIds:function(b){for(var a in b){if(a!="remove"){this.store.getAt(a).set("id",b[a])}}}});GO.moduleManager.addModule("currencies",GO.currencies.CurrenciesGrid,{title:GO.currencies.lang.currencies,iconCls:"go-tab-icon-currencies",admin:true});