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