From 9e2ecd2c9ebfcb9b48329a2e736bf6970cc68d5b Mon Sep 17 00:00:00 2001 From: ninioe Date: Sun, 17 Jul 2016 16:11:39 +0300 Subject: fix alarm formatter to fit both attributes & report --- web/app/AttributeFormatter.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'web') diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js index 4b6cb5755..e14a9539b 100644 --- a/web/app/AttributeFormatter.js +++ b/web/app/AttributeFormatter.js @@ -34,9 +34,20 @@ Ext.define('Traccar.AttributeFormatter', { return Ext.getStore('DistanceUnits').formatValue(value, Traccar.app.getPreference('distanceUnit')); }, - alarmFormatter: function (value) { - if (typeof value === 'boolean') { - value = (value ? Ext.Msg.buttonText.yes : Ext.Msg.buttonText.no); + alarmFormatter: function (attributes) { + var value = ''; + if (attributes instanceof Object) {//for Traccar.view.Attributes + if (attributes.hasOwnProperty('alarm')){ + value = attributes.alarm; + if (typeof value === 'boolean') { + value = (value ? Ext.Msg.buttonText.yes : Ext.Msg.buttonText.no); + } + } + } else {//for Traccar.view.Report + value = attributes; + if (typeof value === 'boolean') { + value = (value ? Ext.Msg.buttonText.yes : Ext.Msg.buttonText.no); + } } return '' + value + ''; }, -- cgit v1.2.3