Pman.Tab.AdminNotify.bjs
[Pman.Admin] / Pman.Tab.AdminNotify.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Roo.namespace('Pman.Tab');
6
7 Pman.Tab.AdminNotify = new Roo.XComponent({
8
9  _strings : {
10   '136fac3c5c5881e0a7d0039e57decd68' :"Select notify type",
11   'bf1cb7e2a337a5e2ebf614009cbce9cc' :"Current Notifications",
12   '8535bcc0f05358a583bb432bbadf7e0d' :"Select type",
13   'e12167aa0a7698e6ebc92b4ce3909b53' :"To",
14   '478192f02d448c49bc6b7d76818d8483' :"Ontable",
15   'dca4dd744d00b6fe1362ef7825ffdee5' :"No core_notify found",
16   'dc873ea4b71ca217b0d8d1fdd45854ac' :"id#",
17   '0f6d01b16d57911731aa44b94dbfefcc' :"Act when",
18   '7f8c0283f16925caed8e632086b81b9c' :"Sent",
19   'c956c97343a45cca5d492e70c56daa8e' :"Select person",
20   '12832b4def6eb0b6105b3d11e16066ea' :"Msgid",
21   '1243daf593fa297e07ab03bf06d925af' :"Searching...",
22   '24463f10155b8af973300f86302c4fde' :"Who to notify",
23   'b22e7ea679daf5146f08f477419dd8bd' :"Triggered by",
24   '5da618e8e4b89c66fe86e32cdafde142' :"From",
25   'e4b478c05a833569833f9cc63b6c4354' :"Displaying core_notify{0} - {1} of {2}",
26   '4c3880bb027f159e801041b1021e88e8' :"Method",
27   'a4ecfc70574394990cf17bd83df499f7' :"Event",
28   'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
29   'f821027bade4aa6b7a4191cd1676cf41' :"Show Completed"
30  },
31
32   part     :  ["Admin", "Notify" ],
33   order    : '001-Pman.Tab.AdminNotify',
34   region   : 'center',
35   parent   : 'Pman.Tab.AdminWatchNotify',
36   name     : "Pman.Tab.AdminNotify",
37   disabled : false, 
38   permname : '', 
39   _tree : function()
40   {
41    var _this = this;
42    var MODULE = this;
43    return {
44    background : true,
45    fitContainer : true,
46    fitToframe : true,
47    region : 'center',
48    tableName : 'core_notify',
49    title : _this._strings['bf1cb7e2a337a5e2ebf614009cbce9cc'] /* Current Notifications */,
50    xns : Roo,
51    '|xns' : 'Roo',
52    xtype : 'GridPanel',
53    listeners : {
54     activate : function() {
55          _this.panel = this;
56          if (_this.grid) {
57              _this.grid.footer.onClick('first');
58          }
59          
60      }
61    },
62    grid : {
63     autoExpandColumn : 'person_id_name',
64     loadMask : true,
65     xns : Roo.grid,
66     '|xns' : 'Roo.grid',
67     xtype : 'Grid',
68     listeners : {
69      render : function() 
70       {
71           _this.grid = this; 
72           //_this.dialog = Pman.Dialog.FILL_IN
73           if (_this.panel.active) {
74              this.footer.onClick('first');
75           }
76       }
77     },
78     footer : {
79      displayInfo : true,
80      displayMsg : _this._strings['e4b478c05a833569833f9cc63b6c4354'] /* Displaying core_notify{0} - {1} of {2} */,
81      emptyMsg : _this._strings['dca4dd744d00b6fe1362ef7825ffdee5'] /* No core_notify found */,
82      pageSize : 25,
83      xns : Roo,
84      '|xns' : 'Roo',
85      xtype : 'PagingToolbar'
86     },
87     toolbar : {
88      xns : Roo,
89      '|xns' : 'Roo',
90      xtype : 'Toolbar',
91      items  : [
92       {
93        allowBlank : true,
94        displayField : 'person_id_name',
95        editable : true,
96        emptyText : _this._strings['c956c97343a45cca5d492e70c56daa8e'] /* Select person */,
97        forceSelection : true,
98        listWidth : 400,
99        loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
100        minChars : 2,
101        pageSize : 20,
102        qtip : _this._strings['c956c97343a45cca5d492e70c56daa8e'] /* Select person */,
103        queryParam : 'query[person_id_name]',
104        selectOnFocus : true,
105        tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{person_id_name}</b> {person_id_email}</div>',
106        triggerAction : 'all',
107        valueField : 'person_id',
108        width : 200,
109        xns : Roo.form,
110        '|xns' : 'Roo.form',
111        xtype : 'ComboBox',
112        listeners : {
113         render : function (_self)
114          {
115             _this.personCombo = _self;
116          },
117         select : function (combo, record, index)
118          {
119             _this.grid.footer.onClick('first');
120          }
121        },
122        store : {
123         remoteSort : true,
124         sortInfo : { direction : 'ASC', field: 'person_id_name' },
125         xns : Roo.data,
126         '|xns' : 'Roo.data',
127         xtype : 'Store',
128         listeners : {
129          beforeload : function (_self, o){
130               o.params = o.params || {};
131               o.params._distinct='person_id';
132               o.params._columns='person_id,person_id_name,person_id_email';
133               o.params['!person_id_name'] = '';
134               
135               // set more here
136           }
137         },
138         proxy : {
139          method : 'GET',
140          url : baseURL + '/Roo/core_notify.php',
141          xns : Roo.data,
142          '|xns' : 'Roo.data',
143          xtype : 'HttpProxy'
144         },
145         reader : {
146          fields : [{"name":"id","type":"int"},{"name":"ontable","type":"string"}],
147          id : 'id',
148          root : 'data',
149          totalProperty : 'total',
150          xns : Roo.data,
151          '|xns' : 'Roo.data',
152          xtype : 'JsonReader'
153         }
154        }
155       },
156       {
157        xns : Roo.Toolbar,
158        '|xns' : 'Roo.Toolbar',
159        xtype : 'Separator'
160       },
161       {
162        allowBlank : true,
163        displayField : 'display_name',
164        editable : true,
165        emptyText : _this._strings['136fac3c5c5881e0a7d0039e57decd68'] /* Select notify type */,
166        forceSelection : true,
167        listWidth : 400,
168        loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */,
169        minChars : 2,
170        pageSize : 20,
171        qtip : _this._strings['8535bcc0f05358a583bb432bbadf7e0d'] /* Select type */,
172        queryParam : 'query[name]',
173        selectOnFocus : true,
174        tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b></div>',
175        triggerAction : 'all',
176        valueField : 'name',
177        width : 200,
178        xns : Roo.form,
179        '|xns' : 'Roo.form',
180        xtype : 'ComboBox',
181        listeners : {
182         render : function (_self)
183          {
184             _this.typeCombo = _self;
185          },
186         select : function (combo, record, index)
187          {
188             _this.grid.footer.onClick('first');
189          }
190        },
191        store : {
192         remoteSort : true,
193         sortInfo : { direction : 'ASC', field: 'id' },
194         xns : Roo.data,
195         '|xns' : 'Roo.data',
196         xtype : 'Store',
197         listeners : {
198          beforeload : function (_self, o){
199               o.params = o.params || {};
200               o.params.etype = 'Core.NotifyType';
201               o.params.active = 1;
202           }
203         },
204         proxy : {
205          method : 'GET',
206          url : baseURL + '/Roo/core_enum.php',
207          xns : Roo.data,
208          '|xns' : 'Roo.data',
209          xtype : 'HttpProxy'
210         },
211         reader : {
212          fields : [{"name":"name","type":"string"},{"name":"display_name","type":"string"}],
213          id : 'id',
214          root : 'data',
215          totalProperty : 'total',
216          xns : Roo.data,
217          '|xns' : 'Roo.data',
218          xtype : 'JsonReader'
219         }
220        }
221       },
222       {
223        xns : Roo.Toolbar,
224        '|xns' : 'Roo.Toolbar',
225        xtype : 'Separator'
226       },
227       {
228        text : _this._strings['5da618e8e4b89c66fe86e32cdafde142'] /* From */,
229        xns : Roo.Toolbar,
230        '|xns' : 'Roo.Toolbar',
231        xtype : 'TextItem'
232       },
233       {
234        format : 'd/M/Y',
235        width : 100,
236        xns : Roo.form,
237        '|xns' : 'Roo.form',
238        xtype : 'DateField',
239        listeners : {
240         render : function (_self)\r
241          {\r
242              _this.fromDateSel = _self;\r
243             //_self.setValue(  new Date() );\r
244          },
245         select : function (combo, date)
246          {
247              _this.grid.footer.onClick('first');
248          }
249        }
250       },
251       {
252        xns : Roo.Toolbar,
253        '|xns' : 'Roo.Toolbar',
254        xtype : 'Separator'
255       },
256       {
257        text : _this._strings['e12167aa0a7698e6ebc92b4ce3909b53'] /* To */,
258        xns : Roo.Toolbar,
259        '|xns' : 'Roo.Toolbar',
260        xtype : 'TextItem'
261       },
262       {
263        format : 'd/M/Y',
264        width : 100,
265        xns : Roo.form,
266        '|xns' : 'Roo.form',
267        xtype : 'DateField',
268        listeners : {
269         render : function (_self)\r
270          {\r
271              _this.toDateSel = _self;\r
272             //_self.setValue(  new Date() );\r
273          },
274         select : function (combo, date)
275          {
276              _this.grid.footer.onClick('first');
277          }
278        }
279       },
280       {
281        xns : Roo.Toolbar,
282        '|xns' : 'Roo.Toolbar',
283        xtype : 'Fill'
284       },
285       {
286        cls : 'x-btn-text-icon',
287        icon : rootURL + '/Pman/templates/images/trash.gif',
288        text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
289        xns : Roo.Toolbar,
290        '|xns' : 'Roo.Toolbar',
291        xtype : 'Button',
292        listeners : {
293         click : function()
294          {
295              Pman.genericDelete(_this, 'core_notify'); 
296          }
297        }
298       },
299       {
300        enableToggle : true,
301        text : _this._strings['f821027bade4aa6b7a4191cd1676cf41'] /* Show Completed */,
302        xns : Roo.Toolbar,
303        '|xns' : 'Roo.Toolbar',
304        xtype : 'Button',
305        listeners : {
306         render : function (_self)
307          {
308              _this.toggleBtn = _self;
309          },
310         toggle : function (_self, pressed)
311          {
312              this.setText(pressed ? "Hide Completed" : "Show Completed");
313              _this.grid.footer.onClick('first');
314          }
315        }
316       }
317      ]
318     },
319     dataSource : {
320      remoteSort : true,
321      sortInfo : { field : 'act_when', direction: 'DESC' },
322      xns : Roo.data,
323      '|xns' : 'Roo.data',
324      xtype : 'Store',
325      listeners : {
326       beforeload : function (_self, options)
327        {
328            options.params = options.params || {};
329            
330            options.params._evtype_align = 1;
331            
332            if (!_this.toggleBtn.pressed) {
333                options.params['event_id'] = 0;
334            }
335            if (!_this.personCombo) {
336                return false;
337            }
338            var p = _this.personCombo.getValue();
339            if (p*1) { 
340                options.params.person_id = p;
341            }
342            
343            var from = _this.fromDateSel.getValue();
344            
345            if(from){
346                options.params.from = from.format('Y-m-d');
347            }
348            
349            var to = _this.toDateSel.getValue();
350            
351            if(to){
352                options.params.to = to.format('Y-m-d');
353            }
354            
355            var type = _this.typeCombo.getValue();
356            
357            if(type.length){
358                options.params.evtype = type;
359            }
360        }
361      },
362      proxy : {
363       method : 'GET',
364       url : baseURL + '/Roo/core_notify.php',
365       xns : Roo.data,
366       '|xns' : 'Roo.data',
367       xtype : 'HttpProxy'
368      },
369      reader : {
370       fields : [
371           {
372               'name': 'id',
373               'type': 'int'
374           },
375           {
376               'name': 'act_when',
377               'type': 'date',
378               'dateFormat': 'Y-m-d'
379           },
380           {
381               'name': 'onid',
382               'type': 'int'
383           },
384           {
385               'name': 'ontable',
386               'type': 'string'
387           },
388           {
389               'name': 'person_id',
390               'type': 'int'
391           },
392           {
393               'name': 'msgid',
394               'type': 'string'
395           },
396           {
397               'name': 'sent',
398               'type': 'date',
399               'dateFormat': 'Y-m-d'
400           },
401           {
402               'name': 'event_id',
403               'type': 'int'
404           },
405           {
406               'name': 'person_id_id',
407               'type': 'int'
408           },
409           {
410               'name': 'person_id_office_id',
411               'type': 'int'
412           },
413           {
414               'name': 'person_id_name',
415               'type': 'string'
416           },
417           {
418               'name': 'person_id_phone',
419               'type': 'string'
420           },
421           {
422               'name': 'person_id_fax',
423               'type': 'string'
424           },
425           {
426               'name': 'person_id_email',
427               'type': 'string'
428           },
429           {
430               'name': 'person_id_company_id',
431               'type': 'int'
432           },
433           {
434               'name': 'person_id_role',
435               'type': 'string'
436           },
437           {
438               'name': 'person_id_active',
439               'type': 'int'
440           },
441           {
442               'name': 'person_id_remarks',
443               'type': 'string'
444           },
445           {
446               'name': 'person_id_passwd',
447               'type': 'string'
448           },
449           {
450               'name': 'person_id_owner_id',
451               'type': 'int'
452           },
453           {
454               'name': 'person_id_lang',
455               'type': 'string'
456           },
457           {
458               'name': 'person_id_no_reset_sent',
459               'type': 'int'
460           },
461           {
462               'name': 'person_id_action_type',
463               'type': 'string'
464           },
465           {
466               'name': 'person_id_project_id',
467               'type': 'int'
468           },
469           {
470               'name': 'person_id_deleted_by',
471               'type': 'int'
472           },
473           {
474               'name': 'person_id_deleted_dt',
475               'type': 'date'
476           },
477           {
478               'name': 'event_id_id',
479               'type': 'int'
480           },
481           {
482               'name': 'event_id_person_name',
483               'type': 'string'
484           },
485           {
486               'name': 'event_id_event_when',
487               'type': 'date'
488           },
489           {
490               'name': 'event_id_action',
491               'type': 'string'
492           },
493           {
494               'name': 'event_id_ipaddr',
495               'type': 'string'
496           },
497           {
498               'name': 'event_id_on_id',
499               'type': 'int'
500           },
501           {
502               'name': 'event_id_on_table',
503               'type': 'string'
504           },
505           {
506               'name': 'event_id_person_id',
507               'type': 'int'
508           },
509           {
510               'name': 'event_id_remarks',
511               'type': 'string'
512           }
513       ],
514       id : 'id',
515       root : 'data',
516       totalProperty : 'total',
517       xns : Roo.data,
518       '|xns' : 'Roo.data',
519       xtype : 'JsonReader'
520      }
521     },
522     colModel : [
523      {
524       dataIndex : 'id',
525       header : _this._strings['dc873ea4b71ca217b0d8d1fdd45854ac'] /* id# */,
526       renderer : function(v) { return String.format('{0}', v ); },
527       sortable : true,
528       width : 50,
529       xns : Roo.grid,
530       '|xns' : 'Roo.grid',
531       xtype : 'ColumnModel'
532      },
533      {
534       dataIndex : 'evtype',
535       header : _this._strings['4c3880bb027f159e801041b1021e88e8'] /* Method */,
536       renderer : function(v,x,r) 
537       { 
538           var vv = (typeof(r.data.evtype_align) != 'undefined' && r.data.evtype_align) ? r.data.evtype_align : v;
539           return String.format('<span qtip="{0}">{1}</span>', v, vv ); 
540       },
541       sortable : true,
542       width : 100,
543       xns : Roo.grid,
544       '|xns' : 'Roo.grid',
545       xtype : 'ColumnModel'
546      },
547      {
548       dataIndex : 'act_when',
549       header : _this._strings['0f6d01b16d57911731aa44b94dbfefcc'] /* Act when */,
550       renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); },
551       sortable : true,
552       width : 150,
553       xns : Roo.grid,
554       '|xns' : 'Roo.grid',
555       xtype : 'ColumnModel'
556      },
557      {
558       dataIndex : 'sent',
559       header : _this._strings['7f8c0283f16925caed8e632086b81b9c'] /* Sent */,
560       renderer : function(v,x,r) {
561           if (r.data.event_id *1 == 0) {
562               return '';
563           }
564            return String.format('{0}', v ? v.format('d/M/Y H:i:s') : '');
565         },
566       sortable : true,
567       width : 150,
568       xns : Roo.grid,
569       '|xns' : 'Roo.grid',
570       xtype : 'ColumnModel'
571      },
572      {
573       dataIndex : 'ontable',
574       header : _this._strings['478192f02d448c49bc6b7d76818d8483'] /* Ontable */,
575       renderer : function(v,x,r) { return String.format('{0}:{1}', v,r.data.onid); },
576       width : 150,
577       xns : Roo.grid,
578       '|xns' : 'Roo.grid',
579       xtype : 'ColumnModel'
580      },
581      {
582       dataIndex : 'person_id_name',
583       header : _this._strings['24463f10155b8af973300f86302c4fde'] /* Who to notify */,
584       renderer : function(v,x,r) {
585       
586       
587            var ecol = r.data.person_table.toLowerCase() + '_id_email' ;
588            var ncol = r.data.person_table.toLowerCase() + '_id_name' ;
589            return String.format('{0} <u>&lt;{1}&gt;</u>', r.data[ncol], r.data[ecol]); 
590        },
591       width : 100,
592       xns : Roo.grid,
593       '|xns' : 'Roo.grid',
594       xtype : 'ColumnModel'
595      },
596      {
597       dataIndex : 'trigger_event_id',
598       header : _this._strings['b22e7ea679daf5146f08f477419dd8bd'] /* Triggered by */,
599       renderer : function(v,x,r) {
600            return String.format(
601                   '{0} : {1} {2}', 
602                   r.data.trigger_event_id_on_table, 
603                   r.data.trigger_event_id_on_id, 
604                   r.data.trigger_event_id_remarks
605               ); 
606        },
607       width : 100,
608       xns : Roo.grid,
609       '|xns' : 'Roo.grid',
610       xtype : 'ColumnModel'
611      },
612      {
613       dataIndex : 'msgid',
614       header : _this._strings['12832b4def6eb0b6105b3d11e16066ea'] /* Msgid */,
615       renderer : function(v) { return String.format('{0}', v); },
616       width : 200,
617       xns : Roo.grid,
618       '|xns' : 'Roo.grid',
619       xtype : 'ColumnModel'
620      },
621      {
622       dataIndex : 'event_id_remarks',
623       header : _this._strings['a4ecfc70574394990cf17bd83df499f7'] /* Event */,
624       renderer : function(v) { return String.format('<span qtip="{0}">{0}</span>', v); },
625       width : 300,
626       xns : Roo.grid,
627       '|xns' : 'Roo.grid',
628       xtype : 'ColumnModel'
629      }
630     ]
631    }
632   };  }
633 });