diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-07-14 20:46:03 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-14 20:46:03 +1200 |
commit | dab4694bcab525bcc26e6af42aacc45901093dc2 (patch) | |
tree | 77631b518eacf8b9a59d9785068624e5ef52003f /web/app/AttributeFormatter.js | |
parent | 79f557f7b4bb209876977bba99f8c0a18f672b29 (diff) | |
parent | d40b862b56075e1544d3ed117576e05354b398a1 (diff) | |
download | trackermap-web-dab4694bcab525bcc26e6af42aacc45901093dc2.tar.gz trackermap-web-dab4694bcab525bcc26e6af42aacc45901093dc2.tar.bz2 trackermap-web-dab4694bcab525bcc26e6af42aacc45901093dc2.zip |
Merge pull request #524 from Abyss777/drivers
Drivers implementation
Diffstat (limited to 'web/app/AttributeFormatter.js')
-rw-r--r-- | web/app/AttributeFormatter.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js index e63cf890..3e6758ac 100644 --- a/web/app/AttributeFormatter.js +++ b/web/app/AttributeFormatter.js @@ -74,6 +74,18 @@ Ext.define('Traccar.AttributeFormatter', { } }, + driverUniqueIdFormatter: function (value) { + var driver, store; + if (value !== 0) { + store = Ext.getStore('AllDrivers'); + if (store.getTotalCount() === 0) { + store = Ext.getStore('Drivers'); + } + driver = store.findRecord('uniqueId', value, 0, false, true, true); + return driver ? value + ' (' + driver.get('name') + ')' : value; + } + }, + lastUpdateFormatter: function (value) { var seconds, interval; @@ -131,6 +143,8 @@ Ext.define('Traccar.AttributeFormatter', { 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; } @@ -157,6 +171,8 @@ Ext.define('Traccar.AttributeFormatter', { return this.distanceFormatter; } else if (dataType === 'speed') { return this.speedFormatter; + } else if (dataType === 'driverUniqueId') { + return this.driverUniqueIdFormatter; } else if (dataType === 'voltage') { return this.numberFormatterFactory(Traccar.Style.numberPrecision, Strings.sharedVoltAbbreviation); } else if (dataType === 'percentage') { |