aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/ReportController.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view/ReportController.js')
-rw-r--r--web/app/view/ReportController.js32
1 files changed, 31 insertions, 1 deletions
diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js
index f8a01bc6..1f3f3a2a 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,