diff options
-rw-r--r-- | web/app/AttributeFormatter.js | 6 | ||||
-rw-r--r-- | web/app/view/ReportController.js | 16 |
2 files changed, 13 insertions, 9 deletions
diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js index 049532f2..d3c2812f 100644 --- a/web/app/AttributeFormatter.js +++ b/web/app/AttributeFormatter.js @@ -47,6 +47,10 @@ Ext.define('Traccar.AttributeFormatter', { return (hours + ' ' + Strings.sharedHourAbbreviation + ' ' + minutes + ' ' + Strings.sharedMinuteAbbreviation); }, + deviceIdFormatter: function (value) { + return Ext.getStore('Devices').getById(value).get('name'); + }, + defaultFormatter: function (value) { if (typeof value === 'number') { return Number(value.toFixed(Traccar.Style.numberPrecision)); @@ -78,6 +82,8 @@ Ext.define('Traccar.AttributeFormatter', { return this.hoursFormatter; } else if (key === 'duration') { return this.durationFormatter; + } 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 a8c5f4eb..775394d0 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('deviceId') + }, { 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('deviceId') }, { 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('deviceId') }, { 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('deviceId') }, { text: Strings.reportStartTime, dataIndex: 'startTime', |