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    : '500-Pman.Tab.XtupleReports',
8     region   : 'center',
9     parent   : 'Pman.Tab.Admin',
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                             listeners : {
46                                 render : function() 
47                                 {
48                                     _this.grid = this; 
49                                     //_this.dialog = Pman.Dialog.FILL_IN
50                                     if (_this.panel.active) {
51                                        this.footer.onClick('first');
52                                     }
53                                 },
54                                 rowdblclick : function (_self, rowIndex, e)
55                                 {
56                                     if (!_this.dialog) return;
57                                     _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
58                                         _this.grid.footer.onClick('first');
59                                     }); 
60                                 }
61                             },
62                             autoExpandColumn : 'report_descrip',
63                             loadMask : true,
64                             dataSource : {
65                                 xtype: 'Store',
66                                 xns: Roo.data,
67                                 listeners : {
68                                     beforeload : function (_self, options)
69                                     {
70                                         options.params['search[name]'] = _this.searchName.getValue();
71                                         options.params._max_versions = 1;
72                                     }
73                                 },
74                                 remoteSort : true,
75                                 sortInfo : { field : 'report_name', direction: 'ASC' },
76                                 proxy : {
77                                     xtype: 'HttpProxy',
78                                     xns: Roo.data,
79                                     method : 'GET',
80                                     url : baseURL + '/Roo/report.php'
81                                 },
82                                 reader : {
83                                     xtype: 'JsonReader',
84                                     xns: Roo.data,
85                                     totalProperty : 'total',
86                                     root : 'data',
87                                     id : 'id',
88                                     fields : [
89                                         {
90                                             'name': 'report_id',
91                                             'type': 'int'
92                                         },
93                                         {
94                                             'name': 'report_name',
95                                             'type': 'string'
96                                         },
97                                         {
98                                             'name': 'report_sys',
99                                             'type': 'int'
100                                         },
101                                         {
102                                             'name': 'report_source',
103                                             'type': 'string'
104                                         },
105                                         {
106                                             'name': 'report_descrip',
107                                             'type': 'string'
108                                         },
109                                         {
110                                             'name': 'report_grade',
111                                             'type': 'int'
112                                         },
113                                         {
114                                             'name': 'report_loaddate',
115                                             'type': 'date',
116                                             'dateFormat': 'Y-m-d'
117                                         }
118                                     ]
119                                 }
120                             },
121                             sm : {
122                                 xtype: 'RowSelectionModel',
123                                 xns: Roo.grid,
124                                 listeners : {
125                                     afterselectionchange : function (_self)
126                                     {
127                                         _this.vgrid.onClick('first');
128                                     }
129                                 },
130                                 singleSelect : true
131                             },
132                             footer : {
133                                 xtype: 'PagingToolbar',
134                                 xns: Roo,
135                                 pageSize : 25,
136                                 displayInfo : true,
137                                 displayMsg : "Displaying report{0} - {1} of {2}",
138                                 emptyMsg : "No report found"
139                             },
140                             toolbar : {
141                                 xtype: 'Toolbar',
142                                 xns: Roo,
143                                 items : [
144                                     {
145                                         xtype: 'TextField',
146                                         xns: Roo.form,
147                                         listeners : {
148                                             render : function (_self)
149                                             {
150                                                 _this.searchName = _self;
151                                             },
152                                             specialkey : function (_self, e)
153                                             {
154                                                 _this.grid.footer.onClick('first');
155                                             }
156                                         }
157                                     },
158                                     {
159                                         xtype: 'Button',
160                                         xns: Roo.Toolbar,
161                                         listeners : {
162                                             click : function (_self, e)
163                                             {
164                                             _this.grid.footer.onClick('first');
165                                             }
166                                         },
167                                         cls : 'x-btn-icon',
168                                         icon : rootURL + '/Pman/templates/images/search.gif'
169                                     },
170                                     {
171                                         xtype: 'Button',
172                                         xns: Roo.Toolbar,
173                                         listeners : {
174                                             click : function (_self, e)
175                                             {
176                                                 _this.searchBox.setValue('');
177                                                 _this.publication_name_combo.setValue('');
178                                                 _this.publication_lang_combo.setValue('');
179                                                 _this.country_combo.setValue('');
180                                                 _this.category_media_id_combo.setValue('');
181                                                 _this.role_combo.setValue('');      
182                                             
183                                                 
184                                                 _this.grid.footer.onClick('first');
185                                             }
186                                         },
187                                         cls : 'x-btn-icon',
188                                         icon : rootURL + '/Pman/templates/images/edit-clear.gif'
189                                     },
190                                     {
191                                         xtype: 'Fill',
192                                         xns: Roo.Toolbar
193                                     },
194                                     {
195                                         xtype: 'Button',
196                                         xns: Roo.Toolbar,
197                                         text : "Add",
198                                         cls : 'x-btn-text-icon',
199                                         icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
200                                         listeners : {
201                                             click : function()
202                                             {
203                                                 if (!_this.dialog) return;
204                                                 _this.dialog.show( { id : 0 } , function() {
205                                                     _this.grid.footer.onClick('first');
206                                                }); 
207                                             }
208                                         }
209                                     }
210                                 ]
211                             },
212                             colModel : [
213                                 {
214                                     xtype: 'ColumnModel',
215                                     xns: Roo.grid,
216                                     header : 'Report name',
217                                     width : 200,
218                                     dataIndex : 'report_name',
219                                     renderer : function(v) { return String.format('{0}', v); }
220                                 },
221                                 {
222                                     xtype: 'ColumnModel',
223                                     xns: Roo.grid,
224                                     header : 'Report descrip',
225                                     width : 200,
226                                     dataIndex : 'report_descrip',
227                                     renderer : function(v) { return String.format('{0}', v); }
228                                 }
229                             ]
230                         }
231                     },
232                     {
233                         xtype: 'GridPanel',
234                         xns: Roo,
235                         listeners : {
236                             activate : function() {
237                                 _this.vpanel = this;
238                                 if (_this.vgrid) {
239                                     _this.vgrid.footer.onClick('first');
240                                 }
241                             }
242                         },
243                         background : false,
244                         fitContainer : true,
245                         fitToframe : true,
246                         region : 'east',
247                         tableName : 'report',
248                         title : "report",
249                         grid : {
250                             xtype: 'Grid',
251                             xns: Roo.grid,
252                             listeners : {
253                                 render : function() 
254                                 {
255                                     _this.vgrid = this; 
256                                     //_this.dialog = Pman.Dialog.FILL_IN
257                                     if (_this.vpanel.active) {
258                                        this.footer.onClick('first');
259                                     }
260                                 },
261                                 rowdblclick : function (_self, rowIndex, e)
262                                 {
263                                     if (!_this.dialog) return;
264                                     _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
265                                         _this.grid.footer.onClick('first');
266                                     }); 
267                                 }
268                             },
269                             autoExpandColumn : 'report_name',
270                             loadMask : true,
271                             dataSource : {
272                                 xtype: 'Store',
273                                 xns: Roo.data,
274                                 listeners : {
275                                     beforeload : function (_self, options)
276                                     {
277                                         if (!_this.grid) {
278                                             return false;
279                                         } 
280                                         var sel  = _this.grid.selModel.getSelected()
281                                         if (!sel) {
282                                             this.removeAll();
283                                             return false;
284                                         }
285                                         options.params.report_name = sel.data.report_name;
286                                         
287                                         
288                                     }
289                                 },
290                                 remoteSort : true,
291                                 sortInfo : { field : 'report_grade', direction: 'DESC' },
292                                 proxy : {
293                                     xtype: 'HttpProxy',
294                                     xns: Roo.data,
295                                     method : 'GET',
296                                     url : baseURL + '/Roo/report.php'
297                                 },
298                                 reader : {
299                                     xtype: 'JsonReader',
300                                     xns: Roo.data,
301                                     totalProperty : 'total',
302                                     root : 'data',
303                                     id : 'id',
304                                     fields : [
305                                         {
306                                             'name': 'report_id',
307                                             'type': 'int'
308                                         },
309                                         {
310                                             'name': 'report_name',
311                                             'type': 'string'
312                                         },
313                                         {
314                                             'name': 'report_sys',
315                                             'type': 'int'
316                                         },
317                                         {
318                                             'name': 'report_source',
319                                             'type': 'string'
320                                         },
321                                         {
322                                             'name': 'report_descrip',
323                                             'type': 'string'
324                                         },
325                                         {
326                                             'name': 'report_grade',
327                                             'type': 'int'
328                                         },
329                                         {
330                                             'name': 'report_loaddate',
331                                             'type': 'date',
332                                             'dateFormat': 'Y-m-d'
333                                         }
334                                     ]
335                                 }
336                             },
337                             footer : {
338                                 xtype: 'PagingToolbar',
339                                 xns: Roo,
340                                 pageSize : 25,
341                                 displayInfo : true,
342                                 displayMsg : "Displaying report{0} - {1} of {2}",
343                                 emptyMsg : "No report found"
344                             },
345                             colModel : [
346                                 {
347                                     xtype: 'ColumnModel',
348                                     xns: Roo.grid,
349                                     header : 'Report grade',
350                                     width : 75,
351                                     dataIndex : 'report_grade',
352                                     renderer : function(v) { return String.format('{0}', v); }
353                                 },
354                                 {
355                                     xtype: 'ColumnModel',
356                                     xns: Roo.grid,
357                                     header : 'Report loaddate',
358                                     width : 75,
359                                     dataIndex : 'report_loaddate',
360                                     renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
361                                 }
362                             ]
363                         }
364                     }
365                 ],
366                 center : {
367                     xtype: 'LayoutRegion',
368                     xns: Roo
369                 },
370                 east : {
371                     xtype: 'LayoutRegion',
372                     xns: Roo,
373                     split : true,
374                     title : "Versions",
375                     titlebar : true,
376                     width : 200
377                 }
378             }
379         };
380     }
381 });