From 11826f4b3eac08ad4f52d8c3e6af2b8a0156daee Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 18 Nov 2016 18:33:58 +0500 Subject: Add Device Name column to Route report --- web/app/view/ReportController.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index a8c5f4eb..85cdb686 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -225,6 +225,10 @@ Ext.define('Traccar.view.ReportController', { }, routeColumns: [{ + text: Strings.reportDeviceName, + dataIndex: 'deviceId', + renderer: Traccar.AttributeFormatter.getFormatter('deviceName') + }, { text: Strings.positionValid, dataIndex: 'valid', renderer: Traccar.AttributeFormatter.getFormatter('valid') @@ -263,9 +267,7 @@ Ext.define('Traccar.view.ReportController', { }, { text: Strings.reportDeviceName, dataIndex: 'deviceId', - renderer: function (value) { - return Ext.getStore('Devices').findRecord('id', value).get('name'); - } + renderer: Traccar.AttributeFormatter.getFormatter('deviceName') }, { text: Strings.sharedType, dataIndex: 'type', @@ -286,9 +288,7 @@ Ext.define('Traccar.view.ReportController', { summaryColumns: [{ text: Strings.reportDeviceName, dataIndex: 'deviceId', - renderer: function (value) { - return Ext.getStore('Devices').findRecord('id', value).get('name'); - } + renderer: Traccar.AttributeFormatter.getFormatter('deviceName') }, { text: Strings.sharedDistance, dataIndex: 'distance', @@ -310,9 +310,7 @@ Ext.define('Traccar.view.ReportController', { tripsColumns: [{ text: Strings.reportDeviceName, dataIndex: 'deviceId', - renderer: function (value) { - return Ext.getStore('Devices').findRecord('id', value).get('name'); - } + renderer: Traccar.AttributeFormatter.getFormatter('deviceName') }, { text: Strings.reportStartTime, dataIndex: 'startTime', -- cgit v1.2.3 From d00476f715a617fab3ef4f5cb5c4fff29c533f11 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Sat, 19 Nov 2016 07:57:52 +0500 Subject: Fix name and use getById --- web/app/AttributeFormatter.js | 8 ++++---- web/app/view/ReportController.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'web/app/view') diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js index a6f6dd91..d3c2812f 100644 --- a/web/app/AttributeFormatter.js +++ b/web/app/AttributeFormatter.js @@ -47,8 +47,8 @@ Ext.define('Traccar.AttributeFormatter', { return (hours + ' ' + Strings.sharedHourAbbreviation + ' ' + minutes + ' ' + Strings.sharedMinuteAbbreviation); }, - deviceNameFormatter: function (value) { - return Ext.getStore('Devices').findRecord('id', value).get('name'); + deviceIdFormatter: function (value) { + return Ext.getStore('Devices').getById(value).get('name'); }, defaultFormatter: function (value) { @@ -82,8 +82,8 @@ Ext.define('Traccar.AttributeFormatter', { return this.hoursFormatter; } else if (key === 'duration') { return this.durationFormatter; - } else if (key === 'deviceName') { - return this.deviceNameFormatter; + } else if (key === 'deviceId') { + return this.deviceIdFormatter; } else { return this.defaultFormatter; } diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index 85cdb686..775394d0 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -227,7 +227,7 @@ Ext.define('Traccar.view.ReportController', { routeColumns: [{ text: Strings.reportDeviceName, dataIndex: 'deviceId', - renderer: Traccar.AttributeFormatter.getFormatter('deviceName') + renderer: Traccar.AttributeFormatter.getFormatter('deviceId') }, { text: Strings.positionValid, dataIndex: 'valid', @@ -267,7 +267,7 @@ Ext.define('Traccar.view.ReportController', { }, { text: Strings.reportDeviceName, dataIndex: 'deviceId', - renderer: Traccar.AttributeFormatter.getFormatter('deviceName') + renderer: Traccar.AttributeFormatter.getFormatter('deviceId') }, { text: Strings.sharedType, dataIndex: 'type', @@ -288,7 +288,7 @@ Ext.define('Traccar.view.ReportController', { summaryColumns: [{ text: Strings.reportDeviceName, dataIndex: 'deviceId', - renderer: Traccar.AttributeFormatter.getFormatter('deviceName') + renderer: Traccar.AttributeFormatter.getFormatter('deviceId') }, { text: Strings.sharedDistance, dataIndex: 'distance', @@ -310,7 +310,7 @@ Ext.define('Traccar.view.ReportController', { tripsColumns: [{ text: Strings.reportDeviceName, dataIndex: 'deviceId', - renderer: Traccar.AttributeFormatter.getFormatter('deviceName') + renderer: Traccar.AttributeFormatter.getFormatter('deviceId') }, { text: Strings.reportStartTime, dataIndex: 'startTime', -- cgit v1.2.3