diff options
author | Abyss777 <abyss@fox5.ru> | 2017-07-12 16:37:06 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2017-07-12 16:37:06 +0500 |
commit | 805d50ac020dec042bfc94a1f17869372f7eff0e (patch) | |
tree | 23b6796be4ef9cc53ba27f04911b1634762a3dca /web | |
parent | eea84149b22ed25fa530bbb4159683f802c4dee1 (diff) | |
download | trackermap-web-805d50ac020dec042bfc94a1f17869372f7eff0e.tar.gz trackermap-web-805d50ac020dec042bfc94a1f17869372f7eff0e.tar.bz2 trackermap-web-805d50ac020dec042bfc94a1f17869372f7eff0e.zip |
Implement Driver Unauthorized event and driverName field in Trip report
Diffstat (limited to 'web')
-rw-r--r-- | web/app/AttributeFormatter.js | 14 | ||||
-rw-r--r-- | web/app/model/Event.js | 3 | ||||
-rw-r--r-- | web/app/model/ReportTrip.js | 3 | ||||
-rw-r--r-- | web/app/store/PositionAttributes.js | 5 | ||||
-rw-r--r-- | web/app/view/ReportController.js | 4 | ||||
-rw-r--r-- | web/l10n/en.json | 3 |
6 files changed, 32 insertions, 0 deletions
diff --git a/web/app/AttributeFormatter.js b/web/app/AttributeFormatter.js index e63cf890..464314ad 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; @@ -157,6 +169,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') { diff --git a/web/app/model/Event.js b/web/app/model/Event.js index 70fab178..da866b4c 100644 --- a/web/app/model/Event.js +++ b/web/app/model/Event.js @@ -51,6 +51,9 @@ Ext.define('Traccar.model.Event', { text = Strings[alarmKey] || alarmKey; } else if (rec.get('type') === 'textMessage') { text = Strings.eventTextMessage + ': ' + rec.get('attributes')['message']; + } else if (rec.get('type') === 'driverUnauthorized') { + text = Strings.eventDriverUnauthorized + ': ' + Traccar.AttributeFormatter.driverUniqueIdFormatter( + rec.get('attributes')['driverUniqueId']); } else { text = Traccar.app.getEventString(rec.get('type')); } diff --git a/web/app/model/ReportTrip.js b/web/app/model/ReportTrip.js index d243a8ae..107008eb 100644 --- a/web/app/model/ReportTrip.js +++ b/web/app/model/ReportTrip.js @@ -55,5 +55,8 @@ Ext.define('Traccar.model.ReportTrip', { }, { name: 'endAddress', type: 'string' + }, { + name: 'driverName', + type: 'string' }] }); diff --git a/web/app/store/PositionAttributes.js b/web/app/store/PositionAttributes.js index 0a6572dd..44bfa92f 100644 --- a/web/app/store/PositionAttributes.js +++ b/web/app/store/PositionAttributes.js @@ -233,6 +233,11 @@ Ext.define('Traccar.store.PositionAttributes', { key: 'result', name: Strings.eventCommandResult, valueType: 'string' + }, { + key: 'driverUniqueId', + name: Strings.positionDriverUniqueId, + valueType: 'string', + dataType: 'driverUniqueId' }], getAttributeName: function (key, capitalize) { diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index e048c063..b478ae98 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -531,6 +531,10 @@ Ext.define('Traccar.view.ReportController', { text: Strings.reportSpentFuel, dataIndex: 'spentFuel', renderer: Traccar.AttributeFormatter.getFormatter('spentFuel') + }, { + text: Strings.reportDriverName, + dataIndex: 'driverName', + renderer: Traccar.AttributeFormatter.getFormatter('driverName') }], stopsColumns: [{ diff --git a/web/l10n/en.json b/web/l10n/en.json index e9ac17fa..823066d6 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -198,6 +198,7 @@ "positionDtcs": "DTCs", "positionObdSpeed": "OBD Speed", "positionObdOdometer": "OBD Odometer", + "positionDriverUniqueId": "Driver Unique Id", "serverTitle": "Server Settings", "serverZoom": "Zoom", "serverRegistration": "Registration", @@ -271,6 +272,7 @@ "eventIgnitionOff": "Ignition is OFF", "eventMaintenance": "Maintenance required", "eventTextMessage": "Text message received", + "eventDriverUnauthorized": "Driver Unauthorized", "eventsScrollToLast": "Scroll To Last", "alarmSos": "SOS Alarm", "alarmVibration": "Vibration Alarm", @@ -328,6 +330,7 @@ "reportEndTime": "End Time", "reportEndAddress": "End Address", "reportSpentFuel": "Spent Fuel", + "reportDriverName": "Driver Name", "statisticsTitle": "Statistics", "statisticsCaptureTime": "Capture Time", "statisticsActiveUsers": "Active Users", |