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 loaddate',
224                                     width : 75,
225                                     dataIndex : 'report_loaddate',
226                                     renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
227                                 }
228                             ]
229                         }
230                     },
231                     {
232                         xtype: 'GridPanel',
233                         xns: Roo,
234                         title : "report",
235                         fitToframe : true,
236                         fitContainer : true,
237                         tableName : 'report',
238                         background : true,
239                         region : 'center',
240                         listeners : {
241                             activate : function() {
242                                 _this.panel = this;
243                                 if (_this.grid) {
244                                     _this.grid.footer.onClick('first');
245                                 }
246                             }
247                         },
248                         grid : {
249                             xtype: 'Grid',
250                             xns: Roo.grid,
251                             autoExpandColumn : 'report_name',
252                             loadMask : true,
253                             listeners : {
254                                 render : function() 
255                                 {
256                                     _this.grid = this; 
257                                     //_this.dialog = Pman.Dialog.FILL_IN
258                                     if (_this.panel.active) {
259                                        this.footer.onClick('first');
260                                     }
261                                 },
262                                 rowdblclick : function (_self, rowIndex, e)
263                                 {
264                                     if (!_this.dialog) return;
265                                     _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
266                                         _this.grid.footer.onClick('first');
267                                     }); 
268                                 }
269                             },
270                             dataSource : {
271                                 xtype: 'Store',
272                                 xns: Roo.data,
273                                 remoteSort : true,
274                                 sortInfo : { field : 'report_name', direction: 'ASC' },
275                                 proxy : {
276                                     xtype: 'HttpProxy',
277                                     xns: Roo.data,
278                                     method : 'GET',
279                                     url : baseURL + '/Roo/report.php'
280                                 },
281                                 reader : {
282                                     xtype: 'JsonReader',
283                                     xns: Roo.data,
284                                     totalProperty : 'total',
285                                     root : 'data',
286                                     id : 'id',
287                                     fields : [
288                                         {
289                                             'name': 'report_id',
290                                             'type': 'int'
291                                         },
292                                         {
293                                             'name': 'report_name',
294                                             'type': 'string'
295                                         },
296                                         {
297                                             'name': 'report_sys',
298                                             'type': 'int'
299                                         },
300                                         {
301                                             'name': 'report_source',
302                                             'type': 'string'
303                                         },
304                                         {
305                                             'name': 'report_descrip',
306                                             'type': 'string'
307                                         },
308                                         {
309                                             'name': 'report_grade',
310                                             'type': 'int'
311                                         },
312                                         {
313                                             'name': 'report_loaddate',
314                                             'type': 'date',
315                                             'dateFormat': 'Y-m-d'
316                                         }
317                                     ]
318                                 }
319                             },
320                             footer : {
321                                 xtype: 'PagingToolbar',
322                                 xns: Roo,
323                                 pageSize : 25,
324                                 displayInfo : true,
325                                 displayMsg : "Displaying report{0} - {1} of {2}",
326                                 emptyMsg : "No report found"
327                             },
328                             colModel : [
329                                 {
330                                     xtype: 'ColumnModel',
331                                     xns: Roo.grid,
332                                     header : 'Report grade',
333                                     width : 75,
334                                     dataIndex : 'report_grade',
335                                     renderer : function(v) { return String.format('{0}', v); }
336                                 },
337                                 {
338                                     xtype: 'ColumnModel',
339                                     xns: Roo.grid,
340                                     header : 'Report loaddate',
341                                     width : 75,
342                                     dataIndex : 'report_loaddate',
343                                     renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
344                                 }
345                             ]
346                         }
347                     }
348                 ],
349                 center : {
350                     xtype: 'LayoutRegion',
351                     xns: Roo
352                 },
353                 east : {
354                     xtype: 'LayoutRegion',
355                     xns: Roo,
356                     title : "Versions",
357                     titlebar : true,
358                     width : 150
359                 }
360             }
361         };
362     }
363 });