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