Pman.Tab.AdminNotify.bjs
[Pman.Admin] / Pman.Tab.AdminNotify.bjs
index 0b8c6e0..ac279dc 100644 (file)
@@ -1,39 +1,42 @@
 {
-    "id": "roo-file-215",
+    "id": "roo-file-210",
     "name": "Pman.Tab.AdminNotify",
-    "parent": "",
-    "title": "",
+    "parent": "Pman.Tab.AdminWatchNotify",
+    "title": "Pman.Tab.AdminNotify",
     "path": "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminNotify.bjs",
     "items": [
         {
             "listeners": {
-                "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
+                "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n    \n}"
             },
             "background": true,
             "fitContainer": true,
             "fitToframe": true,
             "region": "center",
             "tableName": "core_notify",
-            "title": "Notifications",
+            "title": "Current Notifications",
             "xtype": "GridPanel",
             "|xns": "Roo",
             "items": [
                 {
-                    "*prop": "grid",
-                    "xtype": "Grid",
-                    "autoExpandColumn": "ontable",
-                    "loadMask": true,
                     "listeners": {
                         "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
                         "|rowdblclick": "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n"
                     },
+                    "*prop": "grid",
+                    "autoExpandColumn": "person_id_name",
+                    "loadMask": true,
+                    "xtype": "Grid",
                     "|xns": "Roo.grid",
                     "items": [
                         {
+                            "listeners": {
+                                "beforeload": "function (_self, options)\n{\n    if (!_this.toggleBtn.pressed) {\n        options.params['event_id'] = 0;\n    }\n}"
+                            },
                             "*prop": "dataSource",
-                            "xtype": "Store",
                             "remoteSort": true,
-                            "|sortInfo": "{ field : 'ontable', direction: 'ASC' }",
+                            "xtype": "Store",
+                            "|sortInfo": "{ field : 'act_when', direction: 'DESC' }",
                             "|xns": "Roo.data",
                             "items": [
                                 {
                             "|xns": "Roo",
                             "items": [
                                 {
+                                    "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,
+                                    "xtype": "ComboBox",
+                                    "|xns": "Roo.form",
+                                    "items": [
+                                        {
+                                            "listeners": {
+                                                "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    o.params._distinct='person_id';\n    o.params._columns='person_id,person_id_name,person_id_email';\n    o.params['!person_id_name'] = '';\n    \n    // set more here\n}\n"
+                                            },
+                                            "*prop": "store",
+                                            "remoteSort": true,
+                                            "xtype": "Store",
+                                            "|sortInfo": "{ direction : 'ASC', field: 'person_id_name' }",
+                                            "|xns": "Roo.data",
+                                            "items": [
+                                                {
+                                                    "*prop": "proxy",
+                                                    "xtype": "HttpProxy",
+                                                    "method": "GET",
+                                                    "|xns": "Roo.data",
+                                                    "|url": "baseURL + '/Roo/core_notify.php'"
+                                                },
+                                                {
+                                                    "*prop": "reader",
+                                                    "xtype": "JsonReader",
+                                                    "|xns": "Roo.data",
+                                                    "id": "id",
+                                                    "root": "data",
+                                                    "totalProperty": "total",
+                                                    "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"ontable\",\"type\":\"string\"}]"
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                },
+                                {
+                                    "|xns": "Roo.Toolbar",
+                                    "xtype": "Fill"
+                                },
+                                {
+                                    "listeners": {
+                                        "|click": "function()\n        {\n        Pman.genericDelete(_this, 'core_notify'); \n        }\n        "
+                                    },
+                                    "cls": "x-btn-text-icon",
+                                    "text": "Delete",
+                                    "xtype": "Button",
+                                    "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
+                                    "|xns": "Roo.Toolbar"
+                                },
+                                {
+                                    "listeners": {
+                                        "render": "function (_self)\n{\n    _this.toggleBtn = _self;\n}",
+                                        "toggle": "function (_self, pressed)\n{\n    this.setText(pressed ? \"Hide Completed\" : \"Show Completed\");\n    _this.grid.footer.onClick('first');\n}"
+                                    },
                                     "enableToggle": true,
                                     "text": "Show Completed",
                                     "xtype": "Button",
                             ]
                         },
                         {
+                            "*prop": "colModel[]",
+                            "dataIndex": "id",
+                            "header": "id#",
+                            "sortable": true,
+                            "width": 50,
                             "xtype": "ColumnModel",
-                            "header": "Act when",
-                            "width": 75,
-                            "dataIndex": "act_when",
-                            "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
-                            "|xns": "Roo.grid",
-                            "*prop": "colModel[]"
+                            "|renderer": "function(v) { return String.format('{0}', v ); }",
+                            "|xns": "Roo.grid"
                         },
                         {
+                            "*prop": "colModel[]",
+                            "dataIndex": "evtype",
+                            "header": "Method",
+                            "sortable": true,
+                            "width": 100,
                             "xtype": "ColumnModel",
-                            "header": "Onid",
-                            "width": 75,
-                            "dataIndex": "onid",
-                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                            "|xns": "Roo.grid",
-                            "*prop": "colModel[]"
+                            "|renderer": "function(v) { return String.format('{0}', v ); }",
+                            "|xns": "Roo.grid"
                         },
                         {
+                            "*prop": "colModel[]",
+                            "dataIndex": "act_when",
+                            "header": "Act when",
+                            "sortable": true,
+                            "width": 100,
                             "xtype": "ColumnModel",
-                            "header": "Ontable",
-                            "width": 200,
+                            "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); }",
+                            "|xns": "Roo.grid"
+                        },
+                        {
+                            "*prop": "colModel[]",
+                            "dataIndex": "sent",
+                            "header": "Sent",
+                            "sortable": true,
+                            "width": 100,
+                            "xtype": "ColumnModel",
+                            "|renderer": "function(v,x,r) {\n    if (r.data.event_id *1 == 0) {\n        return '';\n    }\n     return String.format('{0}', v ? v.format('d/M/Y H:i:s') : '');\n  }",
+                            "|xns": "Roo.grid"
+                        },
+                        {
+                            "*prop": "colModel[]",
                             "dataIndex": "ontable",
-                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                            "|xns": "Roo.grid",
-                            "*prop": "colModel[]"
+                            "header": "Ontable",
+                            "width": 100,
+                            "xtype": "ColumnModel",
+                            "|renderer": "function(v,x,r) { return String.format('{0}:{1}', v,r.data.onid); }",
+                            "|xns": "Roo.grid"
                         },
                         {
                             "*prop": "colModel[]",
                             "dataIndex": "person_id_name",
                             "header": "Who to notify",
-                            "width": 75,
+                            "width": 100,
+                            "xtype": "ColumnModel",
+                            "|renderer": "function(v,x,r) {\n     return String.format('{0} <u>&lt;{1}&gt;</u>', v, r.data.person_id_email); \n }",
+                            "|xns": "Roo.grid"
+                        },
+                        {
+                            "*prop": "colModel[]",
+                            "dataIndex": "trigger_event_id",
+                            "header": "Triggered by",
+                            "width": 100,
                             "xtype": "ColumnModel",
-                            "|renderer": "function(v,x,r) {\n     return String.format('{0} <u>&lt;{1}&lt;</u>', v, r.data.email); \n }",
+                            "|renderer": "function(v,x,r) {\n     return String.format(\n            '{0} : {1} {2}', \n            r.data.trigger_event_id_on_table, \n            r.data.trigger_event_id_on_id, \n            r.data.trigger_event_id_remarks\n        ); \n }",
                             "|xns": "Roo.grid"
                         },
                         {
                             "*prop": "colModel[]"
                         },
                         {
-                            "xtype": "ColumnModel",
-                            "header": "Sent",
-                            "width": 75,
-                            "dataIndex": "sent",
-                            "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
-                            "|xns": "Roo.grid",
-                            "*prop": "colModel[]"
-                        },
-                        {
-                            "xtype": "ColumnModel",
+                            "*prop": "colModel[]",
+                            "dataIndex": "event_id_remarks",
                             "header": "Event",
-                            "width": 75,
-                            "dataIndex": "event_id",
-                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                            "|xns": "Roo.grid",
-                            "*prop": "colModel[]"
+                            "width": 300,
+                            "xtype": "ColumnModel",
+                            "|renderer": "function(v) { return String.format('<span qtip=\"{0}\">{0}</span>', v); }",
+                            "|xns": "Roo.grid"
                         }
                     ]
                 }