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