diff options
author | Abyss777 <abyss@fox5.ru> | 2018-04-11 14:31:42 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2018-04-19 12:15:59 +0500 |
commit | 19a9155d988dcee7698a65a45b0558aa0ff279d4 (patch) | |
tree | cea9ae5c73a625d01bc06df5742228b5cbbd1def /web/app/AttributeFormatter.js | |
parent | 4e7d2b8fdb41390205d69997d61db536545f5564 (diff) | |
download | trackermap-web-19a9155d988dcee7698a65a45b0558aa0ff279d4.tar.gz trackermap-web-19a9155d988dcee7698a65a45b0558aa0ff279d4.tar.bz2 trackermap-web-19a9155d988dcee7698a65a45b0558aa0ff279d4.zip |
Implement Maintenances
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 4de8d9e0..bb992c28 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; + } } }); |