1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Roo.namespace('Pman.Tab');
7 Pman.Tab.AdminLogEvents = new Roo.XComponent({
8 part : ["Admin", "LogEvents" ],
9 order : '001-Pman.Tab.AdminLogEvents',
11 parent : 'Pman.Tab.AdminLogs',
12 name : "Admin - Logs - Events",
14 permname : 'Admin.Logs',
23 xtype : 'LayoutRegion',
29 xtype : 'LayoutRegion',
35 xtype : 'BorderLayout',
42 xtype : 'ContentPanel',
45 render : function (_self)
47 _this.viewPanel = _self;
55 xtype : 'RowSelectionModel',
59 afterselectionchange : function (_self)
61 // load detail log in _this.viewPanel;
62 if (!this.getSelected()) {
63 this.viewPanel.setContent("Nothing Selected");
66 var id = this.getSelected().data.id;
67 _this.viewPanel.load( { url : baseURL + "/Admin/EventView/" + id + ".html" });
85 'name': 'person_name',
118 'name': 'person_id_id',
122 'name': 'person_id_office_id',
126 'name': 'person_id_name',
130 'name': 'person_id_phone',
134 'name': 'person_id_fax',
138 'name': 'person_id_email',
142 'name': 'person_id_company_id',
146 'name': 'person_id_role',
150 'name': 'person_id_active',
154 'name': 'person_id_remarks',
158 'name': 'person_id_passwd',
162 'name': 'person_id_owner_id',
166 'name': 'person_id_lang',
170 'name': 'person_id_no_reset_sent',
174 'name': 'person_id_action_type',
178 'name': 'person_id_project_id',
182 'name': 'person_id_deleted_by',
186 'name': 'person_id_deleted_dt',
190 totalProperty : 'total'
194 url : baseURL + '/Roo/Events.php',
202 sortInfo : { field: 'event_when', direction: 'DESC'},
205 beforeload : function (_self, o)
207 if (!Pman.buildCompleted) {
212 if (! _this.personSel) {
215 o.params = o.params || {};
216 o.params.person_id = _this.personSel.getValue();
217 var act = _this.actionSel.getValue();
219 o.params.action = act;
221 var tbl = _this.affectSel.getValue();
223 o.params.on_table = tbl;
225 act = _this.dateFrom.getValue();
227 o.params['query[from]'] = act.format('Y-m-d');
229 act = _this.dateTo.getValue();
231 o.params['query[to]'] = act.format('Y-m-d');
236 act = _this.groupedCombo.getValue();
237 o.params['query[grouped]'] = act;
238 if (o.params['query[grouped]'] == 'gr') {
241 Roo.MessageBox.alert("Error", "Select a table to group results on");
244 // o.params['_columns'] =
245 o.params['_distinct'] = 'on_id';
263 xtype : 'PagingToolbar',
264 emptyMsg : "No Events found",
267 displayMsg : "Displaying Events {0} - {1} of {2}",
270 '|xns' : 'Roo.Toolbar',
271 text : "Download to Excel",
275 click : function (_self, e)
279 'sort' : 'event_when',
283 person_id : _this.personSel.getValue(),
284 'csvTitles[0]' : 'When', 'csvCols[0]' : 'event_when',
285 'csvTitles[1]' : 'Staff', 'csvCols[1]' : 'person_id_name',
286 'csvTitles[2]' : 'Action', 'csvCols[2]' : 'action',
287 'csvTitles[3]' : 'Record ID', 'csvCols[3]' : 'on_id' ,
288 'csvTitles[4]' : 'Record Type', 'csvCols[4]' : 'on_table',
289 'csvTitles[5]' : 'Remarks', 'csvCols[5]' : 'remarks'
292 params.person_id = _this.personSel.getValue();
293 var act = _this.actionSel.getValue();
297 var tbl = _this.affectSel.getValue();
299 params.on_table = tbl;
301 act = _this.dateFrom.getValue();
303 params['query[from]'] = act.format('Y-m-d');
305 act = _this.dateTo.getValue();
307 params['query[to]'] = act.format('Y-m-d');
313 url : baseURL + '/Roo/Events.php',
330 '|xns' : 'Roo.Toolbar',
340 [ 'ALL', 'All Transactions' ],
341 [ 'UNPOSTED', 'Unposted' ],
342 [ 'POSTED', 'Posted' ],
343 [ 'VOIDED', 'Voided' ],
344 [ '--', '-----------------' ]
346 var c = baseURL.split('/').pop().split('.').shift();
347 Roo.each(uiConfig.xtuple_offices, function(o) {
351 ret.push( [ 'office-' + o, "Transfers from " + Pman.Xtuple.offices[o] ] );
359 xtype : 'SimpleStore',
360 fields : [ 'code', 'title' ],
366 triggerAction : 'all',
367 forceSelection : true,
368 selectOnFocus : true,
370 displayField : 'title',
371 emptyText : "Select Person table",
382 qtip : "Select Action",
383 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{title}</b> </div>',
384 loadingText : "Searching...",
386 render : function (_self)
388 _this.tableSel = _self;
390 select : function (combo, record, index)
392 _this.grid.footer.onClick('first');
404 url : baseURL + '/Roo/Person.php',
413 xtype : 'JsonReader',
440 'name': 'company_id',
468 'name': 'no_reset_sent',
472 'name': 'action_type',
476 'name': 'project_id',
480 'name': 'deleted_by',
484 'name': 'deleted_dt',
486 'dateFormat': 'Y-m-d'
489 'name': 'office_id_id',
493 'name': 'office_id_company_id',
497 'name': 'office_id_name',
501 'name': 'office_id_address',
505 'name': 'office_id_phone',
509 'name': 'office_id_fax',
513 'name': 'office_id_email',
517 'name': 'office_id_role',
521 'name': 'company_id_code',
525 'name': 'company_id_name',
529 'name': 'company_id_remarks',
533 'name': 'company_id_owner_id',
537 'name': 'company_id_address',
541 'name': 'company_id_tel',
545 'name': 'company_id_fax',
549 'name': 'company_id_email',
553 'name': 'company_id_id',
557 'name': 'company_id_isOwner',
561 'name': 'company_id_logo_id',
565 'name': 'company_id_background_color',
569 'name': 'company_id_comptype',
573 'name': 'company_id_url',
577 'name': 'company_id_main_office_id',
581 'name': 'company_id_created_by',
585 'name': 'company_id_created_dt',
589 'name': 'company_id_updated_by',
593 'name': 'company_id_updated_dt',
597 'name': 'company_id_passwd',
601 'name': 'company_id_dispatch_port',
605 'name': 'company_id_province',
609 'name': 'company_id_country',
613 'name': 'project_id_id',
617 'name': 'project_id_name',
621 'name': 'project_id_remarks',
625 'name': 'project_id_owner_id',
629 'name': 'project_id_code',
633 'name': 'project_id_active',
637 'name': 'project_id_type',
641 'name': 'project_id_client_id',
645 'name': 'project_id_team_id',
649 'name': 'project_id_file_location',
653 'name': 'project_id_open_date',
657 'name': 'project_id_open_by',
661 'name': 'project_id_close_date',
665 'name': 'project_id_countries',
669 'name': 'project_id_languages',
673 'name': 'project_id_agency_id',
677 'name': 'owner_id_id',
681 'name': 'owner_id_office_id',
685 'name': 'owner_id_name',
689 'name': 'owner_id_phone',
693 'name': 'owner_id_fax',
697 'name': 'owner_id_email',
701 'name': 'owner_id_company_id',
705 'name': 'owner_id_role',
709 'name': 'owner_id_active',
713 'name': 'owner_id_remarks',
717 'name': 'owner_id_passwd',
721 'name': 'owner_id_owner_id',
725 'name': 'owner_id_lang',
729 'name': 'owner_id_no_reset_sent',
733 'name': 'owner_id_action_type',
737 'name': 'owner_id_project_id',
741 'name': 'owner_id_deleted_by',
745 'name': 'owner_id_deleted_dt',
750 totalProperty : 'total'
755 sortInfo : { field : 'name' , direction : 'ASC' },
758 beforeload : function (_self, o)
760 o.params = o.params || {};
761 o.params.company_id = Pman.Login.authUser.company_id;
771 triggerAction : 'all',
772 fieldLabel : 'Person ',
773 forceSelection : true,
774 selectOnFocus : true,
776 displayField : 'name',
777 emptyText : "Select Person ",
786 name : 'person_id_name',
787 qtip : "Select Person ",
788 queryParam : 'query[name]',
789 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> ({company_id_name}) <{email}> </div>',
790 loadingText : "Searching...",
792 render : function (_self)
794 _this.personSel = _self;
796 select : function (combo, record, index)
798 _this.grid.footer.onClick('first');
811 url : baseURL + '/Roo/Events.php',
820 xtype : 'JsonReader',
827 'name': 'person_name',
831 'name': 'event_when',
833 'dateFormat': 'Y-m-d'
860 'name': 'person_id_id',
864 'name': 'person_id_office_id',
868 'name': 'person_id_name',
872 'name': 'person_id_phone',
876 'name': 'person_id_fax',
880 'name': 'person_id_email',
884 'name': 'person_id_company_id',
888 'name': 'person_id_role',
892 'name': 'person_id_active',
896 'name': 'person_id_remarks',
900 'name': 'person_id_passwd',
904 'name': 'person_id_owner_id',
908 'name': 'person_id_lang',
912 'name': 'person_id_no_reset_sent',
916 'name': 'person_id_action_type',
920 'name': 'person_id_project_id',
924 'name': 'person_id_deleted_by',
928 'name': 'person_id_deleted_dt',
933 totalProperty : 'total'
938 sortInfo : { field : 'action' , direction : 'ASC' },
941 beforeload : function (_self, o)
943 o.params = o.params || {};
944 // staff can see all logs, other companies can only see their own.
945 if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
946 o.params.company_id = Pman.Login.authUser.company_id;
948 o.params._distinct = 'action';
949 o.params._columns ='action';
959 triggerAction : 'all',
960 forceSelection : true,
961 selectOnFocus : true,
963 displayField : 'action',
964 emptyText : "Select Action",
966 valueField : 'action',
974 qtip : "Select Action",
975 queryParam : 'query[action]',
976 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{action}</b> </div>',
977 loadingText : "Searching...",
979 render : function (_self)
981 _this.actionSel = _self;
983 select : function (combo, record, index)
985 _this.grid.footer.onClick('first');
997 url : baseURL + '/Roo/Events.php',
1003 '|xns' : 'Roo.data',
1006 xtype : 'JsonReader',
1014 'name': 'person_name',
1018 'name': 'event_when',
1020 'dateFormat': 'Y-m-d'
1039 'name': 'person_id',
1047 'name': 'person_id_id',
1051 'name': 'person_id_office_id',
1055 'name': 'person_id_name',
1059 'name': 'person_id_phone',
1063 'name': 'person_id_fax',
1067 'name': 'person_id_email',
1071 'name': 'person_id_company_id',
1075 'name': 'person_id_role',
1079 'name': 'person_id_active',
1083 'name': 'person_id_remarks',
1087 'name': 'person_id_passwd',
1091 'name': 'person_id_owner_id',
1095 'name': 'person_id_lang',
1099 'name': 'person_id_no_reset_sent',
1103 'name': 'person_id_action_type',
1107 'name': 'person_id_project_id',
1111 'name': 'person_id_deleted_by',
1115 'name': 'person_id_deleted_dt',
1119 totalProperty : 'total'
1121 '|xns' : 'Roo.data',
1124 sortInfo : { field : 'on_table' , direction : 'ASC' },
1127 beforeload : function (_self, o)
1129 o.params = o.params || {};
1130 // staff can see all logs, other companies can only see their own.
1131 if (Pman.Login.authUser.company_id_comptype != 'OWNER') {
1132 o.params.company_id = Pman.Login.authUser.company_id;
1134 o.params._distinct = 'on_table';
1135 o.params._columns ='on_table';
1143 '|xns' : 'Roo.form',
1145 triggerAction : 'all',
1146 forceSelection : true,
1147 selectOnFocus : true,
1149 displayField : 'on_table',
1150 emptyText : "Select Affects",
1152 valueField : 'action',
1160 qtip : "Select Action",
1161 queryParam : 'query[on_table]',
1162 tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{on_table}</b> </div>',
1163 loadingText : "Searching...",
1165 render : function (_self)
1167 _this.affectSel = _self;
1169 select : function (combo, record, index)
1171 _this.grid.footer.onClick('first');
1180 '|xns' : 'Roo.Toolbar',
1181 text : "Date Range",
1186 '|xns' : 'Roo.form',
1188 xtype : 'DateField',
1191 render : function (_self)
1193 _this.dateFrom = _self;
1195 change : function (_self, newValue, oldValue)
1197 _this.grid.footer.onClick('first');
1202 '|xns' : 'Roo.form',
1204 xtype : 'DateField',
1207 render : function (_self)
1209 _this.dateTo = _self;
1211 change : function (_self, newValue, oldValue)
1213 _this.grid.footer.onClick('first');
1220 '|xns' : 'Roo.grid',
1221 autoExpandColumn : 'remarks',
1227 '|xns' : 'Roo.grid',
1228 xtype : 'ColumnModel',
1231 renderer : function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; },
1233 dataIndex : 'event_when'
1236 '|xns' : 'Roo.grid',
1237 xtype : 'ColumnModel',
1244 '|xns' : 'Roo.grid',
1245 xtype : 'ColumnModel',
1248 renderer : function(v,x,r) {
1250 var efield = typeof(_this.email_field) == 'undefined' ? 'person_id_email' : _this.email_field;
1251 var nfield = typeof(_this.name_field) == 'undefined' ? 'person_id_name' : _this.name_field;
1253 Roo.log([r, efield, nfield]);
1255 var email = r.json[efield]; // ? r.data.person_id_email : r.data.person_id_email;
1256 var name = r.json[nfield]; // ? r.data.person_id_name : r.data.person_id_name;
1257 return String.format('{0} <<a href="mailto:{1}">{1}</a>>',
1263 dataIndex : 'person_id_name'
1266 '|xns' : 'Roo.grid',
1267 xtype : 'ColumnModel',
1270 renderer : function(v) { return String.format('{0}', v); },
1272 dataIndex : 'action'
1275 '|xns' : 'Roo.grid',
1276 xtype : 'ColumnModel',
1279 renderer : function(v) { return String.format('{0}', v); },
1281 dataIndex : 'ipaddr'
1284 '|xns' : 'Roo.grid',
1285 xtype : 'ColumnModel',
1286 header : 'Affected',
1288 renderer : function(v, x, r) {
1289 return v ? String.format('{0}({1})', v, r.data.on_id) : '';
1292 dataIndex : 'on_table'
1295 '|xns' : 'Roo.grid',
1296 xtype : 'ColumnModel',
1299 renderer : function(v) { return String.format('<span qtip="{1}">{0}</span>', v, Roo.util.Format.htmlEncode(v)); },
1301 dataIndex : 'remarks'
1305 render : function() {
1307 //_this.dialog = Pman.Dialog.FILL_IN
1308 if (_this.panel.active) {
1309 this.footer.onClick('first');
1323 xtype : 'GridPanel',
1324 fitContainer : true,
1326 tableName : 'Events',
1328 activate : function() {
1331 _this.grid.footer.onClick('first');
1345 xtype : 'NestedLayoutPanel',