aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/edit
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view/edit')
-rw-r--r--web/app/view/edit/Attributes.js24
1 files changed, 20 insertions, 4 deletions
diff --git a/web/app/view/edit/Attributes.js b/web/app/view/edit/Attributes.js
index 80083193..981d5399 100644
--- a/web/app/view/edit/Attributes.js
+++ b/web/app/view/edit/Attributes.js
@@ -43,15 +43,31 @@ Ext.define('Traccar.view.edit.Attributes', {
text: Strings.sharedName,
dataIndex: 'name',
renderer: function (value, metaData) {
- var result;
+ var attribute;
if (this.attributesStore) {
- result = Ext.getStore(this.attributesStore).getById(value);
+ attribute = Ext.getStore(this.attributesStore).getById(value);
}
- return result && result.get('name') ? result.get('name') : value;
+ return attribute && attribute.get('name') ? attribute.get('name') : value;
}
}, {
text: Strings.stateValue,
- dataIndex: 'value'
+ dataIndex: 'value',
+ renderer: function (value, metaData, record) {
+ var attribute;
+ if (this.attributesStore) {
+ attribute = Ext.getStore(this.attributesStore).getById(record.get('name'));
+ }
+ if (attribute && attribute.get('convert') === 'speed') {
+ return Ext.getStore('SpeedUnits').formatValue(value, Traccar.app.getPreference('speedUnit', 'kn'));
+ } else if (attribute && attribute.get('convert') === 'distance') {
+ return Ext.getStore('DistanceUnits').formatValue(value, Traccar.app.getPreference('distanceUnit', 'km'));
+ } else if (attribute && attribute.get('type') === 'color') {
+ metaData.tdStyle = 'background-color:' + value;
+ return value;
+ } else {
+ return value;
+ }
+ }
}]
}
});