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