Pman.Dialog.CoreNotifyRecur.bjs
[Pman.Core] / Pman.Dialog.CoreNotifyRecur.bjs
index f6f2084..c24007f 100644 (file)
@@ -6,6 +6,9 @@
     "path": "/home/alan/gitlive/Pman.Core/Pman.Dialog.CoreNotifyRecur.bjs",
     "items": [
         {
+            "listeners": {
+                "show": "function (_self)\n{\n    _this.grid.ds.load({});\n}"
+            },
             "height": 500,
             "modal": true,
             "resizable": false,
@@ -23,7 +26,7 @@
                 },
                 {
                     "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}"
                     },
                     "background": false,
                     "fitContainer": true,
@@ -36,7 +39,7 @@
                     "items": [
                         {
                             "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}",
+                                "|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).data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n",
                                 "afteredit": "function (e)\n{\n   e.record.commit();\n}"
                             },
@@ -49,7 +52,8 @@
                             "items": [
                                 {
                                     "listeners": {
-                                        "update": "function (_self, record, operation)\n{\n    Roo.log(operation);\n    if (operation != 'commit') {\n        return;\n    }\n    new Pman.Request({\n        url : baseURL + '/Roo/Core_notify_recur',\n        method :'POST',\n        params : record.data,\n        success : function()\n        {\n            //??\n        },\n        failure : function() {\n            Roo.MessageBox.alert(\"Error\", \"There was a problem saving\");\n        }\n    });\n       \n    \n    \n}"
+                                        "update": "function (_self, record, operation)\n{\n    Roo.log(operation);\n    if (operation != 'commit') {\n        return;\n    }\n    new Pman.Request({\n        url : baseURL + '/Roo/Core_notify_recur',\n        method :'POST',\n        params : record.data,\n        success : function()\n        {\n            //??\n        },\n        failure : function() {\n            Roo.MessageBox.alert(\"Error\", \"There was a problem saving\");\n        }\n    });\n       \n    \n    \n}",
+                                        "beforeload": "function (_self, o)\n{\n    if (!_this.data) {\n        return false;\n    }\n    o.params =  Roo.apply(o.params || {}, {\n        person_id : _this.data.person_id,\n        onid : _this.data.onid,\n        ontable : _this.data.ontable,\n        method : _this.data.method\n    });\n        \n}"
                                     },
                                     "*prop": "dataSource",
                                     "remoteSort": true,
                                         }
                                     ]
                                 },
-                                {
-                                    "*prop": "footer",
-                                    "xtype": "PagingToolbar",
-                                    "pageSize": 25,
-                                    "displayInfo": true,
-                                    "displayMsg": "Displaying core_notify_recur{0} - {1} of {2}",
-                                    "emptyMsg": "No core_notify_recur found",
-                                    "|xns": "Roo"
-                                },
                                 {
                                     "*prop": "toolbar",
                                     "xtype": "Toolbar",
                                         }
                                     ]
                                 },
-                                {
-                                    "*prop": "colModel[]",
-                                    "dataIndex": "freq",
-                                    "header": "Frequency",
-                                    "width": 70,
-                                    "xtype": "ColumnModel",
-                                    "|renderer": "function(v,x,r) { \n\n    Roo.log(this);\n    var cm = _this.grid.colModel;\n    var ix = cm.findColumnIndex('freq');\n    var ce = cm.getCellEditor(ix)\n    var matches = ce.field.store.query('code',v);\n    if (!matches.length) {\n        return '';\n    }\n    return String.format('{0}', matches.first().data.title);\n }",
-                                    "|xns": "Roo.grid",
-                                    "items": [
-                                        {
-                                            "|xns": "Roo.grid",
-                                            "xtype": "GridEditor",
-                                            "*prop": "editor",
-                                            "items": [
-                                                {
-                                                    "*prop": "field",
-                                                    "allowBlank": false,
-                                                    "displayField": "title",
-                                                    "editable": false,
-                                                    "fieldLabel": "Country",
-                                                    "hiddenName": "freq",
-                                                    "listWidth": 200,
-                                                    "mode": "local",
-                                                    "name": "freq_name",
-                                                    "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{title}</b> </div>",
-                                                    "triggerAction": "all",
-                                                    "valueField": "code",
-                                                    "width": 200,
-                                                    "xtype": "ComboBox",
-                                                    "|xns": "Roo.form",
-                                                    "items": [
-                                                        {
-                                                            "*prop": "store",
-                                                            "xtype": "SimpleStore",
-                                                            "|data": "[ \n    [ 'HOURLY' , 'Hourly at' ] ,\n       [ 'DAILY' , 'Daily at'] ,\n        [ 'WEEKLY' , 'Weekly at'] ,\n         [ 'Montly' , 'Montly at'] \n]",
-                                                            "|fields": "['code', 'title']",
-                                                            "|sortInfo": "{ field : 'title', direction: 'ASC' }",
-                                                            "|xns": "Roo.data"
-                                                        }
-                                                    ]
-                                                }
-                                            ]
-                                        }
-                                    ]
-                                },
                                 {
                                     "*prop": "colModel[]",
                                     "dataIndex": "freq_day",
                                     "header": "at Hour(s)",
                                     "width": 250,
                                     "xtype": "ColumnModel",
-                                    "|renderer": "function(v,x,r) { \n    \n    return String.format('{0}', r.data.freq_hour_name || v); \n    \n}",
+                                    "|renderer": "function(v,x,r) { \n    \n    Roo.log(x);\n    if (v.length) {\n    Roo.log(\"try fill\");\n        var cm = _this.grid.colModel;\n        Roo.log(this);\n        var ci = cm.getColumnByDataIndex(this.name);\n        Roo.log(ci);\n        \n        var ce = cm.getCellEditor(ci);\n        Roo.log(ce);\n        ce.field.setValue(v);\n        return String.format('{0}',ce.field.el.value);\n\n        \n    \n    }\n    \n    return String.format('{0}', r.data.freq_hour_name || v); \n    \n}",
                                     "|xns": "Roo.grid",
                                     "items": [
                                         {
                                             "*prop": "editor",
                                             "items": [
                                                 {
+                                                    "*prop": "field",
                                                     "allowBlank": "false",
                                                     "displayField": "tz",
                                                     "editable": true,
                                                     "name": "tz_name",
                                                     "pageSize": 999,
                                                     "qtip": "Select timezone",
+                                                    "queryParam": "q",
                                                     "selectOnFocus": true,
                                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{tz}</b> </div>",
                                                     "triggerAction": "all",
                                                             "items": [
                                                                 {
                                                                     "*prop": "proxy",
-                                                                    "xtype": "HttpProxy",
                                                                     "method": "GET",
-                                                                    "|xns": "Roo.data",
-                                                                    "|url": "baseURL + '/Roo/core_enum.php'"
+                                                                    "xtype": "HttpProxy",
+                                                                    "|url": "baseURL + '/Core/I18n/Timezone.php'\n",
+                                                                    "|xns": "Roo.data"
                                                                 },
                                                                 {
                                                                     "*prop": "reader",
-                                                                    "xtype": "JsonReader",
-                                                                    "|xns": "Roo.data",
                                                                     "id": "id",
                                                                     "root": "data",
                                                                     "totalProperty": "total",
-                                                                    "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"etype\",\"type\":\"string\"}]"
+                                                                    "xtype": "JsonReader",
+                                                                    "|fields": "[{\"name\":\"tz\",\"type\":\"string\"}]",
+                                                                    "|xns": "Roo.data"
                                                                 }
                                                             ]
                                                         }
                     ]
                 },
                 {
+                    "listeners": {
+                        "click": "function (_self, e)\n{\n    _this.dialog.hide();\n}"
+                    },
                     "*prop": "buttons[]",
                     "text": "Done",
                     "xtype": "Button",