Pman.Tab.XtupleCurrency.bjs
[Pman.Xtuple] / Pman.Tab.XtupleCurrency.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Pman.Tab.XtupleCurrency = new Roo.XComponent({
6     part     :  ["Xtuple","Currency"],
7     order    : '001-Pman.Tab.XtupleCurrency',
8     region   : '',
9     parent   : false,
10     name     : "unnamed module",
11     disabled : false, 
12     permname : '', 
13     _tree : function()
14     {
15         var _this = this;
16         var MODULE = this;
17         return {
18             xtype: 'NestedLayoutPanel',
19             xns: Roo,
20             layout : {
21                 xtype: 'BorderLayout',
22                 xns: Roo,
23                 items : [
24                     {
25                         xtype: 'GridPanel',
26                         xns: Roo,
27                         listeners : {
28                             activate : function() {
29                                 _this.panel = this;
30                                 if (_this.grid) {
31                                     _this.grid.footer.onClick('first');
32                                 }
33                             }
34                         },
35                         background : false,
36                         fitContainer : true,
37                         fitToframe : true,
38                         region : 'west',
39                         tableName : 'curr_symbol',
40                         title : "curr_symbol",
41                         grid : {
42                             xtype: 'Grid',
43                             xns: Roo.grid,
44                             autoExpandColumn : 'curr_name',
45                             loadMask : true,
46                             listeners : {
47                                 render : function() 
48                                 {
49                                     _this.grid = this; 
50                                     //_this.dialog = Pman.Dialog.FILL_IN
51                                     if (_this.panel.active) {
52                                        this.footer.onClick('first');
53                                     }
54                                 },
55                                 rowdblclick : function (_self, rowIndex, e)
56                                 {
57                                     if (!_this.dialog) return;
58                                     _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
59                                         _this.grid.footer.onClick('first');
60                                     }); 
61                                 }
62                             },
63                             dataSource : {
64                                 xtype: 'Store',
65                                 xns: Roo.data,
66                                 remoteSort : true,
67                                 sortInfo : { field : 'curr_name', direction: 'ASC' },
68                                 proxy : {
69                                     xtype: 'HttpProxy',
70                                     xns: Roo.data,
71                                     method : 'GET',
72                                     url : baseURL + '/Roo/curr_symbol.php'
73                                 },
74                                 reader : {
75                                     xtype: 'JsonReader',
76                                     xns: Roo.data,
77                                     totalProperty : 'total',
78                                     root : 'data',
79                                     id : 'id',
80                                     fields : [
81                                         {
82                                             'name': 'curr_id',
83                                             'type': 'int'
84                                         },
85                                         {
86                                             'name': 'curr_base',
87                                             'type': 'int'
88                                         },
89                                         {
90                                             'name': 'curr_name',
91                                             'type': 'string'
92                                         },
93                                         {
94                                             'name': 'curr_symbol',
95                                             'type': 'string'
96                                         },
97                                         {
98                                             'name': 'curr_abbr',
99                                             'type': 'string'
100                                         }
101                                     ]
102                                 }
103                             },
104                             footer : {
105                                 xtype: 'PagingToolbar',
106                                 xns: Roo,
107                                 pageSize : 25,
108                                 displayInfo : true,
109                                 displayMsg : "Displaying curr_symbol{0} - {1} of {2}",
110                                 emptyMsg : "No curr_symbol found"
111                             },
112                             toolbar : {
113                                 xtype: 'Toolbar',
114                                 xns: Roo,
115                                 items : [
116                                     {
117                                         xtype: 'Button',
118                                         xns: Roo.Toolbar,
119                                         text : "Add",
120                                         cls : 'x-btn-text-icon',
121                                         icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
122                                         listeners : {
123                                             click : function()
124                                             {
125                                                 if (!_this.dialog) return;
126                                                 _this.dialog.show( { id : 0 } , function() {
127                                                     _this.grid.footer.onClick('first');
128                                                }); 
129                                             }
130                                         }
131                                     },
132                                     {
133                                         xtype: 'Button',
134                                         xns: Roo.Toolbar,
135                                         text : "Edit",
136                                         cls : 'x-btn-text-icon',
137                                         icon : Roo.rootURL + 'images/default/tree/leaf.gif',
138                                         listeners : {
139                                             click : function()
140                                             {
141                                                 var s = _this.grid.getSelectionModel().getSelections();
142                                                 if (!s.length || (s.length > 1))  {
143                                                     Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
144                                                     return;
145                                                 }
146                                                 if (!_this.dialog) return;
147                                                 _this.dialog.show(s[0].data, function() {
148                                                     _this.grid.footer.onClick('first');
149                                                 }); 
150                                                 
151                                             }
152                                         }
153                                     },
154                                     {
155                                         xtype: 'Button',
156                                         xns: Roo.Toolbar,
157                                         text : "Delete",
158                                         cls : 'x-btn-text-icon',
159                                         icon : rootURL + '/Pman/templates/images/trash.gif',
160                                         listeners : {
161                                             click : function()
162                                             {
163                                                  Pman.genericDelete(_this, 'curr_symbol'); 
164                                             }
165                                         }
166                                     }
167                                 ]
168                             },
169                             colModel : [
170                                 {
171                                     xtype: 'ColumnModel',
172                                     xns: Roo.grid,
173                                     header : 'Curr',
174                                     width : 75,
175                                     dataIndex : 'curr_id',
176                                     renderer : function(v) { return String.format('{0}', v); }
177                                 },
178                                 {
179                                     xtype: 'ColumnModel',
180                                     xns: Roo.grid,
181                                     header : 'Curr base',
182                                     width : 75,
183                                     dataIndex : 'curr_base',
184                                     renderer : function(v) { return String.format('{0}', v); }
185                                 },
186                                 {
187                                     xtype: 'ColumnModel',
188                                     xns: Roo.grid,
189                                     header : 'Curr name',
190                                     width : 200,
191                                     dataIndex : 'curr_name',
192                                     renderer : function(v) { return String.format('{0}', v); }
193                                 },
194                                 {
195                                     xtype: 'ColumnModel',
196                                     xns: Roo.grid,
197                                     header : 'Curr symbol',
198                                     width : 200,
199                                     dataIndex : 'curr_symbol',
200                                     renderer : function(v) { return String.format('{0}', v); }
201                                 },
202                                 {
203                                     xtype: 'ColumnModel',
204                                     xns: Roo.grid,
205                                     header : 'Curr abbr',
206                                     width : 200,
207                                     dataIndex : 'curr_abbr',
208                                     renderer : function(v) { return String.format('{0}', v); }
209                                 }
210                             ]
211                         }
212                     },
213                     {
214                         xtype: 'GridPanel',
215                         xns: Roo,
216                         listeners : {
217                             activate : function() {
218                                 _this.rpanel = this;
219                                 if (_this.rgrid) {
220                                     _this.rgrid.footer.onClick('first');
221                                 }
222                             }
223                         },
224                         background : false,
225                         fitContainer : true,
226                         fitToframe : true,
227                         region : 'center',
228                         tableName : 'curr_rate',
229                         title : "curr_rate",
230                         grid : {
231                             xtype: 'Grid',
232                             xns: Roo.grid,
233                             listeners : {
234                                 render : function() 
235                                 {
236                                     _this.rgrid = this; 
237                                     //_this.dialog = Pman.Dialog.FILL_IN
238                                     if (_this.rpanel.active) {
239                                        this.footer.onClick('first');
240                                     }
241                                 },
242                                 rowdblclick : function (_self, rowIndex, e)
243                                 {
244                                     if (!_this.dialog) return;
245                                     _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
246                                         _this.grid.footer.onClick('first');
247                                     }); 
248                                 }
249                             },
250                             autoExpandColumn : '',
251                             loadMask : true,
252                             dataSource : {
253                                 xtype: 'Store',
254                                 xns: Roo.data,
255                                 remoteSort : true,
256                                 sortInfo : { field : '', direction: 'ASC' },
257                                 proxy : {
258                                     xtype: 'HttpProxy',
259                                     xns: Roo.data,
260                                     method : 'GET',
261                                     url : baseURL + '/Roo/curr_rate.php'
262                                 },
263                                 reader : {
264                                     xtype: 'JsonReader',
265                                     xns: Roo.data,
266                                     totalProperty : 'total',
267                                     root : 'data',
268                                     id : 'id',
269                                     fields : [
270                                         {
271                                             'name': 'curr_rate_id',
272                                             'type': 'int'
273                                         },
274                                         {
275                                             'name': 'curr_id',
276                                             'type': 'int'
277                                         },
278                                         {
279                                             'name': 'curr_id',
280                                             'type': 'int'
281                                         },
282                                         {
283                                             'name': 'curr_rate',
284                                             'type': 'float'
285                                         },
286                                         {
287                                             'name': 'curr_effective',
288                                             'type': 'date',
289                                             'dateFormat': 'Y-m-d'
290                                         },
291                                         {
292                                             'name': 'curr_expires',
293                                             'type': 'date',
294                                             'dateFormat': 'Y-m-d'
295                                         }
296                                     ]
297                                 }
298                             },
299                             footer : {
300                                 xtype: 'PagingToolbar',
301                                 xns: Roo,
302                                 pageSize : 25,
303                                 displayInfo : true,
304                                 displayMsg : "Displaying curr_rate{0} - {1} of {2}",
305                                 emptyMsg : "No curr_rate found"
306                             },
307                             toolbar : {
308                                 xtype: 'Toolbar',
309                                 xns: Roo,
310                                 items : [
311                                     {
312                                         xtype: 'Button',
313                                         xns: Roo.Toolbar,
314                                         text : "Add",
315                                         cls : 'x-btn-text-icon',
316                                         icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
317                                         listeners : {
318                                             click : function()
319                                             {
320                                                 if (!_this.dialog) return;
321                                                 _this.dialog.show( { id : 0 } , function() {
322                                                     _this.grid.footer.onClick('first');
323                                                }); 
324                                             }
325                                         }
326                                     },
327                                     {
328                                         xtype: 'Button',
329                                         xns: Roo.Toolbar,
330                                         text : "Edit",
331                                         cls : 'x-btn-text-icon',
332                                         icon : Roo.rootURL + 'images/default/tree/leaf.gif',
333                                         listeners : {
334                                             click : function()
335                                             {
336                                                 var s = _this.grid.getSelectionModel().getSelections();
337                                                 if (!s.length || (s.length > 1))  {
338                                                     Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
339                                                     return;
340                                                 }
341                                                 if (!_this.dialog) return;
342                                                 _this.dialog.show(s[0].data, function() {
343                                                     _this.grid.footer.onClick('first');
344                                                 }); 
345                                                 
346                                             }
347                                         }
348                                     },
349                                     {
350                                         xtype: 'Button',
351                                         xns: Roo.Toolbar,
352                                         text : "Delete",
353                                         cls : 'x-btn-text-icon',
354                                         icon : rootURL + '/Pman/templates/images/trash.gif',
355                                         listeners : {
356                                             click : function()
357                                             {
358                                                  Pman.genericDelete(_this, 'curr_rate'); 
359                                             }
360                                         }
361                                     }
362                                 ]
363                             },
364                             colModel : [
365                                 {
366                                     xtype: 'ColumnModel',
367                                     xns: Roo.grid,
368                                     header : 'Curr rate',
369                                     width : 75,
370                                     dataIndex : 'curr_rate_id',
371                                     renderer : function(v) { return String.format('{0}', v); }
372                                 },
373                                 {
374                                     xtype: 'ColumnModel',
375                                     xns: Roo.grid,
376                                     header : 'Curr',
377                                     width : 75,
378                                     dataIndex : 'curr_id',
379                                     renderer : function(v) { return String.format('{0}', v); }
380                                 },
381                                 {
382                                     xtype: 'ColumnModel',
383                                     xns: Roo.grid,
384                                     header : 'Curr',
385                                     width : 75,
386                                     dataIndex : 'curr_id',
387                                     renderer : function(v) { return String.format('{0}', v); }
388                                 },
389                                 {
390                                     xtype: 'ColumnModel',
391                                     xns: Roo.grid,
392                                     header : 'Curr rate',
393                                     width : 75,
394                                     dataIndex : 'curr_rate',
395                                     renderer : function(v) { return String.format('{0}', v); }
396                                 },
397                                 {
398                                     xtype: 'ColumnModel',
399                                     xns: Roo.grid,
400                                     header : 'Curr effective',
401                                     width : 75,
402                                     dataIndex : 'curr_effective',
403                                     renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
404                                 },
405                                 {
406                                     xtype: 'ColumnModel',
407                                     xns: Roo.grid,
408                                     header : 'Curr expires',
409                                     width : 75,
410                                     dataIndex : 'curr_expires',
411                                     renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
412                                 }
413                             ]
414                         }
415                     }
416                 ],
417                 west : {
418                     xtype: 'LayoutRegion',
419                     xns: Roo
420                 },
421                 center : {
422                     xtype: 'LayoutRegion',
423                     xns: Roo
424                 }
425             }
426         };
427     }
428 });