Pman.Dialog.CoreNotifyRecur.bjs
[Pman.Core] / Pman.Dialog.CoreNotifyRecur.bjs
1 {
2     "id": "roo-file-94",
3     "name": "Pman.Dialog.CoreNotifyRecur",
4     "parent": "",
5     "title": "",
6     "path": "/home/alan/gitlive/Pman.Core/Pman.Dialog.CoreNotifyRecur.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "show": "function (_self)\n{\n    _this.grid.ds.load({});\n}"
11             },
12             "height": 500,
13             "modal": true,
14             "resizable": false,
15             "title": "Modify Recurrent Notifications",
16             "width": 800,
17             "xtype": "LayoutDialog",
18             "|xns": "Roo",
19             "items": [
20                 {
21                     "*prop": "center",
22                     "autoScroll": true,
23                     "loadOnce": true,
24                     "xtype": "LayoutRegion",
25                     "|xns": "Roo"
26                 },
27                 {
28                     "listeners": {
29                         "|activate": "function() {\n _this.panel = this;\n    if (_this.grid) {\n//        _this.grid.footer.onClick('first');\n    }\n}"
30                     },
31                     "background": false,
32                     "fitContainer": true,
33                     "fitToFrame": true,
34                     "region": "center",
35                     "tableName": "core_notify_recur",
36                     "title": "core_notify_recur",
37                     "xtype": "GridPanel",
38                     "|xns": "Roo",
39                     "items": [
40                         {
41                             "listeners": {
42                                 "|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}",
43                                 "|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",
44                                 "afteredit": "function (e)\n{\n   e.record.commit();\n}"
45                             },
46                             "*prop": "grid",
47                             "autoExpandColumn": "freq_day",
48                             "clicksToEdit": 1,
49                             "loadMask": true,
50                             "xtype": "EditorGrid",
51                             "|xns": "Roo.grid",
52                             "items": [
53                                 {
54                                     "listeners": {
55                                         "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}",
56                                         "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}"
57                                     },
58                                     "*prop": "dataSource",
59                                     "remoteSort": true,
60                                     "xtype": "Store",
61                                     "|sortInfo": "{ field : 'freq', direction: 'ASC' }",
62                                     "|xns": "Roo.data",
63                                     "items": [
64                                         {
65                                             "*prop": "proxy",
66                                             "xtype": "HttpProxy",
67                                             "method": "GET",
68                                             "|url": "baseURL + '/Roo/core_notify_recur.php'",
69                                             "|xns": "Roo.data"
70                                         },
71                                         {
72                                             "*prop": "reader",
73                                             "id": "id",
74                                             "root": "data",
75                                             "totalProperty": "total",
76                                             "xtype": "JsonReader",
77                                             "|fields": "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id',\n        'type': 'int'\n    },\n    {\n        'name': 'dtstart',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'dtend',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'tz',\n        'type': 'float'\n    },\n    {\n        'name': 'last_applied_dt',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'freq',\n        'type': 'string'\n    },\n    {\n        'name': 'freq_day',\n        'type': 'string'\n    },\n    {\n        'name': 'freq_hour',\n        'type': 'string'\n    },\n    {\n        'name': 'last_event_id',\n        'type': 'int'\n    },\n    {\n        'name': 'method',\n        'type': 'string'\n    }\n]",
78                                             "|xns": "Roo.data"
79                                         }
80                                     ]
81                                 },
82                                 {
83                                     "*prop": "footer",
84                                     "xtype": "PagingToolbar",
85                                     "pageSize": 25,
86                                     "displayInfo": true,
87                                     "displayMsg": "Displaying core_notify_recur{0} - {1} of {2}",
88                                     "emptyMsg": "No core_notify_recur found",
89                                     "|xns": "Roo"
90                                 },
91                                 {
92                                     "*prop": "toolbar",
93                                     "xtype": "Toolbar",
94                                     "|xns": "Roo",
95                                     "items": [
96                                         {
97                                             "listeners": {
98                                                 "|click": "function()\n{\n    var grid = _this.grid;\n    var r = grid.getDataSource().reader.newRow({\n    // defaults..\n        person_id : _this.data.person_id,\n        dtstart : new Date(0),\n        dtend : Date.parseDate('2050-01-01', 'Y-m-d'),\n        tz : 'Asia/Hong Kong',\n        onid : _this.data.onid,\n        ontable : _this.data.ontable,\n        method : _this.data.method,\n        last_event_id : 0,\n        freq_day_name : '',\n        freq_hour_name : '',\n        freq_name : ''\n        \n    \n    });\n    grid.stopEditing();\n    grid.getDataSource().insert(0, r); \n    grid.startEditing(0, 2); \n    \n\n}\n"
99                                             },
100                                             "cls": "x-btn-text-icon",
101                                             "text": "Add",
102                                             "xtype": "Button",
103                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
104                                             "|xns": "Roo.Toolbar"
105                                         },
106                                         {
107                                             "|xns": "Roo.Toolbar",
108                                             "xtype": "Fill"
109                                         },
110                                         {
111                                             "text": "Delete",
112                                             "cls": "x-btn-text-icon",
113                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
114                                             "xtype": "Button",
115                                             "listeners": {
116                                                 "|click": "function()\n{\n     Pman.genericDelete(_this, 'core_notify_recur'); \n}\n        "
117                                             },
118                                             "|xns": "Roo.Toolbar"
119                                         }
120                                     ]
121                                 },
122                                 {
123                                     "*prop": "colModel[]",
124                                     "dataIndex": "dtstart",
125                                     "header": "From",
126                                     "width": 75,
127                                     "xtype": "ColumnModel",
128                                     "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
129                                     "|xns": "Roo.grid",
130                                     "items": [
131                                         {
132                                             "|xns": "Roo.grid",
133                                             "xtype": "GridEditor",
134                                             "*prop": "editor",
135                                             "items": [
136                                                 {
137                                                     "|xns": "Roo.form",
138                                                     "xtype": "DateField",
139                                                     "*prop": "field"
140                                                 }
141                                             ]
142                                         }
143                                     ]
144                                 },
145                                 {
146                                     "*prop": "colModel[]",
147                                     "dataIndex": "dtend",
148                                     "header": "Until",
149                                     "width": 75,
150                                     "xtype": "ColumnModel",
151                                     "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
152                                     "|xns": "Roo.grid",
153                                     "items": [
154                                         {
155                                             "|xns": "Roo.grid",
156                                             "xtype": "GridEditor",
157                                             "*prop": "editor",
158                                             "items": [
159                                                 {
160                                                     "|xns": "Roo.form",
161                                                     "xtype": "DateField",
162                                                     "*prop": "field"
163                                                 }
164                                             ]
165                                         }
166                                     ]
167                                 },
168                                 {
169                                     "*prop": "colModel[]",
170                                     "dataIndex": "freq_day",
171                                     "header": "on day(s)",
172                                     "width": 100,
173                                     "xtype": "ColumnModel",
174                                     "|renderer": "function(v,x,r) { \n    \n    return String.format('{0}', r.data.freq_day_name || v); \n    \n}",
175                                     "|xns": "Roo.grid",
176                                     "items": [
177                                         {
178                                             "|xns": "Roo.grid",
179                                             "xtype": "GridEditor",
180                                             "*prop": "editor",
181                                             "items": [
182                                                 {
183                                                     "*prop": "field",
184                                                     "allowBlank": false,
185                                                     "displayField": "title",
186                                                     "editable": false,
187                                                     "fieldLabel": "Country",
188                                                     "hiddenName": "freq_day",
189                                                     "listWidth": 300,
190                                                     "mode": "local",
191                                                     "name": "freq_day_name",
192                                                     "pageSize": 40,
193                                                     "triggerAction": "all",
194                                                     "valueField": "code",
195                                                     "xtype": "ComboCheck",
196                                                     "|xns": "Roo.form",
197                                                     "items": [
198                                                         {
199                                                             "*prop": "store",
200                                                             "xtype": "SimpleStore",
201                                                             "|data": "(function() { \n    var ret = [];\n    Roo.each(Date.dayNames, function(d) {\n        ret.push([ d.substring(0,3).toUpperCase(), d ]);\n    });\n    return ret;\n})()",
202                                                             "|fields": "['code', 'title']",
203                                                             "|sortInfo": "{ field : 'title', direction: 'ASC' }",
204                                                             "|xns": "Roo.data"
205                                                         }
206                                                     ]
207                                                 }
208                                             ]
209                                         }
210                                     ]
211                                 },
212                                 {
213                                     "*prop": "colModel[]",
214                                     "dataIndex": "freq_hour",
215                                     "header": "at Hour(s)",
216                                     "width": 250,
217                                     "xtype": "ColumnModel",
218                                     "|renderer": "function(v,x,r) { \n    \n    return String.format('{0}', r.data.freq_hour_name || v); \n    \n}",
219                                     "|xns": "Roo.grid",
220                                     "items": [
221                                         {
222                                             "|xns": "Roo.grid",
223                                             "xtype": "GridEditor",
224                                             "*prop": "editor",
225                                             "items": [
226                                                 {
227                                                     "*prop": "field",
228                                                     "allowBlank": false,
229                                                     "displayField": "title",
230                                                     "editable": false,
231                                                     "fieldLabel": "Country",
232                                                     "hiddenName": "freq_hour",
233                                                     "listWidth": 300,
234                                                     "mode": "local",
235                                                     "name": "freq_hour_name",
236                                                     "pageSize": 40,
237                                                     "triggerAction": "all",
238                                                     "valueField": "code",
239                                                     "xtype": "ComboCheck",
240                                                     "|xns": "Roo.form",
241                                                     "items": [
242                                                         {
243                                                             "*prop": "store",
244                                                             "xtype": "SimpleStore",
245                                                             "|data": "(function() { \n    var ret = [];\n    for (var i = 5; i < 25; i++) {\n        var h = i < 10 ? ('0' + i) : i;\n        var mer = i < 12 || i > 23 ? 'am' : 'pm';\n        var dh = i < 13 ? i : i-12;\n        \n        ret.push([ h+':00', dh+':00' + mer ]);\n        ret.push([ h+':00', dh+':30' + mer ]);        \n    }\n    return ret;\n})()",
246                                                             "|fields": "['code', 'title']",
247                                                             "|sortInfo": "{ field : 'title', direction: 'ASC' }",
248                                                             "|xns": "Roo.data"
249                                                         }
250                                                     ]
251                                                 }
252                                             ]
253                                         }
254                                     ]
255                                 },
256                                 {
257                                     "*prop": "colModel[]",
258                                     "dataIndex": "tz",
259                                     "header": "Timezone",
260                                     "width": 100,
261                                     "xtype": "ColumnModel",
262                                     "|renderer": "function(v) { return String.format('{0}', v); }",
263                                     "|xns": "Roo.grid",
264                                     "items": [
265                                         {
266                                             "|xns": "Roo.grid",
267                                             "xtype": "GridEditor",
268                                             "*prop": "editor",
269                                             "items": [
270                                                 {
271                                                     "*prop": "field",
272                                                     "allowBlank": "false",
273                                                     "displayField": "tz",
274                                                     "editable": true,
275                                                     "emptyText": "Select timezone",
276                                                     "fieldLabel": "core_enum",
277                                                     "forceSelection": true,
278                                                     "hiddenName": "tz",
279                                                     "listWidth": 400,
280                                                     "loadingText": "Searching...",
281                                                     "minChars": 2,
282                                                     "name": "tz_name",
283                                                     "pageSize": 999,
284                                                     "qtip": "Select timezone",
285                                                     "queryParam": "q",
286                                                     "selectOnFocus": true,
287                                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{tz}</b> </div>",
288                                                     "triggerAction": "all",
289                                                     "typeAhead": true,
290                                                     "valueField": "tz",
291                                                     "width": 300,
292                                                     "xtype": "ComboBox",
293                                                     "|xns": "Roo.form",
294                                                     "items": [
295                                                         {
296                                                             "listeners": {
297                                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
298                                                             },
299                                                             "*prop": "store",
300                                                             "remoteSort": true,
301                                                             "xtype": "Store",
302                                                             "|sortInfo": "{ direction : 'ASC', field: 'tz' }",
303                                                             "|xns": "Roo.data",
304                                                             "items": [
305                                                                 {
306                                                                     "*prop": "proxy",
307                                                                     "method": "GET",
308                                                                     "xtype": "HttpProxy",
309                                                                     "|url": "baseURL + '/Core/I18n/Timezone.php'\n",
310                                                                     "|xns": "Roo.data"
311                                                                 },
312                                                                 {
313                                                                     "*prop": "reader",
314                                                                     "id": "id",
315                                                                     "root": "data",
316                                                                     "totalProperty": "total",
317                                                                     "xtype": "JsonReader",
318                                                                     "|fields": "[{\"name\":\"tz\",\"type\":\"string\"}]",
319                                                                     "|xns": "Roo.data"
320                                                                 }
321                                                             ]
322                                                         }
323                                                     ]
324                                                 }
325                                             ]
326                                         }
327                                     ]
328                                 },
329                                 {
330                                     "xtype": "ColumnModel",
331                                     "header": "Last event",
332                                     "width": 75,
333                                     "dataIndex": "last_event_id",
334                                     "|renderer": "function(v) { return String.format('{0}', v); }",
335                                     "|xns": "Roo.grid",
336                                     "*prop": "colModel[]"
337                                 }
338                             ]
339                         }
340                     ]
341                 },
342                 {
343                     "*prop": "buttons[]",
344                     "text": "Done",
345                     "xtype": "Button",
346                     "|xns": "Roo"
347                 }
348             ]
349         }
350     ],
351     "permname": "",
352     "modOrder": "001"
353 }