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 Pman.Tab.AdminWatches = new Roo.XComponent({
6     part     :  ["Admin","Watches"],
7     order    : '860-Pman.Tab.AdminWatches',
8     region   : 'center',
9     parent   : 'Pman.Tab.AdminWatchNotify',
10     name     : "Pman.Tab.AdminWatches",
11     disabled : false, 
12     permname : '', 
13     _tree : function()
14     {
15         var _this = this;
16         var MODULE = this;
17         return {
18             xtype: 'GridPanel',
19             xns: Roo,
20             listeners : {
21                 activate : function() {
22                     _this.panel = this;
23                     if (_this.grid) {
24                         _this.grid.footer.onClick('first');
25                     }
26                 }
27             },
28             autoScroll : false,
29             background : true,
30             fitContainer : true,
31             fitToframe : true,
32             region : 'center',
33             tableName : 'core_watch',
34             title : "Watches",
35             grid : {
36                 xtype: 'Grid',
37                 xns: Roo.grid,
38                 listeners : {
39                     render : function() 
40                     {
41                         _this.grid = this; 
42                         _this.dialog = Pman.Dialog.AdminWatch;
43                         if (_this.panel.active) {
44                            this.footer.onClick('first');
45                         }
46                     },
47                     rowdblclick : function (_self, rowIndex, e)
48                     {
49                         if (!_this.dialog) return;
50                         _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
51                             _this.grid.footer.onClick('first');
52                         }); 
53                     }
54                 },
55                 autoExpandColumn : 'person_id_name',
56                 loadMask : true,
57                 dataSource : {
58                     xtype: 'Store',
59                     xns: Roo.data,
60                     listeners : {
61                         beforeload : function (_self, options)
62                         {
63                                 var val = _this.affectSel.getValue();
64                                 if (val.length) {
65                                     options.params.ontable = val;
66                                 }
67                                 
68                         }
69                     },
70                     remoteSort : true,
71                     sortInfo : { field : 'ontable', direction: 'ASC' },
72                     proxy : {
73                         xtype: 'HttpProxy',
74                         xns: Roo.data,
75                         method : 'GET',
76                         url : baseURL + '/Roo/core_watch.php'
77                     },
78                     reader : {
79                         xtype: 'JsonReader',
80                         xns: Roo.data,
81                         totalProperty : 'total',
82                         root : 'data',
83                         id : 'id',
84                         fields : [
85                             {
86                                 'name': 'id',
87                                 'type': 'int'
88                             },
89                             {
90                                 'name': 'ontable',
91                                 'type': 'string'
92                             },
93                             {
94                                 'name': 'onid',
95                                 'type': 'int'
96                             },
97                             {
98                                 'name': 'person_id',
99                                 'type': 'int'
100                             },
101                             {
102                                 'name': 'event',
103                                 'type': 'string'
104                             },
105                             {
106                                 'name': 'medium',
107                                 'type': 'string'
108                             },
109                             {
110                                 'name': 'active',
111                                 'type': 'int'
112                             },
113                             {
114                                 'name': 'person_id_id',
115                                 'type': 'int'
116                             },
117                             {
118                                 'name': 'person_id_office_id',
119                                 'type': 'int'
120                             },
121                             {
122                                 'name': 'person_id_name',
123                                 'type': 'string'
124                             },
125                             {
126                                 'name': 'person_id_phone',
127                                 'type': 'string'
128                             },
129                             {
130                                 'name': 'person_id_fax',
131                                 'type': 'string'
132                             },
133                             {
134                                 'name': 'person_id_email',
135                                 'type': 'string'
136                             },
137                             {
138                                 'name': 'person_id_company_id',
139                                 'type': 'int'
140                             },
141                             {
142                                 'name': 'person_id_role',
143                                 'type': 'string'
144                             },
145                             {
146                                 'name': 'person_id_active',
147                                 'type': 'int'
148                             },
149                             {
150                                 'name': 'person_id_remarks',
151                                 'type': 'string'
152                             },
153                             {
154                                 'name': 'person_id_passwd',
155                                 'type': 'string'
156                             },
157                             {
158                                 'name': 'person_id_owner_id',
159                                 'type': 'int'
160                             },
161                             {
162                                 'name': 'person_id_lang',
163                                 'type': 'string'
164                             },
165                             {
166                                 'name': 'person_id_no_reset_sent',
167                                 'type': 'int'
168                             },
169                             {
170                                 'name': 'person_id_action_type',
171                                 'type': 'string'
172                             },
173                             {
174                                 'name': 'person_id_project_id',
175                                 'type': 'int'
176                             },
177                             {
178                                 'name': 'person_id_deleted_by',
179                                 'type': 'int'
180                             },
181                             {
182                                 'name': 'person_id_deleted_dt',
183                                 'type': 'date'
184                             }
185                         ]
186                     }
187                 },
188                 footer : {
189                     xtype: 'PagingToolbar',
190                     xns: Roo,
191                     pageSize : 25,
192                     displayInfo : true,
193                     displayMsg : "Displaying core_watch{0} - {1} of {2}",
194                     emptyMsg : "No core_watch found"
195                 },
196                 toolbar : {
197                     xtype: 'Toolbar',
198                     xns: Roo,
199                     items : [
200                         {
201                             xtype: 'TextItem',
202                             xns: Roo.Toolbar,
203                             text : "Show"
204                         },
205                         {
206                             xtype: 'ComboBox',
207                             xns: Roo.form,
208                             listeners : {
209                                 select : function (combo, record, index)
210                                 {
211                                   _this.grid.footer.onClick('first');
212                                 },
213                                 render : function (_self)
214                                 {
215                                   _this.affectSel = _self;
216                                 }
217                             },
218                             allowBlank : true,
219                             displayField : 'on_table',
220                             editable : false,
221                             emptyText : "Select Table",
222                             forceSelection : true,
223                             listWidth : 300,
224                             loadingText : "Searching...",
225                             minChars : 2,
226                             name : 'ontable',
227                             pageSize : 20,
228                             qtip : "Select Action",
229                             queryParam : 'query[ontable]',
230                             selectOnFocus : true,
231                             tpl : '<div class="x-grid-cell-text x-btn button"><b>{on_table}</b> </div>',
232                             triggerAction : 'all',
233                             typeAhead : true,
234                             valueField : 'on_table',
235                             width : 150,
236                             store : {
237                                 xtype: 'Store',
238                                 xns: Roo.data,
239                                 listeners : {
240                                     beforeload : function (_self, o)
241                                     {
242                                         o.params = o.params || {};
243                                         // staff can see all logs, other companies can only see their own.
244                                         if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
245                                             o.params.company_id = Pman.Login.authUser.company_id;
246                                         }
247                                         o.params._distinct = 'on_table';
248                                         o.params._columns ='on_table';
249                                     }
250                                 },
251                                 remoteSort : true,
252                                 sortInfo : { field : 'on_table' , direction : 'ASC' },
253                                 proxy : {
254                                     xtype: 'HttpProxy',
255                                     xns: Roo.data,
256                                     method : 'GET',
257                                     url : baseURL + '/Roo/Events.php'
258                                 },
259                                 reader : {
260                                     xtype: 'JsonReader',
261                                     xns: Roo.data,
262                                     id : 'id',
263                                     root : 'data',
264                                     totalProperty : 'total',
265                                     fields : [
266                                         {
267                                             'name': 'id',
268                                             'type': 'int'
269                                         },
270                                         {
271                                             'name': 'on_table',
272                                             'type': 'string'
273                                         }
274                                          
275                                     ]
276                                 }
277                             }
278                         },
279                         {
280                             xtype: 'Fill',
281                             xns: Roo.Toolbar
282                         },
283                         {
284                             xtype: 'Button',
285                             xns: Roo.Toolbar,
286                             text : "Add",
287                             cls : 'x-btn-text-icon',
288                             icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
289                             listeners : {
290                                 click : function()
291                                 {
292                                     if (!_this.dialog) return;
293                                     _this.dialog.show( { id : 0 } , function() {
294                                         _this.grid.footer.onClick('first');
295                                    }); 
296                                 }
297                             }
298                         },
299                         {
300                             xtype: 'Button',
301                             xns: Roo.Toolbar,
302                             text : "Delete",
303                             cls : 'x-btn-text-icon',
304                             icon : rootURL + '/Pman/templates/images/trash.gif',
305                             listeners : {
306                                 click : function()
307                                 {
308                                      Pman.genericDelete(_this, 'core_watch'); 
309                                 }
310                             }
311                         }
312                     ]
313                 },
314                 colModel : [
315                     {
316                         xtype: 'ColumnModel',
317                         xns: Roo.grid,
318                         dataIndex : 'event',
319                         header : 'Watch Event',
320                         width : 100,
321                         renderer : function(v) { return String.format('{0}', v); }
322                     },
323                     {
324                         xtype: 'ColumnModel',
325                         xns: Roo.grid,
326                         dataIndex : 'ontable',
327                         header : 'Watch Table',
328                         width : 150,
329                         renderer : function(v) { return String.format('{0}', v); }
330                     },
331                     {
332                         xtype: 'ColumnModel',
333                         xns: Roo.grid,
334                         dataIndex : 'onid',
335                         header : 'Watch ID',
336                         width : 75,
337                         renderer : function(v) { return String.format('{0}', v); }
338                     },
339                     {
340                         xtype: 'ColumnModel',
341                         xns: Roo.grid,
342                         dataIndex : 'person_id_name',
343                         header : 'Who get\'s notified',
344                         width : 150,
345                         renderer : function(v) { return String.format('{0}', v); }
346                     },
347                     {
348                         xtype: 'ColumnModel',
349                         xns: Roo.grid,
350                         dataIndex : 'medium',
351                         header : 'What happens',
352                         width : 200,
353                         renderer : function(v) { return String.format('{0}', v); }
354                     },
355                     {
356                         xtype: 'ColumnModel',
357                         xns: Roo.grid,
358                         header : 'Active',
359                         width : 75,
360                         dataIndex : 'active',
361                         renderer : function(v) { return String.format('{0}', v); }
362                     }
363                 ]
364             }
365         };
366     }
367 });