aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/ReportController.js
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-08-29 17:16:22 +0500
committerAbyss777 <abyss@fox5.ru>2016-08-29 17:16:22 +0500
commit9829184c5f941fd32d9d6c351dbdd113f00d352d (patch)
tree7d5c125f93c381451f1bc1842e176c6968f20751 /web/app/view/ReportController.js
parente65a701cb52ec0b5a32228b4f922cdc1a0a6fd6a (diff)
downloadtraccar-server-9829184c5f941fd32d9d6c351dbdd113f00d352d.tar.gz
traccar-server-9829184c5f941fd32d9d6c351dbdd113f00d352d.tar.bz2
traccar-server-9829184c5f941fd32d9d6c351dbdd113f00d352d.zip
Implemented "Configure" dialog for reports
Diffstat (limited to 'web/app/view/ReportController.js')
-rw-r--r--web/app/view/ReportController.js60
1 files changed, 42 insertions, 18 deletions
diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js
index aeaa1849e..0247c96a9 100644
--- a/web/app/view/ReportController.js
+++ b/web/app/view/ReportController.js
@@ -19,6 +19,10 @@ Ext.define('Traccar.view.ReportController', {
extend: 'Ext.app.ViewController',
alias: 'controller.report',
+ requires: [
+ 'Traccar.view.ReportConfigDialog'
+ ],
+
config: {
listen: {
controller: {
@@ -30,34 +34,53 @@ Ext.define('Traccar.view.ReportController', {
}
},
+ onConfigureClick: function () {
+ var dialog = Ext.create('Traccar.view.ReportConfigDialog');
+ dialog.lookupReference('eventTypeField').setHidden(this.lookupReference('reportTypeField').getValue() !== 'events');
+ dialog.callingPanel = this;
+ dialog.lookupReference('deviceField').setValue(this.deviceId);
+ dialog.lookupReference('groupField').setValue(this.groupId);
+ if (this.eventType !== undefined) {
+ dialog.lookupReference('eventTypeField').setValue(this.eventType);
+ } else {
+ dialog.lookupReference('eventTypeField').setValue(['%']);
+ }
+ if (this.fromDate !== undefined) {
+ dialog.lookupReference('fromDateField').setValue(this.fromDate);
+ }
+ if (this.fromTime !== undefined) {
+ dialog.lookupReference('fromTimeField').setValue(this.fromTime);
+ }
+ if (this.toDate !== undefined) {
+ dialog.lookupReference('toDateField').setValue(this.toDate);
+ }
+ if (this.toTime !== undefined) {
+ dialog.lookupReference('toTimeField').setValue(this.toTime);
+ }
+ dialog.show();
+ },
+
onReportClick: function (button) {
- var reportType, deviceId, fromDate, fromTime, from, toDate, toTime, to, store, url;
+ var reportType, from, to, store, url;
reportType = this.lookupReference('reportTypeField').getValue();
- deviceId = this.lookupReference('deviceField').getValue();
-
- fromDate = this.lookupReference('fromDateField').getValue();
- fromTime = this.lookupReference('fromTimeField').getValue();
-
- if (reportType && deviceId) {
+ if (reportType && (this.deviceId || this.groupId)) {
from = new Date(
- fromDate.getFullYear(), fromDate.getMonth(), fromDate.getDate(),
- fromTime.getHours(), fromTime.getMinutes(), fromTime.getSeconds(), fromTime.getMilliseconds());
-
- toDate = this.lookupReference('toDateField').getValue();
- toTime = this.lookupReference('toTimeField').getValue();
+ this.fromDate.getFullYear(), this.fromDate.getMonth(), this.fromDate.getDate(),
+ this.fromTime.getHours(), this.fromTime.getMinutes(), this.fromTime.getSeconds(), this.fromTime.getMilliseconds());
to = new Date(
- toDate.getFullYear(), toDate.getMonth(), toDate.getDate(),
- toTime.getHours(), toTime.getMinutes(), toTime.getSeconds(), toTime.getMilliseconds());
+ this.toDate.getFullYear(), this.toDate.getMonth(), this.toDate.getDate(),
+ this.toTime.getHours(), this.toTime.getMinutes(), this.toTime.getSeconds(), this.toTime.getMilliseconds());
if (button.reference === "showButton") {
store = this.getView().getStore();
store.load({
params: {
- deviceId: deviceId,
- type: '%',
+ deviceId: this.deviceId,
+ groupId: this.groupId,
+ type: this.eventType,
from: from.toISOString(),
to: to.toISOString()
}
@@ -65,8 +88,9 @@ Ext.define('Traccar.view.ReportController', {
} else if (button.reference === "csvButton") {
url = this.getView().getStore().getProxy().url;
this.downloadCsv(url, {
- deviceId: deviceId,
- type: '%',
+ deviceId: this.deviceId,
+ groupId: this.groupId,
+ type: this.eventType,
from: from.toISOString(),
to: to.toISOString()
});