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