fleetmap-reports 1.0.417 → 1.0.420
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/lang/esCL.js +4 -4
- package/package.json +1 -1
- package/src/speeding-report.js +3 -10
- package/src/util/pdfDocument.js +43 -42
- package/src/util/trips.js +5 -8
package/lang/esCL.js
CHANGED
|
@@ -175,7 +175,7 @@ module.exports = {
|
|
|
175
175
|
titleFuelConsumptionReport: 'Informe de Consumos',
|
|
176
176
|
titleFuelDropReport: 'Fuel Drop Report',
|
|
177
177
|
titleEventsReport: 'Informe de Eventos',
|
|
178
|
-
titleActivityReport: '
|
|
178
|
+
titleActivityReport: 'Informe de Actividad',
|
|
179
179
|
titleKmsReport: 'Informe de Kms',
|
|
180
180
|
titleIdleReport: 'Relatórios de Ralenti',
|
|
181
181
|
from: 'De',
|
|
@@ -193,7 +193,7 @@ module.exports = {
|
|
|
193
193
|
stopTime: 'Parada',
|
|
194
194
|
distance: 'Distancia',
|
|
195
195
|
speed: 'Velocidad',
|
|
196
|
-
overspeed: 'Inicio
|
|
196
|
+
overspeed: 'Inicio de la alarma',
|
|
197
197
|
roadSpeedLimit: 'Limite en la calle',
|
|
198
198
|
avgSpeed: 'Vel.Média',
|
|
199
199
|
maxSpeed: 'Vel.Max',
|
|
@@ -209,10 +209,10 @@ module.exports = {
|
|
|
209
209
|
duration: 'Duracción',
|
|
210
210
|
vehicles: 'Vehículos',
|
|
211
211
|
vehicle: 'Vehículo',
|
|
212
|
-
odometer: '
|
|
212
|
+
odometer: 'Km',
|
|
213
213
|
startOdometer: 'Start (Km)',
|
|
214
214
|
endOdometer: 'End (Km)',
|
|
215
|
-
spentFuel: '
|
|
215
|
+
spentFuel: 'Consumo',
|
|
216
216
|
engineHours: 'Utilización (HH:mm)',
|
|
217
217
|
driverHours: 'Tiempo de Conducción (H:m)',
|
|
218
218
|
refueling: 'Cargas',
|
package/package.json
CHANGED
package/src/speeding-report.js
CHANGED
|
@@ -3,16 +3,15 @@ const jsPDF = require('jspdf')
|
|
|
3
3
|
const { convertMS, convertToLocaleString } = require('./util/utils')
|
|
4
4
|
const { headerFromUser, AmiriRegular } = require('./util/pdfDocument')
|
|
5
5
|
require('jspdf-autotable')
|
|
6
|
-
const { parse } = require('wkt')
|
|
7
6
|
const { getStyle } = require('./reportStyle')
|
|
8
7
|
const drivers = require('./util/driver')
|
|
9
8
|
const here = require('./here')
|
|
10
9
|
const { getUserPartner } = require('fleetmap-partners')
|
|
11
10
|
const traccarHelper = require('./util/traccar')
|
|
12
11
|
const { devicesToProcess } = require('./util/device')
|
|
13
|
-
const turf = require('@turf/distance')
|
|
14
12
|
const { point } = require('@turf/helpers')
|
|
15
13
|
const distance = require('@turf/distance')
|
|
14
|
+
const { insideGeofence } = require('./util/geofence')
|
|
16
15
|
|
|
17
16
|
const fileName = 'SpeedingReport'
|
|
18
17
|
const eventTypes = ['deviceOverspeed']
|
|
@@ -281,7 +280,7 @@ function calculateEventData (positions, pIndex, alert, device, geofence, userDat
|
|
|
281
280
|
dist += distance.default(point([endEventPosition.longitude, endEventPosition.latitude]),
|
|
282
281
|
point([positions[pIndex].longitude, positions[pIndex].latitude]))
|
|
283
282
|
endEventPosition = positions[pIndex]
|
|
284
|
-
if (endEventPosition.speed <= alert.attributes.speedLimit || (geofence &&
|
|
283
|
+
if (endEventPosition.speed <= alert.attributes.speedLimit || (geofence && !insideGeofence(endEventPosition, geofence))) {
|
|
285
284
|
alert.eventTime = new Date(endEventPosition.fixTime) - new Date(alert.position.fixTime)
|
|
286
285
|
alert.attributes.maxSpeed = maxSpeed
|
|
287
286
|
alert.distance = dist
|
|
@@ -303,12 +302,6 @@ function calculateEventData (positions, pIndex, alert, device, geofence, userDat
|
|
|
303
302
|
return pIndex
|
|
304
303
|
}
|
|
305
304
|
|
|
306
|
-
function isOutsideGeofence (geofence, endEventPosition) {
|
|
307
|
-
const v = turf.feature(turf.flip(parse(geofence.area)))
|
|
308
|
-
const point = turf.point([endEventPosition.longitude, endEventPosition.latitude])
|
|
309
|
-
return turf.inside(point, v)
|
|
310
|
-
}
|
|
311
|
-
|
|
312
305
|
async function exportSpeedingReportToPDF (userData, reportData) {
|
|
313
306
|
console.log('Export to PDF')
|
|
314
307
|
|
|
@@ -364,7 +357,7 @@ async function exportSpeedingReportToPDF (userData, reportData) {
|
|
|
364
357
|
if (d.alerts[0] && !userData.byDriver) {
|
|
365
358
|
doc.text(translations.report.speedLimit + ': ' + ((userData.useVehicleSpeedLimit || !userData.customSpeed) ? Math.round(d.alerts[0].attributes.speedLimit * 1.85200) : userData.customSpeed) + ' Km/h', 20, space + 30)
|
|
366
359
|
}
|
|
367
|
-
d.alerts.
|
|
360
|
+
d.alerts.forEach(a => {
|
|
368
361
|
const temp = [
|
|
369
362
|
getAlertDate(a, userData.user),
|
|
370
363
|
a.position.address + (a.geofenceName ? ' - ' + a.geofenceName : ''),
|