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