aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/ReportController.js
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-12-01 17:30:50 +0500
committerAbyss777 <abyss@fox5.ru>2016-12-01 17:30:50 +0500
commit42574b6700384bd8a45d3410c4f8da644dad112e (patch)
tree6ada5763c1aea05441b02efe82ff038517cd5897 /web/app/view/ReportController.js
parent74072cf3ca6acf67d228287e446e3013277e7408 (diff)
downloadtrackermap-web-42574b6700384bd8a45d3410c4f8da644dad112e.tar.gz
trackermap-web-42574b6700384bd8a45d3410c4f8da644dad112e.tar.bz2
trackermap-web-42574b6700384bd8a45d3410c4f8da644dad112e.zip
Implement in other way
Diffstat (limited to 'web/app/view/ReportController.js')
-rw-r--r--web/app/view/ReportController.js55
1 files changed, 26 insertions, 29 deletions
diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js
index 32a44df5..e1a64e69 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'
@@ -47,25 +48,6 @@ Ext.define('Traccar.view.ReportController', {
}
},
- 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);
},
@@ -234,18 +216,33 @@ 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;
}
},
+ 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,