Pman.Tab.AdminLogEvents.bjs
[Pman.Admin] / Pman.Tab.AdminLogEvents.bjs
1 {
2     "name" : "Pman.Tab.AdminLogEvents",
3     "parent" : "Pman.Tab.AdminLogs",
4     "title" : "Admin - Logs - Events",
5     "path" : "/home/edward/gitlive/Pman.Admin/Pman.Tab.AdminLogEvents.bjs",
6     "permname" : "Admin.Logs",
7     "modOrder" : "001",
8     "items" : [
9         {
10             "region" : "center",
11             "title" : "Events",
12             "xtype" : "NestedLayoutPanel",
13             "$ xns" : "Roo",
14             "items" : [
15                 {
16                     "xtype" : "BorderLayout",
17                     "$ xns" : "Roo",
18                     "* prop" : "layout",
19                     "items" : [
20                         {
21                             "xtype" : "LayoutRegion",
22                             "$ xns" : "Roo",
23                             "* prop" : "center"
24                         },
25                         {
26                             "autoScroll" : true,
27                             "xtype" : "LayoutRegion",
28                             "$ xns" : "Roo",
29                             "split" : true,
30                             "height" : 150,
31                             "* prop" : "south"
32                         },
33                         {
34                             "listeners" : {
35                                 "render" : "function (_self)\n{\n  _this.viewPanel = _self;\n}"
36                             },
37                             "fitToFrame" : true,
38                             "region" : "south",
39                             "xtype" : "ContentPanel",
40                             "$ xns" : "Roo"
41                         },
42                         {
43                             "listeners" : {
44                                 "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
45                             },
46                             "region" : "center",
47                             "fitToframe" : true,
48                             "background" : false,
49                             "title" : "Events",
50                             "xtype" : "GridPanel",
51                             "fitContainer" : true,
52                             "$ xns" : "Roo",
53                             "tableName" : "Events",
54                             "items" : [
55                                 {
56                                     "listeners" : {
57                                         "|render" : "function() { \n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
58                                     },
59                                     "autoExpandColumn" : "remarks",
60                                     "xtype" : "Grid",
61                                     "loadMask" : true,
62                                     "$ xns" : "Roo.grid",
63                                     "* prop" : "grid",
64                                     "items" : [
65                                         {
66                                             "listeners" : {
67                                                 "afterselectionchange" : "function (_self)\n{\n    // load detail log in _this.viewPanel;\n    if (!this.getSelected()) {\n        this.viewPanel.setContent(\"Nothing Selected\");\n        return;\n    }\n    var id = this.getSelected().data.id;\n    _this.viewPanel.load( { url : baseURL + \"/Admin/EventView/\" + id + \".html\" });\n    \n}"
68                                             },
69                                             "xtype" : "RowSelectionModel",
70                                             "singleSelect" : true,
71                                             "$ xns" : "Roo.grid",
72                                             "* prop" : "sm"
73                                         },
74                                         {
75                                             "listeners" : {
76                                                 "|beforeload" : "function (_self, o)\n{\n    if (!Pman.buildCompleted) {\n        return false;\n    }\n   \n   \n   if (! _this.personSel) {\n    return false;\n    }\n    o.params = o.params || {};\n    o.params.person_id = _this.personSel.getValue();\n    o.params.person_table = _this.tableSel.getValue();\n    var act = _this.actionSel.getValue();\n    if (act.length) {\n        o.params.action = act;\n    }\n    var tbl = _this.affectSel.getValue();\n    if (tbl.length) {\n        o.params.on_table = tbl;\n    }\n    act = _this.dateFrom.getValue();\n    if (act.format) {\n        o.params['query[from]'] = act.format('Y-m-d');\n    }\n    act = _this.dateTo.getValue();\n    if (act.format) {\n        o.params['query[to]'] = act.format('Y-m-d');\n    }\n \n    \n    /*\n    act = _this.groupedCombo.getValue();\n    o.params['query[grouped]'] = act;\n    if (o.params['query[grouped]'] == 'gr') {\n    \n        if (!tbl.length) {\n            Roo.MessageBox.alert(\"Error\", \"Select a table to group results on\");\n            return false;\n        }\n//        o.params['_columns']  = \n        o.params['_distinct'] = 'on_id';\n        \n        \n    }\n    \n    */\n\n    \n}"
77                                             },
78                                             "xtype" : "Store",
79                                             "remoteSort" : true,
80                                             "$ sortInfo" : "{ field: 'event_when', direction: 'DESC'}",
81                                             "$ xns" : "Roo.data",
82                                             "* prop" : "dataSource",
83                                             "items" : [
84                                                 {
85                                                     "id" : "id",
86                                                     "root" : "data",
87                                                     "xtype" : "JsonReader",
88                                                     "$ xns" : "Roo.data",
89                                                     "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_name',\n        'type': 'string'\n    },\n    {\n        'name': 'event_when',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'action',\n        'type': 'string'\n    },\n    {\n        'name': 'ipaddr',\n        'type': 'string'\n    },\n    {\n        'name': 'on_id',\n        'type': 'int'\n    },\n    {\n        'name': 'on_table',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id',\n        'type': 'int'\n    },\n    {\n        'name': 'remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_role',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_active',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_project_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_by',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_dt',\n        'type': 'date'\n    }\n]",
90                                                     "* prop" : "reader",
91                                                     "totalProperty" : "total"
92                                                 },
93                                                 {
94                                                     "$ url" : "baseURL + '/Roo/Events.php'",
95                                                     "xtype" : "HttpProxy",
96                                                     "method" : "GET",
97                                                     "$ xns" : "Roo.data",
98                                                     "* prop" : "proxy"
99                                                 }
100                                             ]
101                                         },
102                                         {
103                                             "pageSize" : 25,
104                                             "xtype" : "PagingToolbar",
105                                             "emptyMsg" : "No Events found",
106                                             "$ xns" : "Roo",
107                                             "displayInfo" : true,
108                                             "displayMsg" : "Displaying Events  {0} - {1} of {2}",
109                                             "* prop" : "footer",
110                                             "items" : [
111                                                 {
112                                                     "listeners" : {
113                                                         "click" : "function (_self, e)\n{\n    \n    var params = {\n        'sort' : 'event_when',\n        'dir' : 'DESC',\n        'start' : 0,\n        'limit' : 900,\n        person_id : _this.personSel.getValue(), \n        'csvTitles[0]' : 'When',   'csvCols[0]' : 'event_when', \n        'csvTitles[1]' : 'Staff',   'csvCols[1]' : 'person_id_name', \n        'csvTitles[2]' : 'Action',   'csvCols[2]' : 'action', \n        'csvTitles[3]' : 'Record ID',   'csvCols[3]' : 'on_id'       ,\n        'csvTitles[4]' : 'Record Type',   'csvCols[4]' : 'on_table',\n        'csvTitles[5]' : 'Remarks',   'csvCols[5]' : 'remarks'        \n    }\n        \n    params.person_id = _this.personSel.getValue();\n    var act = _this.actionSel.getValue();\n    if (act.length) {\n        params.action = act;\n    }\n    var tbl = _this.affectSel.getValue();\n    if (tbl.length) {\n        params.on_table = tbl;\n    }\n    act = _this.dateFrom.getValue();\n    if (act.format) {\n        params['query[from]'] = act.format('Y-m-d');\n    }\n    act = _this.dateTo.getValue();\n    if (act.format) {\n        params['query[to]'] = act.format('Y-m-d');\n    }\n    params.limit = 9999;\n    \n\n    new Pman.download({\n        url : baseURL + '/Roo/Events.php',\n        params : params ,\n        newWindow: true\n        \n    });\n}"
114                                                     },
115                                                     "text" : "Download to Excel",
116                                                     "xtype" : "Button",
117                                                     "$ xns" : "Roo.Toolbar"
118                                                 }
119                                             ]
120                                         },
121                                         {
122                                             "xtype" : "Toolbar",
123                                             "$ xns" : "Roo",
124                                             "* prop" : "toolbar",
125                                             "items" : [
126                                                 {
127                                                     "text" : "Show",
128                                                     "xtype" : "TextItem",
129                                                     "$ xns" : "Roo.Toolbar"
130                                                 },
131                                                 {
132                                                     "listeners" : {
133                                                         "|render" : "function (_self)\n{\n  _this.tableSel = _self;\n}",
134                                                         "|select" : "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n}"
135                                                     },
136                                                     "listWidth" : 300,
137                                                     "triggerAction" : "all",
138                                                     "forceSelection" : true,
139                                                     "selectOnFocus" : true,
140                                                     "pageSize" : 20,
141                                                     "displayField" : "value",
142                                                     "emptyText" : "Select Person Table",
143                                                     "minChars" : 2,
144                                                     "valueField" : "value",
145                                                     "xtype" : "ComboBox",
146                                                     "allowBlank" : true,
147                                                     "typeAhead" : true,
148                                                     "Boolean alwaysQuery" : true,
149                                                     "editable" : false,
150                                                     "width" : 150,
151                                                     "$ xns" : "Roo.form",
152                                                     "name" : "person_table",
153                                                     "qtip" : "Select Person Table",
154                                                     "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{value}</b> </div>",
155                                                     "loadingText" : "Searching...",
156                                                     "items" : [
157                                                         {
158                                                             "| data" : "(function() { \n\n    if(typeof(uiConfig) == 'undefined' || typeof(uiConfig.events_person_table) == 'undefined' || !uiConfig.events_person_table.length){\n\n        return [];        \n    }\n\n    return uiConfig.events_person_table;\n    \n})()",
159                                                             "xtype" : "SimpleStore",
160                                                             "$ fields" : "[ 'value' ]",
161                                                             "$ xns" : "Roo.data",
162                                                             "* prop" : "store",
163                                                             "isLocal" : true
164                                                         }
165                                                     ]
166                                                 },
167                                                 {
168                                                     "listeners" : {
169                                                         "|render" : "function (_self)\n{\n  _this.personSel = _self;\n}",
170                                                         "|select" : "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n  \n}"
171                                                     },
172                                                     "listWidth" : 600,
173                                                     "triggerAction" : "all",
174                                                     "fieldLabel" : "Person ",
175                                                     "forceSelection" : true,
176                                                     "selectOnFocus" : true,
177                                                     "pageSize" : 20,
178                                                     "displayField" : "name",
179                                                     "emptyText" : "Select Person ",
180                                                     "minChars" : 2,
181                                                     "valueField" : "id",
182                                                     "xtype" : "ComboBox",
183                                                     "allowBlank" : true,
184                                                     "typeAhead" : true,
185                                                     "editable" : true,
186                                                     "width" : 150,
187                                                     "$ xns" : "Roo.form",
188                                                     "name" : "person_id_name",
189                                                     "qtip" : "Select Person ",
190                                                     "queryParam" : "query[name]",
191                                                     "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> ({company_id_name}) &lt;{email}&gt; </div>",
192                                                     "loadingText" : "Searching...",
193                                                     "items" : [
194                                                         {
195                                                             "listeners" : {
196                                                                 "|beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    o.params.company_id = Pman.Login.authUser.company_id;\n}"
197                                                             },
198                                                             "xtype" : "Store",
199                                                             "remoteSort" : true,
200                                                             "$ sortInfo" : "{ field : 'name' , direction : 'ASC' }",
201                                                             "$ xns" : "Roo.data",
202                                                             "* prop" : "store",
203                                                             "items" : [
204                                                                 {
205                                                                     "$ url" : "baseURL + '/Roo/Person.php'",
206                                                                     "method" : "GET",
207                                                                     "xtype" : "HttpProxy",
208                                                                     "$ xns" : "Roo.data",
209                                                                     "* prop" : "proxy"
210                                                                 },
211                                                                 {
212                                                                     "id" : "id",
213                                                                     "root" : "data",
214                                                                     "xtype" : "JsonReader",
215                                                                     "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'name',\n        'type': 'string'\n    },\n    {\n        'name': 'phone',\n        'type': 'string'\n    },\n    {\n        'name': 'fax',\n        'type': 'string'\n    },\n    {\n        'name': 'email',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'role',\n        'type': 'string'\n    },\n    {\n        'name': 'active',\n        'type': 'int'\n    },\n    {\n        'name': 'remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'lang',\n        'type': 'string'\n    },\n    {\n        'name': 'no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id',\n        'type': 'int'\n    },\n    {\n        'name': 'deleted_by',\n        'type': 'int'\n    },\n    {\n        'name': 'deleted_dt',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'office_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'office_id_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'office_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'office_id_address',\n        'type': 'string'\n    },\n    {\n        'name': 'office_id_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'office_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'office_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'office_id_role',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_code',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_address',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_tel',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_isOwner',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_logo_id',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_background_color',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_comptype',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_url',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_main_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_created_by',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_created_dt',\n        'type': 'date'\n    },\n    {\n        'name': 'company_id_updated_by',\n        'type': 'int'\n    },\n    {\n        'name': 'company_id_updated_dt',\n        'type': 'date'\n    },\n    {\n        'name': 'company_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_dispatch_port',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_province',\n        'type': 'string'\n    },\n    {\n        'name': 'company_id_country',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'project_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'project_id_code',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_active',\n        'type': 'int'\n    },\n    {\n        'name': 'project_id_type',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_client_id',\n        'type': 'int'\n    },\n    {\n        'name': 'project_id_team_id',\n        'type': 'int'\n    },\n    {\n        'name': 'project_id_file_location',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_open_date',\n        'type': 'date'\n    },\n    {\n        'name': 'project_id_open_by',\n        'type': 'int'\n    },\n    {\n        'name': 'project_id_close_date',\n        'type': 'date'\n    },\n    {\n        'name': 'project_id_countries',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_languages',\n        'type': 'string'\n    },\n    {\n        'name': 'project_id_agency_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_role',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_active',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'owner_id_project_id',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_deleted_by',\n        'type': 'int'\n    },\n    {\n        'name': 'owner_id_deleted_dt',\n        'type': 'date'\n    }\n]",
216                                                                     "$ xns" : "Roo.data",
217                                                                     "* prop" : "reader",
218                                                                     "totalProperty" : "total"
219                                                                 }
220                                                             ]
221                                                         }
222                                                     ]
223                                                 },
224                                                 {
225                                                     "listeners" : {
226                                                         "|render" : "function (_self)\n{\n  _this.actionSel = _self;\n}",
227                                                         "|select" : "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n}"
228                                                     },
229                                                     "listWidth" : 300,
230                                                     "triggerAction" : "all",
231                                                     "forceSelection" : true,
232                                                     "selectOnFocus" : true,
233                                                     "pageSize" : 20,
234                                                     "displayField" : "action",
235                                                     "emptyText" : "Select Action",
236                                                     "minChars" : 2,
237                                                     "valueField" : "action",
238                                                     "xtype" : "ComboBox",
239                                                     "allowBlank" : true,
240                                                     "typeAhead" : true,
241                                                     "editable" : true,
242                                                     "width" : 150,
243                                                     "$ xns" : "Roo.form",
244                                                     "name" : "action",
245                                                     "qtip" : "Select Action",
246                                                     "queryParam" : "query[action]",
247                                                     "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{action}</b> </div>",
248                                                     "loadingText" : "Searching...",
249                                                     "items" : [
250                                                         {
251                                                             "listeners" : {
252                                                                 "|beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    // staff can see all logs, other companies can only see their own.\n    if (Pman.Login.authUser.company_id_comptype != 'OWNER') {\n        o.params.company_id = Pman.Login.authUser.company_id;\n    }\n    o.params._distinct = 'action';\n    o.params._columns ='action';\n}"
253                                                             },
254                                                             "xtype" : "Store",
255                                                             "remoteSort" : true,
256                                                             "$ sortInfo" : "{ field : 'action' , direction : 'ASC' }",
257                                                             "$ xns" : "Roo.data",
258                                                             "* prop" : "store",
259                                                             "items" : [
260                                                                 {
261                                                                     "$ url" : "baseURL + '/Roo/Events.php'",
262                                                                     "method" : "GET",
263                                                                     "xtype" : "HttpProxy",
264                                                                     "$ xns" : "Roo.data",
265                                                                     "* prop" : "proxy"
266                                                                 },
267                                                                 {
268                                                                     "id" : "id",
269                                                                     "root" : "data",
270                                                                     "xtype" : "JsonReader",
271                                                                     "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_name',\n        'type': 'string'\n    },\n    {\n        'name': 'event_when',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'action',\n        'type': 'string'\n    },\n    {\n        'name': 'ipaddr',\n        'type': 'string'\n    },\n    {\n        'name': 'on_id',\n        'type': 'int'\n    },\n    {\n        'name': 'on_table',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id',\n        'type': 'int'\n    },\n    {\n        'name': 'remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_role',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_active',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_project_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_by',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_dt',\n        'type': 'date'\n    }\n]",
272                                                                     "$ xns" : "Roo.data",
273                                                                     "* prop" : "reader",
274                                                                     "totalProperty" : "total"
275                                                                 }
276                                                             ]
277                                                         }
278                                                     ]
279                                                 },
280                                                 {
281                                                     "listeners" : {
282                                                         "|render" : "function (_self)\n{\n  _this.affectSel = _self;\n}",
283                                                         "|select" : "function (combo, record, index)\n{\n  _this.grid.footer.onClick('first');\n}"
284                                                     },
285                                                     "listWidth" : 300,
286                                                     "triggerAction" : "all",
287                                                     "forceSelection" : true,
288                                                     "selectOnFocus" : true,
289                                                     "pageSize" : 20,
290                                                     "displayField" : "on_table",
291                                                     "emptyText" : "Select Affects",
292                                                     "minChars" : 2,
293                                                     "valueField" : "action",
294                                                     "xtype" : "ComboBox",
295                                                     "allowBlank" : true,
296                                                     "typeAhead" : true,
297                                                     "editable" : true,
298                                                     "width" : 150,
299                                                     "$ xns" : "Roo.form",
300                                                     "name" : "on_table",
301                                                     "qtip" : "Select Action",
302                                                     "queryParam" : "query[on_table]",
303                                                     "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{on_table}</b> </div>",
304                                                     "loadingText" : "Searching...",
305                                                     "items" : [
306                                                         {
307                                                             "listeners" : {
308                                                                 "|beforeload" : "function (_self, o)\n{\n    o.params = o.params || {};\n    // staff can see all logs, other companies can only see their own.\n    if (Pman.Login.authUser.company_id_comptype != 'OWNER') {\n        o.params.company_id = Pman.Login.authUser.company_id;\n    }\n    o.params._distinct = 'on_table';\n    o.params._columns ='on_table';\n}"
309                                                             },
310                                                             "xtype" : "Store",
311                                                             "remoteSort" : true,
312                                                             "$ sortInfo" : "{ field : 'on_table' , direction : 'ASC' }",
313                                                             "$ xns" : "Roo.data",
314                                                             "* prop" : "store",
315                                                             "items" : [
316                                                                 {
317                                                                     "$ url" : "baseURL + '/Roo/Events.php'",
318                                                                     "method" : "GET",
319                                                                     "xtype" : "HttpProxy",
320                                                                     "$ xns" : "Roo.data",
321                                                                     "* prop" : "proxy"
322                                                                 },
323                                                                 {
324                                                                     "id" : "id",
325                                                                     "root" : "data",
326                                                                     "xtype" : "JsonReader",
327                                                                     "$ xns" : "Roo.data",
328                                                                     "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_name',\n        'type': 'string'\n    },\n    {\n        'name': 'event_when',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'action',\n        'type': 'string'\n    },\n    {\n        'name': 'ipaddr',\n        'type': 'string'\n    },\n    {\n        'name': 'on_id',\n        'type': 'int'\n    },\n    {\n        'name': 'on_table',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id',\n        'type': 'int'\n    },\n    {\n        'name': 'remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_office_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_name',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_phone',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_fax',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_email',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_company_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_role',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_active',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_remarks',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_passwd',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_owner_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_lang',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_no_reset_sent',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_action_type',\n        'type': 'string'\n    },\n    {\n        'name': 'person_id_project_id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_by',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id_deleted_dt',\n        'type': 'date'\n    }\n]",
329                                                                     "* prop" : "reader",
330                                                                     "totalProperty" : "total"
331                                                                 }
332                                                             ]
333                                                         }
334                                                     ]
335                                                 },
336                                                 {
337                                                     "text" : "Date Range",
338                                                     "xtype" : "TextItem",
339                                                     "$ xns" : "Roo.Toolbar"
340                                                 },
341                                                 {
342                                                     "listeners" : {
343                                                         "render" : "function (_self)\n{\n  _this.dateFrom = _self;\n}",
344                                                         "change" : "function (_self, newValue, oldValue)\n{\n  _this.grid.footer.onClick('first');\n}"
345                                                     },
346                                                     "format" : "Y-m-d",
347                                                     "xtype" : "DateField",
348                                                     "$ xns" : "Roo.form"
349                                                 },
350                                                 {
351                                                     "listeners" : {
352                                                         "render" : "function (_self)\n{\n  _this.dateTo = _self;\n}",
353                                                         "change" : "function (_self, newValue, oldValue)\n{\n  _this.grid.footer.onClick('first');\n}"
354                                                     },
355                                                     "format" : "Y-m-d",
356                                                     "xtype" : "DateField",
357                                                     "$ xns" : "Roo.form"
358                                                 }
359                                             ]
360                                         },
361                                         {
362                                             "xtype" : "ColumnModel",
363                                             "width" : 100,
364                                             "header" : "When",
365                                             "$ renderer" : "function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; }",
366                                             "$ xns" : "Roo.grid",
367                                             "* prop" : "colModel[]",
368                                             "dataIndex" : "event_when"
369                                         },
370                                         {
371                                             "xtype" : "ColumnModel",
372                                             "width" : 100,
373                                             "header" : "#id",
374                                             "$ xns" : "Roo.grid",
375                                             "* prop" : "colModel[]",
376                                             "dataIndex" : "id"
377                                         },
378                                         {
379                                             "xtype" : "ColumnModel",
380                                             "width" : 150,
381                                             "header" : "Staff",
382                                             "$ renderer" : "function(v,x,r) { \n    \n    var efield = typeof(_this.email_field) == 'undefined' ? 'person_id_email' : _this.email_field;\n    var nfield = typeof(_this.name_field) == 'undefined' ? 'person_id_name' : _this.name_field;    \n    \n    //Roo.log([r, efield, nfield]);\n    \n    var email = r.json[efield]; // ? r.data.person_id_email : r.data.person_id_email;\n    var name  = r.json[nfield]; // ? r.data.person_id_name : r.data.person_id_name;    \n    return String.format('{0} &lt;<a href=\"mailto:{1}\">{1}</a>&gt;', \n        name, email); \n\n\n}",
383                                             "$ xns" : "Roo.grid",
384                                             "* prop" : "colModel[]",
385                                             "dataIndex" : "person_id_name"
386                                         },
387                                         {
388                                             "xtype" : "ColumnModel",
389                                             "header" : "Action",
390                                             "width" : 100,
391                                             "$ renderer" : "function(v) { return String.format('{0}', v); }",
392                                             "$ xns" : "Roo.grid",
393                                             "* prop" : "colModel[]",
394                                             "dataIndex" : "action"
395                                         },
396                                         {
397                                             "xtype" : "ColumnModel",
398                                             "header" : "IP",
399                                             "width" : 100,
400                                             "$ renderer" : "function(v) { return String.format('{0}', v); }",
401                                             "$ xns" : "Roo.grid",
402                                             "* prop" : "colModel[]",
403                                             "dataIndex" : "ipaddr"
404                                         },
405                                         {
406                                             "xtype" : "ColumnModel",
407                                             "width" : 100,
408                                             "header" : "Affected",
409                                             "$ renderer" : "function(v, x, r) {                     \n            return v ? String.format('{0}({1})', v,  r.data.on_id)  : '';  \n   }",
410                                             "$ xns" : "Roo.grid",
411                                             "* prop" : "colModel[]",
412                                             "dataIndex" : "on_table"
413                                         },
414                                         {
415                                             "xtype" : "ColumnModel",
416                                             "width" : 300,
417                                             "header" : "Remarks",
418                                             "$ renderer" : "function(v) { return String.format('<span qtip=\"{1}\">{0}</span>', v, Roo.util.Format.htmlEncode(v)); }",
419                                             "$ xns" : "Roo.grid",
420                                             "* prop" : "colModel[]",
421                                             "dataIndex" : "remarks"
422                                         }
423                                     ]
424                                 }
425                             ]
426                         }
427                     ]
428                 }
429             ]
430         }
431     ]
432 }