default view should be pending
[Pman.Admin] / Pman.Tab.AdminNotify.bjs
1 {
2  "items" : [
3   {
4    "$ xns" : "Roo",
5    "Boolean background" : false,
6    "String region" : "center",
7    "String title" : "Current Notifications",
8    "items" : [
9     {
10      "$ xns" : "Roo",
11      "* prop" : "layout",
12      "items" : [
13       {
14        "$ xns" : "Roo",
15        "* prop" : "center",
16        "xtype" : "LayoutRegion"
17       },
18       {
19        "$ xns" : "Roo",
20        "* prop" : "south",
21        "Boolean collapsible" : true,
22        "Boolean split" : true,
23        "String collapsedTitle" : "View Details",
24        "String title" : "Event Details",
25        "autoScroll" : true,
26        "height" : 150,
27        "xtype" : "LayoutRegion"
28       },
29       {
30        "$ xns" : "Roo",
31        "bool background" : false,
32        "fitContainer" : true,
33        "fitToframe" : true,
34        "items" : [
35         {
36          "$ xns" : "Roo.grid",
37          "* prop" : "grid",
38          "autoExpandColumn" : "person_id_name",
39          "items" : [
40           {
41            "$ sortInfo" : "{ field : 'act_when', direction: 'DESC' }",
42            "$ xns" : "Roo.data",
43            "* prop" : "dataSource",
44            "items" : [
45             {
46              "$ url" : "baseURL + '/Roo/core_notify.php'",
47              "$ xns" : "Roo.data",
48              "* prop" : "proxy",
49              "method" : "GET",
50              "xtype" : "HttpProxy"
51             },
52             {
53              "$ fields" : [
54               "[",
55               "    {",
56               "        'name': 'id',",
57               "        'type': 'int'",
58               "    },",
59               "    {",
60               "        'name': 'act_when',",
61               "        'type': 'date',",
62               "        'dateFormat': 'Y-m-d'",
63               "    },",
64               "    {",
65               "        'name': 'onid',",
66               "        'type': 'int'",
67               "    },",
68               "    {",
69               "        'name': 'ontable',",
70               "        'type': 'string'",
71               "    },",
72               "    {",
73               "        'name': 'person_id',",
74               "        'type': 'int'",
75               "    },",
76               "    {",
77               "        'name': 'msgid',",
78               "        'type': 'string'",
79               "    },",
80               "    {",
81               "        'name': 'sent',",
82               "        'type': 'date',",
83               "        'dateFormat': 'Y-m-d'",
84               "    },",
85               "    {",
86               "        'name': 'event_id',",
87               "        'type': 'int'",
88               "    },",
89               "    {",
90               "        'name': 'person_id_id',",
91               "        'type': 'int'",
92               "    },",
93               "    {",
94               "        'name': 'person_id_office_id',",
95               "        'type': 'int'",
96               "    },",
97               "    {",
98               "        'name': 'person_id_name',",
99               "        'type': 'string'",
100               "    },",
101               "    {",
102               "        'name': 'person_id_phone',",
103               "        'type': 'string'",
104               "    },",
105               "    {",
106               "        'name': 'person_id_fax',",
107               "        'type': 'string'",
108               "    },",
109               "    {",
110               "        'name': 'person_id_email',",
111               "        'type': 'string'",
112               "    },",
113               "    {",
114               "        'name': 'person_id_company_id',",
115               "        'type': 'int'",
116               "    },",
117               "    {",
118               "        'name': 'person_id_role',",
119               "        'type': 'string'",
120               "    },",
121               "    {",
122               "        'name': 'person_id_active',",
123               "        'type': 'int'",
124               "    },",
125               "    {",
126               "        'name': 'person_id_remarks',",
127               "        'type': 'string'",
128               "    },",
129               "    {",
130               "        'name': 'person_id_passwd',",
131               "        'type': 'string'",
132               "    },",
133               "    {",
134               "        'name': 'person_id_owner_id',",
135               "        'type': 'int'",
136               "    },",
137               "    {",
138               "        'name': 'person_id_lang',",
139               "        'type': 'string'",
140               "    },",
141               "    {",
142               "        'name': 'person_id_no_reset_sent',",
143               "        'type': 'int'",
144               "    },",
145               "    {",
146               "        'name': 'person_id_action_type',",
147               "        'type': 'string'",
148               "    },",
149               "    {",
150               "        'name': 'person_id_project_id',",
151               "        'type': 'int'",
152               "    },",
153               "    {",
154               "        'name': 'person_id_deleted_by',",
155               "        'type': 'int'",
156               "    },",
157               "    {",
158               "        'name': 'person_id_deleted_dt',",
159               "        'type': 'date'",
160               "    },",
161               "    {",
162               "        'name': 'event_id_id',",
163               "        'type': 'int'",
164               "    },",
165               "    {",
166               "        'name': 'event_id_person_name',",
167               "        'type': 'string'",
168               "    },",
169               "    {",
170               "        'name': 'event_id_event_when',",
171               "        'type': 'date'",
172               "    },",
173               "    {",
174               "        'name': 'event_id_action',",
175               "        'type': 'string'",
176               "    },",
177               "    {",
178               "        'name': 'event_id_ipaddr',",
179               "        'type': 'string'",
180               "    },",
181               "    {",
182               "        'name': 'event_id_on_id',",
183               "        'type': 'int'",
184               "    },",
185               "    {",
186               "        'name': 'event_id_on_table',",
187               "        'type': 'string'",
188               "    },",
189               "    {",
190               "        'name': 'event_id_person_id',",
191               "        'type': 'int'",
192               "    },",
193               "    {",
194               "        'name': 'event_id_remarks',",
195               "        'type': 'string'",
196               "    }",
197               "]"
198              ],
199              "$ xns" : "Roo.data",
200              "* prop" : "reader",
201              "id" : "id",
202              "root" : "data",
203              "totalProperty" : "total",
204              "xtype" : "JsonReader"
205             }
206            ],
207            "listeners" : {
208             "beforeload" : [
209              "function (_self, options)",
210              "{",
211              "    options.params = options.params || {};",
212              "    ",
213              "    options.params._evtype_align = 1;",
214              "    ",
215              "    if (!_this.toggleBtn.pressed) {",
216              "        options.params.event_id = 0;",
217              "        options.params['query[status]'] = 'PENDING';",
218              "    } else  {",
219              "        options.params['!event_id'] = 0;",
220              "    }",
221              "    ",
222              "    if (!_this.personCombo) {",
223              "        return false;",
224              "    }",
225              "    var p = _this.personCombo.getValue();",
226              "    if (p*1) { ",
227              "        options.params.person_id = p;",
228              "    }",
229              "    ",
230              "    var from = _this.fromDateSel.getValue();",
231              "    ",
232              "    if(from){",
233              "        options.params.from = from.format('Y-m-d');",
234              "    }",
235              "    ",
236              "    var to = _this.toDateSel.getValue();",
237              "    ",
238              "    if(to){",
239              "        options.params.to = to.format('Y-m-d');",
240              "    }",
241              "    ",
242              "    var type = _this.typeCombo.getValue();",
243              "    ",
244              "    if(type.length){",
245              "        options.params.evtype = type;",
246              "    }",
247              "    options.params['search[contains]'] = _this.searchBox.getValue();",
248              "    ",
249              "}"
250             ]
251            },
252            "remoteSort" : true,
253            "xtype" : "Store"
254           },
255           {
256            "$ xns" : "Roo.grid",
257            "* prop" : "sm",
258            "listeners" : {
259             "afterselectionchange" : [
260              "function (_self)",
261              "{",
262              "    // load detail log in _this.viewPanel;",
263              "    if (!this.getSelected()) {",
264              "        this.viewPanel.setContent(\"Nothing Selected\");",
265              "        return;",
266              "    }",
267              "    var id = this.getSelected().data.event_id;",
268              "    if (id *1 < 1) {",
269              "    ",
270              "       _this.viewPanel.setContent(\"No Event for this line\");    ",
271              "        return;",
272              "    }",
273              "    _this.viewPanel.load( { url : baseURL + \"/Admin/EventView/\" + id + \".html\" });",
274              "    ",
275              "}"
276             ]
277            },
278            "singleSelect" : false,
279            "xtype" : "RowSelectionModel"
280           },
281           {
282            "$ xns" : "Roo",
283            "* prop" : "footer",
284            "displayInfo" : true,
285            "displayMsg" : "Displaying core_notify{0} - {1} of {2}",
286            "emptyMsg" : "No core_notify found",
287            "pageSize" : 25,
288            "xtype" : "PagingToolbar"
289           },
290           {
291            "$ xns" : "Roo",
292            "* prop" : "toolbar",
293            "items" : [
294             {
295              "$ xns" : "Roo.form",
296              "String emptyText" : "Search Subject",
297              "listeners" : {
298               "render" : [
299                "function (_self)",
300                "{",
301                "    _this.searchBox = this;",
302                "}"
303               ],
304               "specialkey" : [
305                "function (_self, e)",
306                "{",
307                "    _this.grid.footer.onClick('first');",
308                "}"
309               ]
310              },
311              "xtype" : "TextField"
312             },
313             {
314              "$ xns" : "Roo.form",
315              "allowBlank" : true,
316              "displayField" : "person_id_name",
317              "editable" : true,
318              "emptyText" : "Select person",
319              "forceSelection" : true,
320              "items" : [
321               {
322                "$ sortInfo" : "{ direction : 'ASC', field: 'person_id_name' }",
323                "$ xns" : "Roo.data",
324                "* prop" : "store",
325                "items" : [
326                 {
327                  "$ url" : "baseURL + '/Roo/core_notify.php'",
328                  "$ xns" : "Roo.data",
329                  "* prop" : "proxy",
330                  "method" : "GET",
331                  "xtype" : "HttpProxy"
332                 },
333                 {
334                  "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"ontable\",\"type\":\"string\"}]",
335                  "$ xns" : "Roo.data",
336                  "* prop" : "reader",
337                  "id" : "id",
338                  "root" : "data",
339                  "totalProperty" : "total",
340                  "xtype" : "JsonReader"
341                 }
342                ],
343                "listeners" : {
344                 "|beforeload" : [
345                  "function (_self, o){",
346                  "    o.params = o.params || {};",
347                  "    o.params._distinct='person_id';",
348                  "    o.params._columns='person_id,person_id_name,person_id_email';",
349                  "    o.params['!person_id_name'] = '';",
350                  "    ",
351                  "    // set more here",
352                  "}",
353                  ""
354                 ]
355                },
356                "remoteSort" : true,
357                "xtype" : "Store"
358               }
359              ],
360              "listWidth" : 400,
361              "listeners" : {
362               "render" : [
363                "function (_self)",
364                "{",
365                "   _this.personCombo = _self;",
366                "}"
367               ],
368               "select" : [
369                "function (combo, record, index)",
370                "{",
371                "   _this.grid.footer.onClick('first');",
372                "}"
373               ]
374              },
375              "loadingText" : "Searching...",
376              "minChars" : 2,
377              "pageSize" : 20,
378              "qtip" : "Select person",
379              "queryParam" : "query[person_id_name]",
380              "selectOnFocus" : true,
381              "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{person_id_name}</b> {person_id_email}</div>",
382              "triggerAction" : "all",
383              "valueField" : "person_id",
384              "width" : 200,
385              "xtype" : "ComboBox"
386             },
387             {
388              "$ xns" : "Roo.Toolbar",
389              "xtype" : "Separator"
390             },
391             {
392              "$ xns" : "Roo.form",
393              "allowBlank" : true,
394              "displayField" : "display_name",
395              "editable" : true,
396              "emptyText" : "Select notify type",
397              "forceSelection" : true,
398              "items" : [
399               {
400                "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
401                "$ xns" : "Roo.data",
402                "* prop" : "store",
403                "items" : [
404                 {
405                  "$ url" : "baseURL + '/Roo/core_enum.php'",
406                  "$ xns" : "Roo.data",
407                  "* prop" : "proxy",
408                  "method" : "GET",
409                  "xtype" : "HttpProxy"
410                 },
411                 {
412                  "$ fields" : "[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"display_name\",\"type\":\"string\"}]",
413                  "$ xns" : "Roo.data",
414                  "* prop" : "reader",
415                  "id" : "id",
416                  "root" : "data",
417                  "totalProperty" : "total",
418                  "xtype" : "JsonReader"
419                 }
420                ],
421                "listeners" : {
422                 "|beforeload" : [
423                  "function (_self, o){",
424                  "    o.params = o.params || {};",
425                  "    o.params.etype = 'Core.NotifyType';",
426                  "    o.params.active = 1;",
427                  "}",
428                  ""
429                 ]
430                },
431                "remoteSort" : true,
432                "xtype" : "Store"
433               }
434              ],
435              "listWidth" : 400,
436              "listeners" : {
437               "render" : [
438                "function (_self)",
439                "{",
440                "   _this.typeCombo = _self;",
441                "}"
442               ],
443               "select" : [
444                "function (combo, record, index)",
445                "{",
446                "   _this.grid.footer.onClick('first');",
447                "}"
448               ]
449              },
450              "loadingText" : "Searching...",
451              "minChars" : 2,
452              "pageSize" : 20,
453              "qtip" : "Select type",
454              "queryParam" : "query[name]",
455              "selectOnFocus" : true,
456              "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b></div>",
457              "triggerAction" : "all",
458              "valueField" : "name",
459              "width" : 200,
460              "xtype" : "ComboBox"
461             },
462             {
463              "$ xns" : "Roo.Toolbar",
464              "xtype" : "Separator"
465             },
466             {
467              "$ xns" : "Roo.Toolbar",
468              "text" : "From",
469              "xtype" : "TextItem"
470             },
471             {
472              "$ xns" : "Roo.form",
473              "format" : "d/M/Y",
474              "listeners" : {
475               "render" : [
476                "function (_self)\r",
477                "{\r",
478                "    _this.fromDateSel = _self;\r",
479                "   //_self.setValue(  new Date() );\r",
480                "}"
481               ],
482               "select" : [
483                "function (combo, date)",
484                "{",
485                "    _this.grid.footer.onClick('first');",
486                "}"
487               ]
488              },
489              "width" : 100,
490              "xtype" : "DateField"
491             },
492             {
493              "$ xns" : "Roo.Toolbar",
494              "xtype" : "Separator"
495             },
496             {
497              "$ xns" : "Roo.Toolbar",
498              "text" : "To",
499              "xtype" : "TextItem"
500             },
501             {
502              "$ xns" : "Roo.form",
503              "format" : "d/M/Y",
504              "listeners" : {
505               "render" : [
506                "function (_self)\r",
507                "{\r",
508                "    _this.toDateSel = _self;\r",
509                "   //_self.setValue(  new Date() );\r",
510                "}"
511               ],
512               "select" : [
513                "function (combo, date)",
514                "{",
515                "    _this.grid.footer.onClick('first');",
516                "}"
517               ]
518              },
519              "width" : 100,
520              "xtype" : "DateField"
521             },
522             {
523              "$ xns" : "Roo.Toolbar",
524              "xtype" : "Fill"
525             },
526             {
527              "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
528              "$ xns" : "Roo.Toolbar",
529              "cls" : "x-btn-text-icon",
530              "listeners" : {
531               "|click" : [
532                "function()",
533                "{",
534                "    Pman.genericDelete(_this, 'core_notify'); ",
535                "}",
536                "        "
537               ]
538              },
539              "text" : "Delete",
540              "xtype" : "Button"
541             },
542             {
543              "$ xns" : "Roo.Toolbar",
544              "enableToggle" : true,
545              "listeners" : {
546               "render" : [
547                "function (_self)",
548                "{",
549                "    _this.toggleBtn = _self;",
550                "}"
551               ],
552               "toggle" : [
553                "function (_self, pressed)",
554                "{",
555                "    this.setText(pressed ? \"Hide Completed\" : \"Show Completed\");",
556                "    _this.grid.footer.onClick('first');",
557                "}"
558               ]
559              },
560              "text" : "Show Completed",
561              "xtype" : "Button"
562             }
563            ],
564            "xtype" : "Toolbar"
565           },
566           {
567            "$ renderer" : "function(v) { return String.format('{0}', v ); }",
568            "$ xns" : "Roo.grid",
569            "* prop" : "colModel[]",
570            "dataIndex" : "id",
571            "header" : "id#",
572            "sortable" : true,
573            "width" : 50,
574            "xtype" : "ColumnModel"
575           },
576           {
577            "$ renderer" : [
578             "function(v,x,r) ",
579             "{ ",
580             "    var vv = (typeof(r.data.evtype_align) != 'undefined' && r.data.evtype_align) ? r.data.evtype_align : v;",
581             "    return String.format('<span qtip=\"{0}\">{1}</span>', v, vv ); ",
582             "}"
583            ],
584            "$ xns" : "Roo.grid",
585            "* prop" : "colModel[]",
586            "dataIndex" : "evtype",
587            "header" : "Method",
588            "sortable" : true,
589            "width" : 70,
590            "xtype" : "ColumnModel"
591           },
592           {
593            "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); }",
594            "$ xns" : "Roo.grid",
595            "* prop" : "colModel[]",
596            "dataIndex" : "act_when",
597            "header" : "Act when",
598            "sortable" : true,
599            "width" : 130,
600            "xtype" : "ColumnModel"
601           },
602           {
603            "$ renderer" : [
604             "function(v,x,r) {",
605             "    if (r.data.event_id *1 == 0) {",
606             "        return '';",
607             "    }",
608             "     return String.format('{0}', v ? v.format('d/M/Y H:i:s') : '');",
609             "  }"
610            ],
611            "$ xns" : "Roo.grid",
612            "* prop" : "colModel[]",
613            "dataIndex" : "sent",
614            "header" : "Sent",
615            "sortable" : true,
616            "width" : 130,
617            "xtype" : "ColumnModel"
618           },
619           {
620            "$ renderer" : "function(v,x,r) { return String.format('{0}:{1}', v,r.data.onid); }",
621            "$ xns" : "Roo.grid",
622            "* prop" : "colModel[]",
623            "dataIndex" : "ontable",
624            "header" : "Ontable",
625            "width" : 150,
626            "xtype" : "ColumnModel"
627           },
628           {
629            "$ renderer" : [
630             "function(v,x,r) {",
631             "",
632             "    var pt = r.data.person_table.toLowerCase() ;",
633             "    var pt = pt.length ? pt : 'person';",
634             "     var ecol = pt + '_id_email' ;",
635             "     var ncol = pt + '_id_name' ;",
636             "     return String.format('{0} <u>&lt;{1}&gt;</u>', r.data[ncol], r.data[ecol]); ",
637             " }"
638            ],
639            "$ xns" : "Roo.grid",
640            "* prop" : "colModel[]",
641            "dataIndex" : "person_id_name",
642            "header" : "Who to notify",
643            "width" : 100,
644            "xtype" : "ColumnModel"
645           },
646           {
647            "$ renderer" : [
648             "function(v,x,r) {",
649             "     return String.format(",
650             "            '{0} : {1} {2}', ",
651             "            r.data.trigger_event_id_on_table, ",
652             "            r.data.trigger_event_id_on_id, ",
653             "            r.data.trigger_event_id_remarks",
654             "        ); ",
655             " }"
656            ],
657            "$ xns" : "Roo.grid",
658            "* prop" : "colModel[]",
659            "dataIndex" : "trigger_event_id",
660            "header" : "Triggered by",
661            "width" : 100,
662            "xtype" : "ColumnModel"
663           },
664           {
665            "$ renderer" : "function(v) { return String.format('{0}', v); }",
666            "$ xns" : "Roo.grid",
667            "* prop" : "colModel[]",
668            "dataIndex" : "msgid",
669            "header" : "Msgid",
670            "width" : 50,
671            "xtype" : "ColumnModel"
672           },
673           {
674            "$ renderer" : "function(v) { return String.format('<span qtip=\"{0}\">{0}</span>', v); }",
675            "$ xns" : "Roo.grid",
676            "* prop" : "colModel[]",
677            "dataIndex" : "event_id_remarks",
678            "header" : "Event",
679            "width" : 300,
680            "xtype" : "ColumnModel"
681           }
682          ],
683          "listeners" : {
684           "|render" : [
685            "function() ",
686            "{",
687            "    _this.grid = this; ",
688            "    //_this.dialog = Pman.Dialog.FILL_IN",
689            "    if (_this.panel.active) {",
690            "       this.footer.onClick('first');",
691            "    }",
692            "}"
693           ]
694          },
695          "loadMask" : true,
696          "xtype" : "Grid"
697         }
698        ],
699        "listeners" : {
700         "|activate" : [
701          "function() {",
702          "    _this.panel = this;",
703          "    if (_this.grid) {",
704          "        _this.grid.footer.onClick('first');",
705          "    }",
706          "    ",
707          "}"
708         ]
709        },
710        "region" : "center",
711        "tableName" : "core_notify",
712        "title" : "Current Notifications",
713        "xtype" : "GridPanel"
714       },
715       {
716        "$ xns" : "Roo",
717        "fitToFrame" : true,
718        "listeners" : {
719         "render" : [
720          "function (_self)",
721          "{",
722          "  _this.viewPanel = _self;",
723          "}"
724         ]
725        },
726        "region" : "south",
727        "xtype" : "ContentPanel"
728       }
729      ],
730      "xtype" : "BorderLayout"
731     }
732    ],
733    "listeners" : {
734     "render" : [
735      "function (_self)",
736      "{",
737      "    _this.nest = this;",
738      "}"
739     ]
740    },
741    "xtype" : "NestedLayoutPanel"
742   }
743  ],
744  "modOrder" : "001",
745  "name" : "Pman.Tab.AdminNotify",
746  "parent" : "Pman.Tab.AdminWatchNotify",
747  "path" : "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminNotify.bjs",
748  "permname" : "",
749  "strings" : {
750   "0f6d01b16d57911731aa44b94dbfefcc" : "Act when",
751   "1243daf593fa297e07ab03bf06d925af" : "Searching...",
752   "12832b4def6eb0b6105b3d11e16066ea" : "Msgid",
753   "12ea1a38991aa3bc4992b10adac0f3bc" : "Event Details",
754   "136fac3c5c5881e0a7d0039e57decd68" : "Select notify type",
755   "24463f10155b8af973300f86302c4fde" : "Who to notify",
756   "478192f02d448c49bc6b7d76818d8483" : "Ontable",
757   "4c3880bb027f159e801041b1021e88e8" : "Method",
758   "5da618e8e4b89c66fe86e32cdafde142" : "From",
759   "7f8c0283f16925caed8e632086b81b9c" : "Sent",
760   "8535bcc0f05358a583bb432bbadf7e0d" : "Select type",
761   "a4ecfc70574394990cf17bd83df499f7" : "Event",
762   "aed6676e8238afe7cf55e3baf2ad72a2" : "Search Subject",
763   "b22e7ea679daf5146f08f477419dd8bd" : "Triggered by",
764   "bf1cb7e2a337a5e2ebf614009cbce9cc" : "Current Notifications",
765   "c956c97343a45cca5d492e70c56daa8e" : "Select person",
766   "dc873ea4b71ca217b0d8d1fdd45854ac" : "id#",
767   "dca4dd744d00b6fe1362ef7825ffdee5" : "No core_notify found",
768   "e12167aa0a7698e6ebc92b4ce3909b53" : "To",
769   "e4b478c05a833569833f9cc63b6c4354" : "Displaying core_notify{0} - {1} of {2}",
770   "f2a6c498fb90ee345d997f888fce3b18" : "Delete",
771   "f821027bade4aa6b7a4191cd1676cf41" : "Show Completed"
772  },
773  "title" : "Pman.Tab.AdminNotify"
774 }