diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-12-02 18:46:55 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-02 18:46:55 +1300 |
commit | f8bf7ede29f2e063a30721e8ed415a6184646424 (patch) | |
tree | 43259e48230270edaed0a1981e8ef975508c9831 /web/app/view/ReportController.js | |
parent | 6d447219ceab19c368b7ca6efabca83001b64a04 (diff) | |
parent | ea09b2e85e014d438084a454fae7c0cce57d9773 (diff) | |
download | etbsa-traccar-web-f8bf7ede29f2e063a30721e8ed415a6184646424.tar.gz etbsa-traccar-web-f8bf7ede29f2e063a30721e8ed415a6184646424.tar.bz2 etbsa-traccar-web-f8bf7ede29f2e063a30721e8ed415a6184646424.zip |
Merge pull request #347 from Abyss777/handle_eventid
Handle eventId url parameter
Diffstat (limited to 'web/app/view/ReportController.js')
-rw-r--r-- | web/app/view/ReportController.js | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index f8a01bc..1f3f3a2 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -32,7 +32,8 @@ Ext.define('Traccar.view.ReportController', { listen: { controller: { '*': { - selectdevice: 'selectDevice' + selectdevice: 'selectDevice', + showsingleevent: 'showSingleEvent' }, 'map': { selectreport: 'selectReport' @@ -40,6 +41,7 @@ Ext.define('Traccar.view.ReportController', { }, store: { '#ReportEvents': { + add: 'loadEvents', load: 'loadEvents' } } @@ -208,15 +210,43 @@ Ext.define('Traccar.view.ReportController', { params: { id: positionIds }, + scope: this, callback: function (records, operation, success) { if (success) { Ext.getStore('ReportRoute').add(records); + if (records.length === 1) { + this.fireEvent('selectreport', records[0], false); + } } } }); } }, + showSingleEvent: function (eventId) { + this.lookupReference('reportTypeField').setValue('events'); + Ext.getStore('Events').load({ + id: eventId, + scope: this, + callback: function (records, operation, success) { + if (success) { + Ext.getStore('ReportEvents').add(records); + if (records.length > 0) { + if (!records[0].get('positionId')) { + if (Traccar.app.isMobile()) { + Traccar.app.showReports(true); + } else { + this.getView().expand(); + } + } + this.getView().getSelectionModel().select([records[0]], false, true); + this.getView().getView().focusRow(records[0]); + } + } + } + }); + }, + downloadFile: function (requestUrl, requestParams) { Ext.Ajax.request({ url: requestUrl, |