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