fleetmap-reports 1.0.258 → 1.0.259
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/workspace.xml +14 -10
- package/package.json +1 -1
- package/src/index.test.js +11 -0
- package/src/location-report.js +10 -4
package/.idea/workspace.xml
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<project version="4">
|
|
3
3
|
<component name="ChangeListManager">
|
|
4
|
-
<list default="true" id="eb665c86-c893-4333-bd2a-721dc27980b9" name="Changes" comment="Fix
|
|
5
|
-
<change beforePath="$PROJECT_DIR$/lang/enGB.js" beforeDir="false" afterPath="$PROJECT_DIR$/lang/enGB.js" afterDir="false" />
|
|
6
|
-
<change beforePath="$PROJECT_DIR$/lang/esCL.js" beforeDir="false" afterPath="$PROJECT_DIR$/lang/esCL.js" afterDir="false" />
|
|
7
|
-
<change beforePath="$PROJECT_DIR$/lang/ptBR.js" beforeDir="false" afterPath="$PROJECT_DIR$/lang/ptBR.js" afterDir="false" />
|
|
8
|
-
<change beforePath="$PROJECT_DIR$/lang/ptPT.js" beforeDir="false" afterPath="$PROJECT_DIR$/lang/ptPT.js" afterDir="false" />
|
|
4
|
+
<list default="true" id="eb665c86-c893-4333-bd2a-721dc27980b9" name="Changes" comment="Fix reports by driver">
|
|
9
5
|
<change beforePath="$PROJECT_DIR$/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/package-lock.json" afterDir="false" />
|
|
10
6
|
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
|
|
11
7
|
<change beforePath="$PROJECT_DIR$/src/index.test.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/index.test.js" afterDir="false" />
|
|
12
8
|
<change beforePath="$PROJECT_DIR$/src/location-report.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/location-report.js" afterDir="false" />
|
|
13
|
-
<change beforePath="$PROJECT_DIR$/src/util/driver.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/util/driver.js" afterDir="false" />
|
|
14
|
-
<change beforePath="$PROJECT_DIR$/src/util/trips.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/util/trips.js" afterDir="false" />
|
|
15
9
|
</list>
|
|
16
10
|
<option name="SHOW_DIALOG" value="false" />
|
|
17
11
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
@@ -219,7 +213,9 @@
|
|
|
219
213
|
<workItem from="1639766010908" duration="4991000" />
|
|
220
214
|
<workItem from="1639872937953" duration="1438000" />
|
|
221
215
|
<workItem from="1639954341221" duration="11986000" />
|
|
222
|
-
<workItem from="1640272520380" duration="
|
|
216
|
+
<workItem from="1640272520380" duration="2253000" />
|
|
217
|
+
<workItem from="1640789226071" duration="1935000" />
|
|
218
|
+
<workItem from="1640794844118" duration="226000" />
|
|
223
219
|
</task>
|
|
224
220
|
<task id="LOCAL-00001" summary="Fix getStyle">
|
|
225
221
|
<created>1636983717385</created>
|
|
@@ -326,7 +322,14 @@
|
|
|
326
322
|
<option name="project" value="LOCAL" />
|
|
327
323
|
<updated>1640000462825</updated>
|
|
328
324
|
</task>
|
|
329
|
-
<
|
|
325
|
+
<task id="LOCAL-00016" summary="Fix reports by driver">
|
|
326
|
+
<created>1640274171902</created>
|
|
327
|
+
<option name="number" value="00016" />
|
|
328
|
+
<option name="presentableId" value="LOCAL-00016" />
|
|
329
|
+
<option name="project" value="LOCAL" />
|
|
330
|
+
<updated>1640274171902</updated>
|
|
331
|
+
</task>
|
|
332
|
+
<option name="localTasksCounter" value="17" />
|
|
330
333
|
<servers />
|
|
331
334
|
</component>
|
|
332
335
|
<component name="TypeScriptGeneratedFilesManager">
|
|
@@ -359,6 +362,7 @@
|
|
|
359
362
|
<MESSAGE value="fix speeding report" />
|
|
360
363
|
<MESSAGE value="Trip and activity report with time period" />
|
|
361
364
|
<MESSAGE value="Fix trips distance because imported positions generate trips with 0 kms" />
|
|
362
|
-
<
|
|
365
|
+
<MESSAGE value="Fix reports by driver" />
|
|
366
|
+
<option name="LAST_COMMIT_MESSAGE" value="Fix reports by driver" />
|
|
363
367
|
</component>
|
|
364
368
|
</project>
|
package/package.json
CHANGED
package/src/index.test.js
CHANGED
|
@@ -44,6 +44,17 @@ describe('Reports', function() {
|
|
|
44
44
|
|
|
45
45
|
console.log(reportData)
|
|
46
46
|
|
|
47
|
+
await reports.kmsReportToPDF(userData, reportData[0])
|
|
48
|
+
})
|
|
49
|
+
it('test locationReport by day', async () => {
|
|
50
|
+
const reports = await getReports()
|
|
51
|
+
const userData = await reports.getUserData()
|
|
52
|
+
userData.groupByDay = true
|
|
53
|
+
const reportData = await reports.locations(new Date(2021, 10, 1), new Date(2021, 10, 3),
|
|
54
|
+
userData)
|
|
55
|
+
|
|
56
|
+
console.log(reportData)
|
|
57
|
+
|
|
47
58
|
await reports.kmsReportToPDF(userData, reportData[0])
|
|
48
59
|
})
|
|
49
60
|
})
|
package/src/location-report.js
CHANGED
|
@@ -8,6 +8,8 @@ const {getUserPartner} = require("fleetmap-partners");
|
|
|
8
8
|
|
|
9
9
|
const fileName = 'LocationReport'
|
|
10
10
|
|
|
11
|
+
const clientSide = typeof window !== "undefined"
|
|
12
|
+
|
|
11
13
|
async function createLocationReport(from, to, userData, traccar) {
|
|
12
14
|
console.log('Create LocationReport')
|
|
13
15
|
|
|
@@ -251,10 +253,14 @@ function deviceName(device){
|
|
|
251
253
|
}
|
|
252
254
|
|
|
253
255
|
function getLocationDate(location, user){
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
if(clientSide) {
|
|
257
|
+
return new Date(location.fixTime).toLocaleString()
|
|
258
|
+
} else {
|
|
259
|
+
return new Date(location.fixTime).toLocaleString(user.attributes.lang, {
|
|
260
|
+
timeZone: user.attributes.timezone,
|
|
261
|
+
hour12: false
|
|
262
|
+
})
|
|
263
|
+
}
|
|
258
264
|
}
|
|
259
265
|
|
|
260
266
|
function getDriverName(location, drivers) {
|