diff options
Diffstat (limited to 'web/app/AttributeFormatter.js')
-rw-r--r-- | web/app/AttributeFormatter.js | 25 |
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; + } } }); |