aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-09-30 10:45:28 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2018-09-30 10:45:28 +1300
commit32a04766f2c42fd575c3aeab6141635fcb53509f (patch)
treeaf3de5109a75a5e1873fbbb8372b385e6803e8ec /web
parent648c7684898f0056f0202b6b43ba9f5f11655703 (diff)
downloadetbsa-traccar-web-32a04766f2c42fd575c3aeab6141635fcb53509f.tar.gz
etbsa-traccar-web-32a04766f2c42fd575c3aeab6141635fcb53509f.tar.bz2
etbsa-traccar-web-32a04766f2c42fd575c3aeab6141635fcb53509f.zip
Option to mail reports
Diffstat (limited to 'web')
-rw-r--r--web/app/view/Report.js5
-rw-r--r--web/app/view/ReportController.js12
-rw-r--r--web/l10n/en.json1
3 files changed, 13 insertions, 5 deletions
diff --git a/web/app/view/Report.js b/web/app/view/Report.js
index f77cfca..deedb74 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 72e7e37..2cbfcbc 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');
diff --git a/web/l10n/en.json b/web/l10n/en.json
index 05e0d1b..12305b6 100644
--- a/web/l10n/en.json
+++ b/web/l10n/en.json
@@ -372,6 +372,7 @@
"reportChartType": "Chart Type",
"reportShowMarkers": "Show Markers",
"reportExport": "Export",
+ "reportEmail": "Email Report",
"reportPeriod": "Period",
"reportCustom": "Custom",
"reportToday": "Today",