fleetmap-reports 1.0.869 → 1.0.870
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/events-report.js +16 -8
package/package.json
CHANGED
package/src/events-report.js
CHANGED
|
@@ -4,7 +4,7 @@ require('jspdf-autotable')
|
|
|
4
4
|
const { getStyle } = require('./reportStyle')
|
|
5
5
|
const { headerFromUser } = require('./util/pdfDocument')
|
|
6
6
|
const { getUserPartner } = require('fleetmap-partners')
|
|
7
|
-
const { convertToLocaleString, getTranslations } = require('./util/utils')
|
|
7
|
+
const { convertToLocaleString, getTranslations, convertMS } = require('./util/utils')
|
|
8
8
|
const { devicesToProcess } = require('./util/device')
|
|
9
9
|
const { isInside } = require('./util/timetable')
|
|
10
10
|
const { getDigitalPortValue } = require('./location-report')
|
|
@@ -139,8 +139,10 @@ async function exportSpeedingReportToPDF (userData, reportData) {
|
|
|
139
139
|
|
|
140
140
|
const headers = [
|
|
141
141
|
translations.report.eventType,
|
|
142
|
-
translations.report.
|
|
142
|
+
translations.report.start,
|
|
143
|
+
translations.report.end,
|
|
143
144
|
translations.report.address,
|
|
145
|
+
translations.report.duration,
|
|
144
146
|
translations.report.info
|
|
145
147
|
]
|
|
146
148
|
if (reportData.devices) {
|
|
@@ -192,8 +194,10 @@ async function exportSpeedingReportToPDF (userData, reportData) {
|
|
|
192
194
|
d.alerts.forEach(a => {
|
|
193
195
|
const temp = [
|
|
194
196
|
getEventType(a, translations, d.device),
|
|
195
|
-
getAlertDate(userData.user, a),
|
|
197
|
+
getAlertDate(userData.user, a.position),
|
|
198
|
+
getAlertDate(userData.user, a.endPosition),
|
|
196
199
|
a.geofenceName || (a.position ? a.position.address : ''),
|
|
200
|
+
a.position && a.endPosition ? convertMS(new Date(a.endPosition.fixTime).getTime() - new Date(a.position.fixTime).getTime()) : '',
|
|
197
201
|
getAlertInfo(userData.drivers, a, d.device, translations)
|
|
198
202
|
]
|
|
199
203
|
data.push(temp)
|
|
@@ -254,8 +258,10 @@ function exportSpeedingReportToExcel (userData, reportData) {
|
|
|
254
258
|
const headers = [
|
|
255
259
|
{ label: translations.report.vehicle, value: 'name' },
|
|
256
260
|
{ label: translations.report.eventType, value: 'eventType' },
|
|
257
|
-
{ label: translations.report.
|
|
261
|
+
{ label: translations.report.start, value: 'fixTime' },
|
|
262
|
+
{ label: translations.report.end, value: 'endFixTime' },
|
|
258
263
|
{ label: translations.report.address, value: 'address' },
|
|
264
|
+
{ label: translations.report.duration, value: 'duration' },
|
|
259
265
|
{ label: translations.report.zone, value: 'geofenceName' },
|
|
260
266
|
{ label: translations.report.driver, value: 'driver' },
|
|
261
267
|
{ label: translations.report.info, value: 'info' },
|
|
@@ -269,8 +275,10 @@ function exportSpeedingReportToExcel (userData, reportData) {
|
|
|
269
275
|
return {
|
|
270
276
|
name: d.device.name,
|
|
271
277
|
eventType: getEventType(a, translations, d.device),
|
|
272
|
-
fixTime: getAlertDate(userData.user, a),
|
|
278
|
+
fixTime: getAlertDate(userData.user, a.position),
|
|
279
|
+
endFixTime: getAlertDate(userData.user, a.endPosition),
|
|
273
280
|
address: a.position && a.position.address,
|
|
281
|
+
duration: a.position && a.endPosition ? convertMS(new Date(a.endPosition.fixTime).getTime() - new Date(a.position.fixTime).getTime()) : '',
|
|
274
282
|
geofenceName: a.geofenceName,
|
|
275
283
|
info: getAlertInfo(userData.drivers, a, d.device, translations),
|
|
276
284
|
driver: a.driver,
|
|
@@ -316,9 +324,9 @@ function getAlertInfo (drivers, alert, device, translations) {
|
|
|
316
324
|
return ''
|
|
317
325
|
}
|
|
318
326
|
|
|
319
|
-
function getAlertDate (user,
|
|
320
|
-
if (
|
|
321
|
-
return convertToLocaleString(
|
|
327
|
+
function getAlertDate (user, position) {
|
|
328
|
+
if (position) {
|
|
329
|
+
return convertToLocaleString(position.fixTime, user.attributes.lang, user.attributes.timezone)
|
|
322
330
|
}
|
|
323
331
|
}
|
|
324
332
|
|