Pman.Tab.AdminWatches.bjs
[Pman.Admin] / Pman.Tab.AdminWatches.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5
6
7 // register the module first
8 Pman.on('beforeload', function()
9 {
10     Pman.register({
11         modKey : '860-Pman.Tab.AdminWatches',
12         module : Pman.Tab.AdminWatches,
13         region : 'center',
14         parent : Pman.Tab.Admin,
15         name : "Pman.Tab.AdminWatches",
16         disabled : false, 
17         permname: '' 
18     });
19 });
20
21 Pman.Tab.AdminWatches = new Roo.util.Observable({
22
23     panel : false,
24     disabled : false,
25     parentLayout:  false,
26
27     add : function(parentLayout, region)
28     {
29
30         var _this = this;
31         this.parentLayout = parentLayout;
32
33         this.panel = parentLayout.addxtype({
34             xtype: 'GridPanel',
35             xns: Roo,
36             title : "core_watch",
37             fitToframe : true,
38             fitContainer : true,
39             tableName : 'core_watch',
40             background : true,
41             region : 'center',
42             listeners : {
43                 activate : function() {
44                     _this.panel = this;
45                     if (_this.grid) {
46                         _this.grid.footer.onClick('first');
47                     }
48                 }
49             },
50             grid : {
51                 xtype: 'Grid',
52                 xns: Roo.grid,
53                 autoExpandColumn : 'ontable',
54                 loadMask : true,
55                 listeners : {
56                     render : function() 
57                     {
58                         _this.grid = this; 
59                         //_this.dialog = Pman.Dialog.FILL_IN
60                         if (_this.panel.active) {
61                            this.footer.onClick('first');
62                         }
63                     },
64                     rowdblclick : function (_self, rowIndex, e)
65                     {
66                         if (!_this.dialog) return;
67                         _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
68                             _this.grid.footer.onClick('first');
69                         }); 
70                     }
71                 },
72                 dataSource : {
73                     xtype: 'Store',
74                     xns: Roo.data,
75                     remoteSort : true,
76                     sortInfo : { field : 'ontable', direction: 'ASC' },
77                     proxy : {
78                         xtype: 'HttpProxy',
79                         xns: Roo.data,
80                         method : 'GET',
81                         url : baseURL + '/Roo/core_watch.php'
82                     },
83                     reader : {
84                         xtype: 'JsonReader',
85                         xns: Roo.data,
86                         totalProperty : 'total',
87                         root : 'data',
88                         id : 'id',
89                         fields : [
90                             {
91                                 'name': 'id',
92                                 'type': 'int'
93                             },
94                             {
95                                 'name': 'ontable',
96                                 'type': 'string'
97                             },
98                             {
99                                 'name': 'onid',
100                                 'type': 'int'
101                             },
102                             {
103                                 'name': 'person_id',
104                                 'type': 'int'
105                             },
106                             {
107                                 'name': 'event',
108                                 'type': 'string'
109                             },
110                             {
111                                 'name': 'medium',
112                                 'type': 'string'
113                             },
114                             {
115                                 'name': 'active',
116                                 'type': 'int'
117                             },
118                             {
119                                 'name': 'person_id_id',
120                                 'type': 'int'
121                             },
122                             {
123                                 'name': 'person_id_office_id',
124                                 'type': 'int'
125                             },
126                             {
127                                 'name': 'person_id_name',
128                                 'type': 'string'
129                             },
130                             {
131                                 'name': 'person_id_phone',
132                                 'type': 'string'
133                             },
134                             {
135                                 'name': 'person_id_fax',
136                                 'type': 'string'
137                             },
138                             {
139                                 'name': 'person_id_email',
140                                 'type': 'string'
141                             },
142                             {
143                                 'name': 'person_id_company_id',
144                                 'type': 'int'
145                             },
146                             {
147                                 'name': 'person_id_role',
148                                 'type': 'string'
149                             },
150                             {
151                                 'name': 'person_id_active',
152                                 'type': 'int'
153                             },
154                             {
155                                 'name': 'person_id_remarks',
156                                 'type': 'string'
157                             },
158                             {
159                                 'name': 'person_id_passwd',
160                                 'type': 'string'
161                             },
162                             {
163                                 'name': 'person_id_owner_id',
164                                 'type': 'int'
165                             },
166                             {
167                                 'name': 'person_id_lang',
168                                 'type': 'string'
169                             },
170                             {
171                                 'name': 'person_id_no_reset_sent',
172                                 'type': 'int'
173                             },
174                             {
175                                 'name': 'person_id_action_type',
176                                 'type': 'string'
177                             },
178                             {
179                                 'name': 'person_id_project_id',
180                                 'type': 'int'
181                             },
182                             {
183                                 'name': 'person_id_deleted_by',
184                                 'type': 'int'
185                             },
186                             {
187                                 'name': 'person_id_deleted_dt',
188                                 'type': 'date'
189                             }
190                         ]
191                     }
192                 },
193                 footer : {
194                     xtype: 'PagingToolbar',
195                     xns: Roo,
196                     pageSize : 25,
197                     displayInfo : true,
198                     displayMsg : "Displaying core_watch{0} - {1} of {2}",
199                     emptyMsg : "No core_watch found"
200                 },
201                 toolbar : {
202                     xtype: 'Toolbar',
203                     xns: Roo,
204                     items : [
205                         {
206                             xtype: 'Button',
207                             xns: Roo.Toolbar,
208                             text : "Add",
209                             cls : 'x-btn-text-icon',
210                             icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
211                             listeners : {
212                                 click : function()
213                                 {
214                                     if (!_this.dialog) return;
215                                     _this.dialog.show( { id : 0 } , function() {
216                                         _this.grid.footer.onClick('first');
217                                    }); 
218                                 }
219                             }
220                         },
221                         {
222                             xtype: 'Button',
223                             xns: Roo.Toolbar,
224                             text : "Edit",
225                             cls : 'x-btn-text-icon',
226                             icon : Roo.rootURL + 'images/default/tree/leaf.gif',
227                             listeners : {
228                                 click : function()
229                                 {
230                                     var s = _this.grid.getSelectionModel().getSelections();
231                                     if (!s.length || (s.length > 1))  {
232                                         Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
233                                         return;
234                                     }
235                                     if (!_this.dialog) return;
236                                     _this.dialog.show(s[0].data, function() {
237                                         _this.grid.footer.onClick('first');
238                                     }); 
239                                     
240                                 }
241                             }
242                         },
243                         {
244                             xtype: 'Button',
245                             xns: Roo.Toolbar,
246                             text : "Delete",
247                             cls : 'x-btn-text-icon',
248                             icon : rootURL + '/Pman/templates/images/trash.gif',
249                             listeners : {
250                                 click : function()
251                                 {
252                                      Pman.genericDelete(_this, 'core_watch'); 
253                                 }
254                             }
255                         }
256                     ]
257                 },
258                 colModel : [
259                     {
260                         xtype: 'ColumnModel',
261                         xns: Roo.grid,
262                         header : 'Ontable',
263                         width : 200,
264                         dataIndex : 'ontable',
265                         renderer : function(v) { return String.format('{0}', v); }
266                     },
267                     {
268                         xtype: 'ColumnModel',
269                         xns: Roo.grid,
270                         header : 'Onid',
271                         width : 75,
272                         dataIndex : 'onid',
273                         renderer : function(v) { return String.format('{0}', v); }
274                     },
275                     {
276                         xtype: 'ColumnModel',
277                         xns: Roo.grid,
278                         header : 'Person',
279                         width : 75,
280                         dataIndex : 'person_id',
281                         renderer : function(v) { return String.format('{0}', v); }
282                     },
283                     {
284                         xtype: 'ColumnModel',
285                         xns: Roo.grid,
286                         header : 'Event',
287                         width : 200,
288                         dataIndex : 'event',
289                         renderer : function(v) { return String.format('{0}', v); }
290                     },
291                     {
292                         xtype: 'ColumnModel',
293                         xns: Roo.grid,
294                         header : 'Medium',
295                         width : 200,
296                         dataIndex : 'medium',
297                         renderer : function(v) { return String.format('{0}', v); }
298                     },
299                     {
300                         xtype: 'ColumnModel',
301                         xns: Roo.grid,
302                         header : 'Active',
303                         width : 75,
304                         dataIndex : 'active',
305                         renderer : function(v) { return String.format('{0}', v); }
306                     }
307                 ]
308             }
309         });
310         this.layout = this.panel.layout;
311
312     }
313 });