diff options
Diffstat (limited to 'web/app/view/ReportController.js')
-rw-r--r-- | web/app/view/ReportController.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index f8a01bc6..32a44df5 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -40,12 +40,32 @@ Ext.define('Traccar.view.ReportController', { }, store: { '#ReportEvents': { + add: 'loadEvents', load: 'loadEvents' } } } }, + init: function () { + var eventId = Ext.Object.fromQueryString(window.location.search).eventId; + if (eventId) { + this.lookupReference('reportTypeField').setValue('events'); + Ext.getStore('Events').load({ + params: { + id: eventId + }, + callback: function (records, operation, success) { + if (success) { + Ext.getStore('ReportEvents').add(records); + } + } + }); + Traccar.app.hasEventId = true; + Traccar.app.removeUrlParameter('eventId'); + } + }, + hideReports: function () { Traccar.app.showReports(false); }, @@ -214,6 +234,15 @@ Ext.define('Traccar.view.ReportController', { } } }); + } else if (Traccar.app.hasEventId && data.length > 0) { + this.getView().getSelectionModel().select([data[0]], false, true); + this.getView().getView().focusRow(data[0]); + if (Traccar.app.isMobile()) { + Traccar.app.showReports(true); + } else { + this.getView().expand(); + } + Traccar.app.hasEventId = false; } }, |