fleetmap-reports 1.0.226 → 1.0.230
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/kms-report.js +11 -3
package/package.json
CHANGED
package/src/kms-report.js
CHANGED
|
@@ -68,7 +68,7 @@ function processDevices(from, to, devices, data) {
|
|
|
68
68
|
keys.forEach(key => {
|
|
69
69
|
const dayLocations = groupedLocations.get(key)
|
|
70
70
|
const day = {
|
|
71
|
-
date: key,
|
|
71
|
+
date: new Date(key).toLocaleDateString(),
|
|
72
72
|
kms: dayLocations.reduce((a, b) => a + b.attributes.distance, 0) || 0
|
|
73
73
|
}
|
|
74
74
|
days.push(day)
|
|
@@ -228,7 +228,6 @@ function exportKmsReportToExcel(userData, reportData) {
|
|
|
228
228
|
console.log('Export to Excel')
|
|
229
229
|
|
|
230
230
|
const lang = userData.user.attributes.lang || (navigator && navigator.language)
|
|
231
|
-
console.log(lang)
|
|
232
231
|
const translations = messages[lang] ? messages[lang] : messages['en-GB']
|
|
233
232
|
|
|
234
233
|
const settings = {
|
|
@@ -241,6 +240,7 @@ function exportKmsReportToExcel(userData, reportData) {
|
|
|
241
240
|
if(userData.groupByDay){
|
|
242
241
|
headers.push(
|
|
243
242
|
{label: translations.report.vehicle, value: 'name'},
|
|
243
|
+
|
|
244
244
|
{label: translations.report.group, value: 'group'},
|
|
245
245
|
{label: translations.report.date, value: 'date'},
|
|
246
246
|
{label: translations.report.distance, value: 'distance'})
|
|
@@ -249,6 +249,12 @@ function exportKmsReportToExcel(userData, reportData) {
|
|
|
249
249
|
{label: translations.report.driver, value: 'name'},
|
|
250
250
|
{label: translations.report.group, value: 'group'},
|
|
251
251
|
{label: translations.report.distance, value: 'distance'})
|
|
252
|
+
} else {
|
|
253
|
+
headers.push(
|
|
254
|
+
{label: translations.report.driver, value: 'name'},
|
|
255
|
+
{label: translations.settings.vehicle_licenseplate, value: 'licenseplate'},
|
|
256
|
+
{label: translations.report.group, value: 'group'},
|
|
257
|
+
{label: translations.report.distance, value: 'distance'})
|
|
252
258
|
}
|
|
253
259
|
|
|
254
260
|
let data = []
|
|
@@ -257,12 +263,13 @@ function exportKmsReportToExcel(userData, reportData) {
|
|
|
257
263
|
const group = userData.byDriver ? userData.groups.find(g => g.drivers.includes(d.driver.id)) :
|
|
258
264
|
userData.groups.find(g => d.device.groupId === g.id)
|
|
259
265
|
|
|
260
|
-
if(userData.groupByDay) {
|
|
266
|
+
if (userData.groupByDay) {
|
|
261
267
|
data = data.concat([{}])
|
|
262
268
|
data = data.concat(d.days.map(a => {
|
|
263
269
|
return {
|
|
264
270
|
name: userData.byDriver ? d.driver.name : d.device.name,
|
|
265
271
|
group: group ? group.name : '',
|
|
272
|
+
licenseplate: d.device.attributes.license_plate,
|
|
266
273
|
date: a.date,
|
|
267
274
|
distance: Number((a.kms / 1000).toFixed(0))
|
|
268
275
|
}
|
|
@@ -271,6 +278,7 @@ function exportKmsReportToExcel(userData, reportData) {
|
|
|
271
278
|
data = data.concat([{
|
|
272
279
|
name: userData.byDriver ? d.driver.name : d.summary.deviceName,
|
|
273
280
|
group: group ? group.name : '',
|
|
281
|
+
licenseplate: d.device.attributes.license_plate,
|
|
274
282
|
distance: Number((d.summary.distance / 1000).toFixed(0))
|
|
275
283
|
}])
|
|
276
284
|
}
|