aboutsummaryrefslogtreecommitdiff
path: root/web/app/AttributeFormatter.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-04-20 20:21:38 +1200
committerGitHub <noreply@github.com>2018-04-20 20:21:38 +1200
commit957a6544c4d5a44d52f821377b97ee2205bb22a2 (patch)
tree9ca8487766cc7789435f0b782b41b1b29dee405e /web/app/AttributeFormatter.js
parent4e7d2b8fdb41390205d69997d61db536545f5564 (diff)
parent5ad9dc859216a129da6f352b13b908d08ec983a2 (diff)
downloadetbsa-traccar-web-957a6544c4d5a44d52f821377b97ee2205bb22a2.tar.gz
etbsa-traccar-web-957a6544c4d5a44d52f821377b97ee2205bb22a2.tar.bz2
etbsa-traccar-web-957a6544c4d5a44d52f821377b97ee2205bb22a2.zip
Merge pull request #665 from Abyss777/multi_maintenance
Implement Maintenances
Diffstat (limited to 'web/app/AttributeFormatter.js')
-rw-r--r--web/app/AttributeFormatter.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js
index 4de8d9e..bb992c2 100644
--- a/web/app/AttributeFormatter.js
+++ b/web/app/AttributeFormatter.js
@@ -123,6 +123,19 @@ Ext.define('Traccar.AttributeFormatter', {
return null;
},
+ maintenanceIdFormatter: function (value) {
+ var maintenance, store;
+ if (value !== 0) {
+ store = Ext.getStore('AllMaintenances');
+ if (store.getTotalCount() === 0) {
+ store = Ext.getStore('Maintenances');
+ }
+ maintenance = store.getById(value);
+ return maintenance ? maintenance.get('name') : '';
+ }
+ return null;
+ },
+
lastUpdateFormatter: function (value) {
var seconds, interval;
if (value) {
@@ -187,6 +200,8 @@ Ext.define('Traccar.AttributeFormatter', {
return this.groupIdFormatter;
case 'geofenceId':
return this.geofenceIdFormatter;
+ case 'maintenanceId':
+ return this.maintenanceIdFormatter;
case 'calendarId':
return this.calendarIdFormatter;
case 'lastUpdate':
@@ -258,5 +273,15 @@ Ext.define('Traccar.AttributeFormatter', {
return value;
};
}
+ },
+
+ renderAttribute: function (value, attribute) {
+ if (attribute && attribute.get('dataType') === 'speed') {
+ return Ext.getStore('SpeedUnits').formatValue(value, Traccar.app.getAttributePreference('speedUnit', 'kn'), true);
+ } else if (attribute && attribute.get('dataType') === 'distance') {
+ return Ext.getStore('DistanceUnits').formatValue(value, Traccar.app.getAttributePreference('distanceUnit', 'km'), true);
+ } else {
+ return value;
+ }
}
});