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