diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2018-09-30 10:45:28 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2018-09-30 10:45:28 +1300 |
commit | 32a04766f2c42fd575c3aeab6141635fcb53509f (patch) | |
tree | af3de5109a75a5e1873fbbb8372b385e6803e8ec /web/app | |
parent | 648c7684898f0056f0202b6b43ba9f5f11655703 (diff) | |
download | trackermap-web-32a04766f2c42fd575c3aeab6141635fcb53509f.tar.gz trackermap-web-32a04766f2c42fd575c3aeab6141635fcb53509f.tar.bz2 trackermap-web-32a04766f2c42fd575c3aeab6141635fcb53509f.zip |
Option to mail reports
Diffstat (limited to 'web/app')
-rw-r--r-- | web/app/view/Report.js | 5 | ||||
-rw-r--r-- | web/app/view/ReportController.js | 12 |
2 files changed, 12 insertions, 5 deletions
diff --git a/web/app/view/Report.js b/web/app/view/Report.js index f77cfca6..deedb747 100644 --- a/web/app/view/Report.js +++ b/web/app/view/Report.js @@ -63,6 +63,11 @@ Ext.define('Traccar.view.Report', { disabled: true, handler: 'onReportClick' }, { + text: Strings.reportEmail, + reference: 'emailButton', + disabled: true, + handler: 'onReportClick' + }, { text: Strings.reportClear, handler: 'onClearClick' }] diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index 72e7e37e..2cbfcbc6 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -145,6 +145,7 @@ Ext.define('Traccar.view.ReportController', { disabled = !reportType || !devices || !time || this.reportProgress; this.lookupReference('showButton').setDisabled(disabled); this.lookupReference('exportButton').setDisabled(reportType === 'chart' || disabled); + this.lookupReference('emailButton').setDisabled(reportType === 'chart' || disabled); }, onReportClick: function (button) { @@ -187,14 +188,15 @@ Ext.define('Traccar.view.ReportController', { to: to.toISOString() } }); - } else if (button.reference === 'exportButton') { + } else { url = this.getGrid().getStore().getProxy().url; - this.downloadFile(url, { + this.excelReport(url, { deviceId: this.deviceId, groupId: this.groupId, type: this.eventType, from: Ext.Date.format(from, 'c'), - to: Ext.Date.format(to, 'c') + to: Ext.Date.format(to, 'c'), + mail: button.reference === 'emailButton' }); } } @@ -371,7 +373,7 @@ Ext.define('Traccar.view.ReportController', { }); }, - downloadFile: function (requestUrl, requestParams) { + excelReport: function (requestUrl, requestParams) { Ext.Ajax.request({ url: requestUrl, method: 'GET', @@ -384,7 +386,7 @@ Ext.define('Traccar.view.ReportController', { scope: this, callback: function (options, success, response) { var disposition, filename, type, blob, url, downloadUrl; - if (success) { + if (success && !requestParams.mail) { disposition = response.getResponseHeader('Content-Disposition'); filename = disposition.slice(disposition.indexOf('=') + 1, disposition.length); type = response.getResponseHeader('Content-Type'); |