diff options
-rw-r--r-- | web/app/Application.js | 6 | ||||
-rw-r--r-- | web/app/Resources.js | 14 | ||||
-rw-r--r-- | web/app/model/Position.js | 37 | ||||
-rw-r--r-- | web/app/store/Devices.js | 8 | ||||
-rw-r--r-- | web/app/store/Positions.js | 29 | ||||
-rw-r--r-- | web/app/view/device/Device.js | 3 | ||||
-rw-r--r-- | web/app/view/report/Report.js | 47 | ||||
-rw-r--r-- | web/app/view/report/ReportController.js | 24 |
8 files changed, 157 insertions, 11 deletions
diff --git a/web/app/Application.js b/web/app/Application.js index dfb972c06..176e24e67 100644 --- a/web/app/Application.js +++ b/web/app/Application.js @@ -25,11 +25,13 @@ Ext.define('Traccar.Application', { models: [ 'User', - 'Device' + 'Device', + 'Position' ], stores: [ - 'Devices' + 'Devices', + 'Positions' ], controllers: [ diff --git a/web/app/Resources.js b/web/app/Resources.js index 400174c0e..0fae64cff 100644 --- a/web/app/Resources.js +++ b/web/app/Resources.js @@ -36,6 +36,19 @@ var strings = { device_remove: 'Remove device?', report_title: 'Reports', + report_device: 'Device', + report_from: 'From', + report_to: 'To', + report_show: 'Show', + report_clear: 'Clear', + report_time: 'Time', + report_valid: 'Valid', + report_latitude: 'Latitude', + report_longitude: 'Longitude', + report_altitude: 'Altitude', + report_speed: 'Speed', + report_course: 'Course', + report_address: 'Address', dialog_save: 'Save', dialog_delete: 'Delete', @@ -50,6 +63,7 @@ var styles = { device_width: 350, report_height: 250, + report_time: 100, map_center: [ -0.1275, 51.507222 ], map_zoom: 6, diff --git a/web/app/model/Position.js b/web/app/model/Position.js new file mode 100644 index 000000000..f80bece32 --- /dev/null +++ b/web/app/model/Position.js @@ -0,0 +1,37 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +Ext.define('Traccar.model.Position', { + extend: 'Ext.data.Model', + identifier: 'negative', + + fields: [ + { name: 'id', type: 'int' }, + { name: 'protocol', type: 'string' }, + { name: 'deviceId', type: 'int' }, + { name: 'serverTime', type: 'date' }, + { name: 'deviceTime', type: 'date' }, + { name: 'fixTime', type: 'date' }, + { name: 'valid', type: 'boolean' }, + { name: 'latitude', type: 'float' }, + { name: 'longitude', type: 'float' }, + { name: 'altitude', type: 'float' }, + { name: 'speed', type: 'float' }, + { name: 'course', type: 'float' }, + { name: 'address', type: 'string' }, + { name: 'other', type: 'string' } + ] +}); diff --git a/web/app/store/Devices.js b/web/app/store/Devices.js index 2b1af192f..24777de5a 100644 --- a/web/app/store/Devices.js +++ b/web/app/store/Devices.js @@ -21,10 +21,10 @@ Ext.define('Traccar.store.Devices', { proxy: { type: 'ajax', api: { - create : '/api/device/add', - read : '/api/device/get', - update : '/api/device/update', - destroy : '/api/device/remove' + create: '/api/device/add', + read: '/api/device/get', + update: '/api/device/update', + destroy: '/api/device/remove' }, reader: { type: 'json', diff --git a/web/app/store/Positions.js b/web/app/store/Positions.js new file mode 100644 index 000000000..7de54a8d2 --- /dev/null +++ b/web/app/store/Positions.js @@ -0,0 +1,29 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +Ext.define('Traccar.store.Positions', { + extend: 'Ext.data.Store', + model: 'Traccar.model.Position', + + proxy: { + type: 'ajax', + url: '/api/position/get', + reader: { + type: 'json', + rootProperty: 'data' + } + } +}); diff --git a/web/app/view/device/Device.js b/web/app/view/device/Device.js index 4dfa13c44..64f53eeb2 100644 --- a/web/app/view/device/Device.js +++ b/web/app/view/device/Device.js @@ -23,6 +23,7 @@ Ext.define('Traccar.view.device.Device', { ], controller: 'device', + store: 'Devices', title: strings.device_title, selType: 'rowmodel', @@ -50,8 +51,6 @@ Ext.define('Traccar.view.device.Device', { handler: 'onLogoutClick' }], - store: 'Devices', - listeners: { selectionchange: 'onSelectionChange' }, diff --git a/web/app/view/report/Report.js b/web/app/view/report/Report.js index 29fa6248a..d39513873 100644 --- a/web/app/view/report/Report.js +++ b/web/app/view/report/Report.js @@ -18,15 +18,56 @@ Ext.define('Traccar.view.report.Report', { extend: 'Ext.grid.Panel', xtype: 'report-view', + requires: [ + 'Traccar.view.report.ReportController' + ], + + controller: 'report', + store: 'Positions', + title: strings.report_title, tbar: [{ - text:'Do Something' + xtype: 'tbtext', + html: strings.report_device + }, { + xtype: 'combobox', + store: 'Devices', + valueField: 'id', + displayField: 'name', + typeAhead: true, + queryMode: 'local' + }, '-', { + xtype: 'tbtext', + html: strings.report_from + }, { + xtype: 'datefield' + }, { + xtype: 'timefield', + maxWidth: styles.report_time + }, '-', { + xtype: 'tbtext', + html: strings.report_to + }, { + xtype: 'datefield' + }, { + xtype: 'timefield', + maxWidth: styles.report_time + }, '-', { + text: strings.report_show + }, { + text: strings.report_clear }], columns: [ - { text: "Column1", dataIndex: 'c1', flex: 1 }, - { text: "Column2", dataIndex: 'c2', flex: 1 } + { text: strings.report_time, dataIndex: 'fixTime', flex: 1 }, + { text: strings.report_valid, dataIndex: 'valid', flex: 1 }, + { text: strings.report_latitude, dataIndex: 'latitude', flex: 1 }, + { text: strings.report_longitude, dataIndex: 'longitude', flex: 1 }, + { text: strings.report_altitude, dataIndex: 'altitude', flex: 1 }, + { text: strings.report_speed, dataIndex: 'speed', flex: 1 }, + { text: strings.report_course, dataIndex: 'course', flex: 1 }, + { text: strings.report_address, dataIndex: 'address', flex: 1 } ] }); diff --git a/web/app/view/report/ReportController.js b/web/app/view/report/ReportController.js new file mode 100644 index 000000000..92fd1ba7e --- /dev/null +++ b/web/app/view/report/ReportController.js @@ -0,0 +1,24 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +Ext.define('Traccar.view.report.ReportController', { + extend: 'Ext.app.ViewController', + alias: 'controller.report', + + onSelectionChange: function(selected) { + } + +}); |