fleetmap-reports 1.0.301 → 1.0.302
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/codeStyleConfig.xml +5 -0
- package/.idea/jsLibraryMappings.xml +6 -0
- package/.idea/modules.xml +1 -1
- package/.idea/vcs.xml +1 -1
- package/{.idea/fleetmap-reports.iml → fleetmap-reports.iml} +1 -2
- package/package.json +3 -1
- package/src/activity-report.js +30 -2
- package/src/index.js +3 -0
- package/src/trip-report.js +33 -3
- package/.idea/aws.xml +0 -17
- package/.idea/runConfigurations.xml +0 -10
package/.idea/modules.xml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<project version="4">
|
|
3
3
|
<component name="ProjectModuleManager">
|
|
4
4
|
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/fleetmap-reports.iml" filepath="$PROJECT_DIR$/fleetmap-reports.iml" />
|
|
6
6
|
</modules>
|
|
7
7
|
</component>
|
|
8
8
|
</project>
|
package/.idea/vcs.xml
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
3
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
4
|
<exclude-output />
|
|
5
5
|
<content url="file://$MODULE_DIR$" />
|
|
6
|
-
<orderEntry type="inheritedJdk" />
|
|
7
6
|
<orderEntry type="sourceFolder" forTests="false" />
|
|
8
7
|
</component>
|
|
9
8
|
</module>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fleetmap-reports",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.302",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"axios": "^0.21.1",
|
|
14
14
|
"axios-cookiejar-support": "^1.0.1",
|
|
15
|
+
"docx": "^7.3.0",
|
|
16
|
+
"file-saver": "^2.0.5",
|
|
15
17
|
"fleetmap-partners": "^1.0.42",
|
|
16
18
|
"json-as-xlsx": "^1.2.1",
|
|
17
19
|
"jspdf": "^2.3.1",
|
package/src/activity-report.js
CHANGED
|
@@ -10,7 +10,8 @@ const {getUserPartner} = require("fleetmap-partners")
|
|
|
10
10
|
const traccar = require("./util/traccar")
|
|
11
11
|
const {createKmsReport} = require("./kms-report");
|
|
12
12
|
const {isInsideTimetable} = require("./util/trips");
|
|
13
|
-
|
|
13
|
+
const { Document, Packer, Paragraph, TextRun } = require("docx")
|
|
14
|
+
import { saveAs } from "file-saver"
|
|
14
15
|
let traccarInstance
|
|
15
16
|
let userData
|
|
16
17
|
|
|
@@ -179,7 +180,6 @@ async function createActivityReportByDriver(from, to){
|
|
|
179
180
|
return allData
|
|
180
181
|
}
|
|
181
182
|
|
|
182
|
-
|
|
183
183
|
function processDevices(devices, data, kmsReport) {
|
|
184
184
|
const devicesResult = []
|
|
185
185
|
|
|
@@ -267,6 +267,34 @@ async function exportActivityReportToPDF(userData, reportData) {
|
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
+
function exportActivityReportToWord(userData, reportData) {
|
|
271
|
+
const doc = new Document({
|
|
272
|
+
sections: [{
|
|
273
|
+
properties: {},
|
|
274
|
+
children: [
|
|
275
|
+
new Paragraph({
|
|
276
|
+
children: [
|
|
277
|
+
new TextRun("Hello World"),
|
|
278
|
+
new TextRun({
|
|
279
|
+
text: "Foo Bar",
|
|
280
|
+
bold: true,
|
|
281
|
+
}),
|
|
282
|
+
new TextRun({
|
|
283
|
+
text: "\tGithub is the best",
|
|
284
|
+
bold: true,
|
|
285
|
+
}),
|
|
286
|
+
],
|
|
287
|
+
}),
|
|
288
|
+
],
|
|
289
|
+
}],
|
|
290
|
+
})
|
|
291
|
+
Packer.toBlob(doc).then(blob => {
|
|
292
|
+
console.log(blob);
|
|
293
|
+
saveAs(blob, "example.docx");
|
|
294
|
+
console.log("Document created successfully");
|
|
295
|
+
})
|
|
296
|
+
}
|
|
297
|
+
|
|
270
298
|
function exportActivityReportToPDF_Driver(doc, translations, reportData) {
|
|
271
299
|
const headers = [translations.report.driver,
|
|
272
300
|
translations.report.distance,
|
package/src/index.js
CHANGED
|
@@ -40,6 +40,9 @@ function Reports(config, axios) {
|
|
|
40
40
|
this.tripReportToExcel = (userData, reportData) => {
|
|
41
41
|
return require('./trip-report').exportTripReportToExcel(userData, reportData)
|
|
42
42
|
}
|
|
43
|
+
this.tripReportToWord = (userData, reportData) => {
|
|
44
|
+
return require('./trip-report').exportTripReportToWord(userData, reportData)
|
|
45
|
+
}
|
|
43
46
|
|
|
44
47
|
this.zoneReport = (from, to, userData) => {
|
|
45
48
|
return require('./zone-report').createZoneReport(from, to, userData, this.traccar)
|
package/src/trip-report.js
CHANGED
|
@@ -10,6 +10,7 @@ const {getStyle} = require("./reportStyle")
|
|
|
10
10
|
const traccar = require("./util/traccar")
|
|
11
11
|
const trips = require("./util/trips");
|
|
12
12
|
const {isInsideTimetable, addNearestPOIs, isPartialInsideTimetable} = require("./util/trips");
|
|
13
|
+
const {Document, Paragraph, TextRun, Packer} = require("docx");
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
let traccarInstance
|
|
@@ -205,6 +206,34 @@ function processDrivers(from, to, drivers, data) {
|
|
|
205
206
|
return driversResult
|
|
206
207
|
}
|
|
207
208
|
|
|
209
|
+
function exportTripReportToWord(userData, reportData) {
|
|
210
|
+
const doc = new Document({
|
|
211
|
+
sections: [{
|
|
212
|
+
properties: {},
|
|
213
|
+
children: [
|
|
214
|
+
new Paragraph({
|
|
215
|
+
children: [
|
|
216
|
+
new TextRun("Hello World"),
|
|
217
|
+
new TextRun({
|
|
218
|
+
text: "Foo Bar",
|
|
219
|
+
bold: true,
|
|
220
|
+
}),
|
|
221
|
+
new TextRun({
|
|
222
|
+
text: "\tGithub is the best",
|
|
223
|
+
bold: true,
|
|
224
|
+
}),
|
|
225
|
+
],
|
|
226
|
+
}),
|
|
227
|
+
],
|
|
228
|
+
}],
|
|
229
|
+
})
|
|
230
|
+
Packer.toBlob(doc).then(blob => {
|
|
231
|
+
console.log(blob);
|
|
232
|
+
saveAs(blob, "example.docx");
|
|
233
|
+
console.log("Document created successfully");
|
|
234
|
+
})
|
|
235
|
+
}
|
|
236
|
+
|
|
208
237
|
async function exportTripReportToPDF(userData, reportData) {
|
|
209
238
|
console.log('Export to PDF')
|
|
210
239
|
|
|
@@ -445,6 +474,7 @@ function getStop(tripEndDate, stops){
|
|
|
445
474
|
return null
|
|
446
475
|
}
|
|
447
476
|
|
|
448
|
-
exports.createTripReport = createTripReport
|
|
449
|
-
exports.exportTripReportToPDF = exportTripReportToPDF
|
|
450
|
-
exports.exportTripReportToExcel = exportTripReportToExcel
|
|
477
|
+
exports.createTripReport = createTripReport
|
|
478
|
+
exports.exportTripReportToPDF = exportTripReportToPDF
|
|
479
|
+
exports.exportTripReportToExcel = exportTripReportToExcel
|
|
480
|
+
exports.exportTripReportToWord = exportTripReportToWord
|
package/.idea/aws.xml
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="accountSettings">
|
|
4
|
-
<option name="activeProfile" value="profile:default" />
|
|
5
|
-
<option name="activeRegion" value="us-east-1" />
|
|
6
|
-
<option name="recentlyUsedProfiles">
|
|
7
|
-
<list>
|
|
8
|
-
<option value="profile:default" />
|
|
9
|
-
</list>
|
|
10
|
-
</option>
|
|
11
|
-
<option name="recentlyUsedRegions">
|
|
12
|
-
<list>
|
|
13
|
-
<option value="us-east-1" />
|
|
14
|
-
</list>
|
|
15
|
-
</option>
|
|
16
|
-
</component>
|
|
17
|
-
</project>
|
|
@@ -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>
|