From 6dfee3947ef96e1092b668ecfc7c58037355ffb8 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 20 May 2015 16:57:21 +1200 Subject: Implement position report loading --- web/app/view/report/Report.js | 23 +++++++++++++++++------ web/app/view/report/ReportController.js | 29 ++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 7 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/report/Report.js b/web/app/view/report/Report.js index d39513873..a8b191ef1 100644 --- a/web/app/view/report/Report.js +++ b/web/app/view/report/Report.js @@ -32,6 +32,7 @@ Ext.define('Traccar.view.report.Report', { html: strings.report_device }, { xtype: 'combobox', + reference: 'deviceField', store: 'Devices', valueField: 'id', displayField: 'name', @@ -41,22 +42,32 @@ Ext.define('Traccar.view.report.Report', { xtype: 'tbtext', html: strings.report_from }, { - xtype: 'datefield' + xtype: 'datefield', + reference: 'fromDateField', + value: new Date() }, { xtype: 'timefield', - maxWidth: styles.report_time + reference: 'fromTimeField', + maxWidth: styles.report_time, + value: new Date() }, '-', { xtype: 'tbtext', html: strings.report_to }, { - xtype: 'datefield' + xtype: 'datefield', + reference: 'toDateField', + value: new Date() }, { xtype: 'timefield', - maxWidth: styles.report_time + reference: 'toTimeField', + maxWidth: styles.report_time, + value: new Date() }, '-', { - text: strings.report_show + text: strings.report_show, + handler: 'onShowClick' }, { - text: strings.report_clear + text: strings.report_clear, + handler: 'onClearClick' }], columns: [ diff --git a/web/app/view/report/ReportController.js b/web/app/view/report/ReportController.js index 92fd1ba7e..48cfda74f 100644 --- a/web/app/view/report/ReportController.js +++ b/web/app/view/report/ReportController.js @@ -18,7 +18,34 @@ Ext.define('Traccar.view.report.ReportController', { extend: 'Ext.app.ViewController', alias: 'controller.report', - onSelectionChange: function(selected) { + onShowClick: function() { + + var deviceId = this.lookupReference('deviceField').getValue(); + var fromDate = this.lookupReference('fromDateField').getValue(); + var fromTime = this.lookupReference('fromTimeField').getValue(); + + var from = new Date( + fromDate.getYear(), fromDate.getMonth(), fromDate.getDay(), + fromTime.getHours(), fromTime.getMinutes(), fromTime.getSeconds(), fromTime.getMilliseconds()); + + var toDate = this.lookupReference('toDateField').getValue(); + var toTime = this.lookupReference('toTimeField').getValue(); + + var to = new Date( + toDate.getYear(), toDate.getMonth(), toDate.getDay(), + toTime.getHours(), toTime.getMinutes(), toTime.getSeconds(), toTime.getMilliseconds()); + + var store = Ext.getStore('Positions'); + store.load({ + params:{ + deviceId: deviceId, + from: from, + to: to + } + }); + }, + + onClearClick: function() { } }); -- cgit v1.2.3