aboutsummaryrefslogtreecommitdiff
path: root/web/app/AttributeFormatter.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/AttributeFormatter.js')
-rw-r--r--web/app/AttributeFormatter.js110
1 files changed, 76 insertions, 34 deletions
diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js
index 87689a28..7ccf84b4 100644
--- a/web/app/AttributeFormatter.js
+++ b/web/app/AttributeFormatter.js
@@ -139,49 +139,77 @@ Ext.define('Traccar.AttributeFormatter', {
getFormatter: function (key) {
var self = this;
- if (key === 'latitude' || key === 'longitude') {
- return function (value) {
- return self.coordinateFormatter(key, value);
- };
- } else if (key === 'speed') {
- return this.speedFormatter;
- } else if (key === 'course') {
- return this.courseFormatter;
- } else if (key === 'distance' || key === 'accuracy') {
- return this.distanceFormatter;
- } else if (key === 'duration') {
- return this.durationFormatter;
- } else if (key === 'deviceId') {
- return this.deviceIdFormatter;
- } else if (key === 'groupId') {
- return this.groupIdFormatter;
- } else if (key === 'geofenceId') {
- return this.geofenceIdFormatter;
- } else if (key === 'lastUpdate') {
- return this.lastUpdateFormatter;
- } else if (key === 'spentFuel') {
- return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedLiterAbbreviation);
- } else if (key === 'driverUniqueId') {
- return this.driverUniqueIdFormatter;
- } else {
- return this.defaultFormatter;
+
+ switch (key) {
+ case 'latitude':
+ case 'longitude':
+ return function (value) {
+ return self.coordinateFormatter(key, value);
+ };
+ case 'speed':
+ return this.speedFormatter;
+ case 'course':
+ return this.courseFormatter;
+ case 'distance':
+ case 'accuracy':
+ return this.distanceFormatter;
+ case 'duration':
+ return this.durationFormatter;
+ case 'deviceId':
+ return this.deviceIdFormatter;
+ case 'groupId':
+ return this.groupIdFormatter;
+ case 'geofenceId':
+ return this.geofenceIdFormatter;
+ case 'lastUpdate':
+ return this.lastUpdateFormatter;
+ case 'spentFuel':
+ return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedLiterAbbreviation);
+ case 'driverUniqueId':
+ return this.driverUniqueIdFormatter;
+ default:
+ return this.defaultFormatter;
}
},
getConverter: function (key) {
- if (key === 'speed') {
- return this.speedConverter;
- } else if (key === 'distance' || key === 'accuracy') {
- return this.distanceConverter;
- } else {
- return function (value) {
- return value;
- };
+ switch (key) {
+ case 'speed':
+ return this.speedConverter;
+ case 'distance':
+ case 'accuracy':
+ return this.distanceConverter;
+ default:
+ return function (value) {
+ return value;
+ };
}
},
getAttributeFormatter: function (key) {
var dataType = Ext.getStore('PositionAttributes').getAttributeDataType(key);
+<<<<<<< HEAD
+
+ switch (dataType) {
+ case 'distance':
+ return this.distanceFormatter;
+ case 'speed':
+ return this.speedFormatter;
+ case 'driverUniqueId':
+ return this.driverUniqueIdFormatter;
+ case 'voltage':
+ return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedVoltAbbreviation);
+ case 'percentage':
+ return this.numberFormatterFactory(Traccar.Style.numberPrecision, '&#37;');
+ case 'temperature':
+ return this.numberFormatterFactory(Traccar.Style.numberPrecision, '&deg;C');
+ case 'volume':
+ return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedLiterAbbreviation);
+ case 'consumption':
+ return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedLiterPerHourAbbreviation);
+ default:
+ return this.defaultFormatter;
+=======
if (!dataType) {
return this.defaultFormatter;
} else if (dataType === 'distance') {
@@ -202,11 +230,24 @@ Ext.define('Traccar.AttributeFormatter', {
return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedLiterPerHourAbbreviation);
} else {
return this.defaultFormatter;
+>>>>>>> e0bb9b92d07176677b3043530660af3bc30774d7
}
},
getAttributeConverter: function (key) {
var dataType = Ext.getStore('PositionAttributes').getAttributeDataType(key);
+<<<<<<< HEAD
+
+ switch (dataType){
+ case 'distance':
+ return this.distanceConverter;
+ case 'speed':
+ return this.speedConverter;
+ default:
+ return function (value) {
+ return value;
+ };
+=======
if (!dataType) {
return function (value) {
return value;
@@ -219,6 +260,7 @@ Ext.define('Traccar.AttributeFormatter', {
return function (value) {
return value;
};
+>>>>>>> e0bb9b92d07176677b3043530660af3bc30774d7
}
}
});