fleetmap-reports 1.0.320 → 1.0.324
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/.idea/codeStyles/Project.xml +7 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/jsLibraryMappings.xml +6 -0
- package/package.json +1 -1
- package/src/index.test.js +3 -1
- package/src/kms-report.js +5 -0
- package/src/tests/index.js +3 -1
- package/src/word/index.js +13 -2
- package/.idea/runConfigurations.xml +0 -10
package/package.json
CHANGED
package/src/index.test.js
CHANGED
|
@@ -14,7 +14,9 @@ describe('speedingReport', function() {
|
|
|
14
14
|
const reports = await getReports()
|
|
15
15
|
const userData = await reports.getUserData()
|
|
16
16
|
userData.groupByDay = true
|
|
17
|
-
await reports.kmsReport(new Date(2021, 9), new Date(2021, 10),
|
|
17
|
+
const report = await reports.kmsReport(new Date(2021, 9, 30), new Date(2021, 10),
|
|
18
18
|
userData)
|
|
19
|
+
console.log('report', report)
|
|
20
|
+
console.log(reports.kmsReportToExcel(userData, report[0]))
|
|
19
21
|
})
|
|
20
22
|
})
|
package/src/kms-report.js
CHANGED
|
@@ -411,6 +411,11 @@ function exportKmsReportToExcel(userData, reportData) {
|
|
|
411
411
|
}
|
|
412
412
|
})
|
|
413
413
|
|
|
414
|
+
data = data.concat({
|
|
415
|
+
licenseplate: 'Total',
|
|
416
|
+
distance: data.reduce((prev, curr) => curr.distance ? {distance: (prev.distance || 0) + curr.distance} : prev).distance
|
|
417
|
+
})
|
|
418
|
+
console.log('last row', data.pop())
|
|
414
419
|
return {
|
|
415
420
|
headers,
|
|
416
421
|
data,
|
package/src/tests/index.js
CHANGED
|
@@ -14,9 +14,11 @@ const traccarConfig = {
|
|
|
14
14
|
|
|
15
15
|
axiosCookieJarSupport(axios)
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const getReports = async() => {
|
|
18
18
|
await new SessionApi(traccarConfig, null, axios).sessionPost(process.env.email, process.env.password)
|
|
19
19
|
return new Index(traccarConfig, axios)
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
exports.getReports = getReports
|
|
23
|
+
|
|
22
24
|
|
package/src/word/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const {Document, Paragraph, Packer, TableRow, TableCell, Table, WidthType, ImageRun, Header, TextRun, HeadingLevel,
|
|
2
|
-
AlignmentType
|
|
2
|
+
AlignmentType, Footer
|
|
3
3
|
} = require("docx")
|
|
4
4
|
const { saveAs } = require('file-saver')
|
|
5
5
|
const utils = require('../util/utils')
|
|
6
6
|
const {getPartnerData} = require("fleetmap-partners");
|
|
7
|
-
const colWidth =
|
|
7
|
+
const colWidth = 2000
|
|
8
8
|
|
|
9
9
|
function formatCellValue(value) {
|
|
10
10
|
return value.toLocaleDateString ? value.toLocaleDateString() : value + ''
|
|
@@ -61,6 +61,17 @@ exports.reportToWord = async (userData, dateRange, excel, title) => {
|
|
|
61
61
|
]
|
|
62
62
|
})
|
|
63
63
|
},
|
|
64
|
+
footers: {
|
|
65
|
+
default: new Footer({
|
|
66
|
+
children: [
|
|
67
|
+
new Paragraph({
|
|
68
|
+
children: [
|
|
69
|
+
new TextRun('Relatório gerado a ' + new Date().toLocaleString())
|
|
70
|
+
]
|
|
71
|
+
})
|
|
72
|
+
]
|
|
73
|
+
})
|
|
74
|
+
},
|
|
64
75
|
properties: {},
|
|
65
76
|
children: [
|
|
66
77
|
new Paragraph({
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="RunConfigurationProducerService">
|
|
4
|
-
<option name="ignoredProducers">
|
|
5
|
-
<set>
|
|
6
|
-
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
|
|
7
|
-
</set>
|
|
8
|
-
</option>
|
|
9
|
-
</component>
|
|
10
|
-
</project>
|