mirror of
https://github.com/traccar/traccar.git
synced 2026-02-05 05:03:44 -05:00
Fix attribute formatter functions
This commit is contained in:
@@ -68,7 +68,7 @@ Ext.define('Traccar.Application', {
|
||||
},
|
||||
|
||||
getPreference: function(key, defaultValue) {
|
||||
return this.getUser().get('distanceUnit') | this.getServer().get('distanceUnit') | defaultValue;
|
||||
return this.getUser().get(key) || this.getServer().get(key) || defaultValue;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -18,17 +18,16 @@ Ext.define('Traccar.AttributeFormatter', {
|
||||
singleton: true,
|
||||
|
||||
coordinateFormatter: function(value) {
|
||||
return value.toFixed(5);
|
||||
return value.toFixed(6);
|
||||
},
|
||||
|
||||
speedFormatter: function(value) {
|
||||
return Ext.getStore('SpeedUnits').formatValue(value, Traccar.app.getPreference('speedUnit'));
|
||||
},
|
||||
|
||||
courseValues: ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'],
|
||||
|
||||
courseFormatter: function(value) {
|
||||
return this.courseValues[Math.floor(value / 45)];
|
||||
var courseValues = ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'];
|
||||
return courseValues[Math.floor(value / 45)];
|
||||
},
|
||||
|
||||
distanceFormatter: function(value) {
|
||||
@@ -36,8 +35,10 @@ Ext.define('Traccar.AttributeFormatter', {
|
||||
},
|
||||
|
||||
defaultFormatter: function(value) {
|
||||
if (value instanceof Number) {
|
||||
if (typeof value === 'number') {
|
||||
return value.toFixed(2);
|
||||
} else if (typeof value === 'boolean') {
|
||||
return value ? Ext.Msg.buttonText.yes : Ext.Msg.buttonText.no;
|
||||
} else if (value instanceof Date) {
|
||||
return Ext.Date.format(value, styles.dateTimeFormat);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ Ext.define('Traccar.view.login.Login', {
|
||||
autoEl: {
|
||||
tag: 'form',
|
||||
method: 'POST',
|
||||
action: 'blank.html',
|
||||
action: 'blank',
|
||||
target: 'submitTarget'
|
||||
},
|
||||
|
||||
|
||||
@@ -81,7 +81,8 @@ Ext.define('Traccar.view.report.Report', {
|
||||
columns: [{
|
||||
text: strings.positionValid,
|
||||
dataIndex: 'valid',
|
||||
flex: 1
|
||||
flex: 1,
|
||||
renderer: Traccar.AttributeFormatter.getFormatter('valid')
|
||||
}, {
|
||||
text: strings.positionTime,
|
||||
dataIndex: 'fixTime',
|
||||
@@ -111,6 +112,7 @@ Ext.define('Traccar.view.report.Report', {
|
||||
}, {
|
||||
text: strings.positionAddress,
|
||||
dataIndex: 'address',
|
||||
flex: 1
|
||||
flex: 1,
|
||||
renderer: Traccar.AttributeFormatter.getFormatter('address')
|
||||
}]
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user