Pman.Tab.AdminNotify.bjs
[Pman.Admin] / Pman.Tab.AdminNotify.js
index 70814d5..9360340 100644 (file)
@@ -186,6 +186,10 @@ Pman.Tab.AdminNotify = new Roo.XComponent({
                     listeners : {
                        beforeload : function (_self, options)
                           {
+                              options.params = options.params || {};
+                              
+                              options.params._evtype_align = 1;
+                              
                               if (!_this.toggleBtn.pressed) {
                                   options.params['event_id'] = 0;
                               }
@@ -197,6 +201,17 @@ Pman.Tab.AdminNotify = new Roo.XComponent({
                                   options.params.person_id = p;
                               }
                               
+                              var from = _this.fromDateSel.getValue();
+                              
+                              if(from){
+                                  options.params.from = from.format('Y-m-d');
+                              }
+                              
+                              var to = _this.toDateSel.getValue();
+                              
+                              if(to){
+                                  options.params.to = to.format('Y-m-d');
+                              }
                           }
                     },
                     items : [
@@ -264,16 +279,14 @@ Pman.Tab.AdminNotify = new Roo.XComponent({
                             pageSize : 20,
                             displayField : 'person_id_name',
                             emptyText : "Select person",
-                            hiddenName : 'id',
                             minChars : 2,
                             valueField : 'person_id',
                             xtype : 'ComboBox',
                             allowBlank : true,
                             editable : true,
-                            width : 300,
+                            width : 200,
                             xns : Roo.form,
-                            name : 'name',
-                            qtip : "Select core_notify",
+                            qtip : "Select person",
                             queryParam : 'query[person_id_name]',
                             tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{person_id_name}</b> {person_id_email}</div>',
                             loadingText : "Searching...",
@@ -292,6 +305,142 @@ Pman.Tab.AdminNotify = new Roo.XComponent({
                             ]
 
                         },
+                       {
+                            '|xns' : 'Roo.Toolbar',
+                            xtype : 'Separator',
+                            xns : Roo.Toolbar
+                        },
+                       {
+                            store : {
+                                proxy : {
+                                    '|xns' : 'Roo.data',
+                                    url : baseURL + '/Roo/core_notify.php',
+                                    xtype : 'HttpProxy',
+                                    method : 'GET',
+                                    xns : Roo.data
+                                },
+                                reader : {
+                                    '|xns' : 'Roo.data',
+                                    id : 'id',
+                                    root : 'data',
+                                    xtype : 'JsonReader',
+                                    xns : Roo.data,
+                                    fields : [{"name":"id","type":"int"},{"name":"ontable","type":"string"}],
+                                    totalProperty : 'total'
+                                },
+                                '|xns' : 'Roo.data',
+                                xtype : 'Store',
+                                remoteSort : true,
+                                sortInfo : { direction : 'ASC', field: 'person_id_name' },
+                                xns : Roo.data,
+                                listeners : {
+                                       beforeload : function (_self, o){
+                                              o.params = o.params || {};
+                                              o.params._distinct='person_id';
+                                              o.params._columns='person_id,person_id_name,person_id_email';
+                                              o.params['!person_id_name'] = '';
+                                              
+                                              // set more here
+                                          }
+                                },
+                                items : [
+
+                                ]
+
+                            },
+                            '|xns' : 'Roo.form',
+                            listWidth : 400,
+                            triggerAction : 'all',
+                            forceSelection : true,
+                            selectOnFocus : true,
+                            pageSize : 20,
+                            displayField : 'display_name',
+                            emptyText : "Select notify type",
+                            minChars : 2,
+                            valueField : 'name',
+                            xtype : 'ComboBox',
+                            allowBlank : true,
+                            editable : true,
+                            width : 200,
+                            xns : Roo.form,
+                            name : 'name',
+                            qtip : "Select type",
+                            queryParam : 'query[name]',
+                            tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b></div>',
+                            loadingText : "Searching...",
+                            listeners : {
+                               render : function (_self)
+                                  {
+                                     _this.evtypeCombo = _self;
+                                  },
+                               select : function (combo, record, index)
+                                  {
+                                     _this.grid.footer.onClick('first');
+                                  }
+                            },
+                            items : [
+
+                            ]
+
+                        },
+                       {
+                            '|xns' : 'Roo.Toolbar',
+                            xtype : 'Separator',
+                            xns : Roo.Toolbar
+                        },
+                       {
+                            '|xns' : 'Roo.Toolbar',
+                            text : "From",
+                            xtype : 'TextItem',
+                            xns : Roo.Toolbar
+                        },
+                       {
+                            '|xns' : 'Roo.form',
+                            format : 'd/M/Y',
+                            xtype : 'DateField',
+                            width : 100,
+                            xns : Roo.form,
+                            listeners : {
+                               render : function (_self)\r
+                                  {\r
+                                      _this.fromDateSel = _self;\r
+                                     //_self.setValue(  new Date() );\r
+                                  },
+                               select : function (combo, date)
+                                  {
+                                      _this.grid.footer.onClick('first');
+                                  }
+                            }
+                        },
+                       {
+                            '|xns' : 'Roo.Toolbar',
+                            xtype : 'Separator',
+                            xns : Roo.Toolbar
+                        },
+                       {
+                            '|xns' : 'Roo.Toolbar',
+                            text : "To",
+                            xtype : 'TextItem',
+                            xns : Roo.Toolbar
+                        },
+                       {
+                            '|xns' : 'Roo.form',
+                            format : 'd/M/Y',
+                            xtype : 'DateField',
+                            width : 100,
+                            xns : Roo.form,
+                            listeners : {
+                               render : function (_self)\r
+                                  {\r
+                                      _this.toDateSel = _self;\r
+                                     //_self.setValue(  new Date() );\r
+                                  },
+                               select : function (combo, date)
+                                  {
+                                      _this.grid.footer.onClick('first');
+                                  }
+                            }
+                        },
                        {
                             '|xns' : 'Roo.Toolbar',
                             xtype : 'Fill',
@@ -353,8 +502,12 @@ Pman.Tab.AdminNotify = new Roo.XComponent({
                                xtype : 'ColumnModel',
                                sortable : true,
                                header : 'Method',
-                               width : 100,
-                               renderer : function(v) { return String.format('{0}', v ); },
+                               width : 200,
+                               renderer : function(v,x,r) 
+                               { 
+                                   var vv = (typeof(r.data.evtype_align) != 'undefined' && r.data.evtype_align) ? r.data.evtype_align : v;
+                                   return String.format('<span qtip="{0}">{1}</span>', v, vv ); 
+                               },
                                xns : Roo.grid,
                                dataIndex : 'evtype'
                            },
@@ -363,7 +516,7 @@ Pman.Tab.AdminNotify = new Roo.XComponent({
                                xtype : 'ColumnModel',
                                sortable : true,
                                header : 'Act when',
-                               width : 100,
+                               width : 150,
                                renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); },
                                xns : Roo.grid,
                                dataIndex : 'act_when'
@@ -373,7 +526,7 @@ Pman.Tab.AdminNotify = new Roo.XComponent({
                                xtype : 'ColumnModel',
                                sortable : true,
                                header : 'Sent',
-                               width : 100,
+                               width : 150,
                                renderer : function(v,x,r) {
                                    if (r.data.event_id *1 == 0) {
                                        return '';
@@ -387,7 +540,7 @@ Pman.Tab.AdminNotify = new Roo.XComponent({
                                '|xns' : 'Roo.grid',
                                xtype : 'ColumnModel',
                                header : 'Ontable',
-                               width : 100,
+                               width : 150,
                                renderer : function(v,x,r) { return String.format('{0}:{1}', v,r.data.onid); },
                                xns : Roo.grid,
                                dataIndex : 'ontable'