Pman.Tab.AdminNotify.bjs
[Pman.Admin] / Pman.Tab.AdminNotify.js
index 863ec02..e266b83 100644 (file)
@@ -2,36 +2,19 @@
 
 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
 
-
-
-// register the module first
-Pman.on('beforeload', function()
-{
-    Pman.register({
-        part :  ["Admin","Notify"],
-        modKey : '001-Pman.Tab.AdminNotify',
-        module : Pman.Tab.AdminNotify,
-        region : 'center',
-        parent : Pman.Tab.AdminWatchNotify,
-        name : "Pman.Tab.AdminNotify",
-        disabled : false, 
-        permname: '' 
-    });
-});
-
-Pman.Tab.AdminNotify = new Roo.util.Observable({
-
-    panel : false,
-    disabled : false,
-    parentLayout:  false,
-
-    add : function(parentLayout, region)
+Pman.Tab.AdminNotify = new Roo.XComponent({
+    part     :  ["Admin","Notify"],
+    order    : '001-Pman.Tab.AdminNotify',
+    region   : 'center',
+    parent   : 'Pman.Tab.AdminWatchNotify',
+    name     : "Pman.Tab.AdminNotify",
+    disabled : false, 
+    permname : '', 
+    _tree : function()
     {
-
         var _this = this;
-        this.parentLayout = parentLayout;
-
-        this.panel = parentLayout.addxtype({
+        var MODULE = this;
+        return {
             xtype: 'GridPanel',
             xns: Roo,
             listeners : {
@@ -40,6 +23,7 @@ Pman.Tab.AdminNotify = new Roo.util.Observable({
                     if (_this.grid) {
                         _this.grid.footer.onClick('first');
                     }
+                    
                 }
             },
             background : true,
@@ -253,6 +237,75 @@ Pman.Tab.AdminNotify = new Roo.util.Observable({
                     xtype: 'Toolbar',
                     xns: Roo,
                     items : [
+                        {
+                            xtype: 'ComboBox',
+                            xns: Roo.form,
+                            allowBlank : true,
+                            displayField : 'person_id_name',
+                            editable : true,
+                            emptyText : "Select person",
+                            forceSelection : true,
+                            hiddenName : 'id',
+                            listWidth : 400,
+                            loadingText : "Searching...",
+                            minChars : 2,
+                            name : 'name',
+                            pageSize : 20,
+                            qtip : "Select core_notify",
+                            queryParam : 'query[person_id_name]',
+                            selectOnFocus : true,
+                            tpl : '<div class="x-grid-cell-text x-btn button"><b>{person_id_name}</b> {person_id_email}</div>',
+                            triggerAction : 'all',
+                            valueField : 'person_id',
+                            width : 300,
+                            store : {
+                                xtype: 'Store',
+                                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
+                                    }
+                                },
+                                remoteSort : true,
+                                sortInfo : { direction : 'ASC', field: 'person_id_name' },
+                                proxy : {
+                                    xtype: 'HttpProxy',
+                                    xns: Roo.data,
+                                    method : 'GET',
+                                    url : baseURL + '/Roo/core_notify.php'
+                                },
+                                reader : {
+                                    xtype: 'JsonReader',
+                                    xns: Roo.data,
+                                    id : 'id',
+                                    root : 'data',
+                                    totalProperty : 'total',
+                                    fields : [{"name":"id","type":"int"},{"name":"ontable","type":"string"}]
+                                }
+                            }
+                        },
+                        {
+                            xtype: 'Fill',
+                            xns: Roo.Toolbar
+                        },
+                        {
+                            xtype: 'Button',
+                            xns: Roo.Toolbar,
+                            listeners : {
+                                click : function()
+                                        {
+                                        Pman.genericDelete(_this, 'core_notify'); 
+                                        }
+                            },
+                            cls : 'x-btn-text-icon',
+                            text : "Delete",
+                            icon : rootURL + '/Pman/templates/images/trash.gif'
+                        },
                         {
                             xtype: 'Button',
                             xns: Roo.Toolbar,
@@ -273,6 +326,24 @@ Pman.Tab.AdminNotify = new Roo.util.Observable({
                     ]
                 },
                 colModel : [
+                    {
+                        xtype: 'ColumnModel',
+                        xns: Roo.grid,
+                        dataIndex : 'id',
+                        header : 'id#',
+                        sortable : true,
+                        width : 50,
+                        renderer : function(v) { return String.format('{0}', v ); }
+                    },
+                    {
+                        xtype: 'ColumnModel',
+                        xns: Roo.grid,
+                        dataIndex : 'evtype',
+                        header : 'Method',
+                        sortable : true,
+                        width : 100,
+                        renderer : function(v) { return String.format('{0}', v ); }
+                    },
                     {
                         xtype: 'ColumnModel',
                         xns: Roo.grid,
@@ -280,7 +351,7 @@ Pman.Tab.AdminNotify = new Roo.util.Observable({
                         header : 'Act when',
                         sortable : true,
                         width : 100,
-                        renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
+                        renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); }
                     },
                     {
                         xtype: 'ColumnModel',
@@ -293,7 +364,7 @@ Pman.Tab.AdminNotify = new Roo.util.Observable({
                             if (r.data.event_id *1 == 0) {
                                 return '';
                             }
-                             return String.format('{0}', v ? v.format('d/M/Y') : '');
+                             return String.format('{0}', v ? v.format('d/M/Y H:i:s') : '');
                           }
                     },
                     {
@@ -311,7 +382,7 @@ Pman.Tab.AdminNotify = new Roo.util.Observable({
                         header : 'Who to notify',
                         width : 200,
                         renderer : function(v,x,r) {
-                             return String.format('{0} <u>&lt;{1}&lt;</u>', v, r.data.email); 
+                             return String.format('{0} <u>&lt;{1}&gt;</u>', v, r.data.person_id_email); 
                          }
                     },
                     {
@@ -332,8 +403,6 @@ Pman.Tab.AdminNotify = new Roo.util.Observable({
                     }
                 ]
             }
-        });
-        this.layout = this.panel.layout;
-
+        };
     }
 });