fleetmap-reports 2.0.358 → 2.0.360
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/partnerReports/driverranking-report.js +39 -7
- package/src/util/utils.js +3 -0
- package/.claude/worktrees/eager-stonebraker-c08ac7/.eslintrc.js +0 -15
- package/.claude/worktrees/eager-stonebraker-c08ac7/lang/enGB.js +0 -309
- package/.claude/worktrees/eager-stonebraker-c08ac7/lang/esCL.js +0 -297
- package/.claude/worktrees/eager-stonebraker-c08ac7/lang/frFR.json +0 -324
- package/.claude/worktrees/eager-stonebraker-c08ac7/lang/index.js +0 -35
- package/.claude/worktrees/eager-stonebraker-c08ac7/lang/ptBR.js +0 -301
- package/.claude/worktrees/eager-stonebraker-c08ac7/lang/ptPT.js +0 -310
- package/.claude/worktrees/eager-stonebraker-c08ac7/package-lock.json +0 -11944
- package/.claude/worktrees/eager-stonebraker-c08ac7/package.json +0 -45
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/activity-report.js +0 -822
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/automaticReports.js +0 -34
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/carbone/index.js +0 -13
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/custom/vistawasteActivity-report.js +0 -544
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/events-report.js +0 -360
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/fuel-consumption-report.js +0 -296
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/fuel-drop-report.js +0 -128
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/here.js +0 -172
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/idle-report.js +0 -403
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/index.js +0 -244
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/kms-report.js +0 -549
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/location-report.js +0 -496
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/machines-report.js +0 -278
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/partnerReports/afriquia.js +0 -129
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/partnerReports/dailyuse-report.js +0 -80
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/partnerReports/delayedstart-report.js +0 -223
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/partnerReports/driverranking-report.js +0 -328
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/partnerReports/gpsjump-report.js +0 -61
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/partnerReports/performance-report.js +0 -359
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/refueling-report.js +0 -345
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/reportStyle.js +0 -34
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/sensor-report.js +0 -447
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/speeding-report.js +0 -663
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/stop-report.js +0 -242
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/ActivityReportTemplate.mjml +0 -51
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/EmptyReportTemplate.mjml +0 -25
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/EventsReportTemplate.mjml +0 -75
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/FuelDropReportTemplate.mjml +0 -60
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/IdleReportTemplate.mjml +0 -54
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/KmsReportGroupByDayTemplate.mjml +0 -43
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/KmsReportTemplate.mjml +0 -44
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/LocationReportTemplate.mjml +0 -37
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/RefuelingReportTemplate.mjml +0 -60
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/SensorReportTemplate.mjml +0 -23
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/SpeedingReportTemplate.mjml +0 -80
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/TripReportTemplate.mjml +0 -97
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/ZoneReportTemplate.mjml +0 -52
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/report.mjml +0 -96
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/activity.test.js +0 -99
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/carbone.test.js +0 -20
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/events.test.js +0 -30
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/fuel.test.js +0 -35
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/idle.test.js +0 -16
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/index.js +0 -24
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/index.test.js +0 -203
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/kms.test.js +0 -74
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/performance.test.js +0 -36
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/positions.test.js +0 -67
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/speeding.test.js +0 -120
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/translations.test.js +0 -21
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/trips.test.js +0 -140
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/tests/zones.test.js +0 -162
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/trip-report.js +0 -641
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/device.js +0 -13
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/driver.js +0 -90
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/fuel.js +0 -102
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/geofence.js +0 -52
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/odoo.js +0 -18
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/parallel.js +0 -64
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/pdfDocument.js +0 -140
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/route.js +0 -78
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/timetable.js +0 -30
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/traccar.js +0 -213
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/traccar.worker.js +0 -49
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/trips.js +0 -270
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/utils.js +0 -358
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/worker.js +0 -14
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/util/xpert.js +0 -58
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/word/index.js +0 -95
- package/.claude/worktrees/eager-stonebraker-c08ac7/src/zone-report.js +0 -904
package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/RefuelingReportTemplate.mjml
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
<mjml>
|
|
2
|
-
<mj-body background-color="#fff" font-size="13px" padding-right="0px" padding-left="0px">
|
|
3
|
-
<mj-section padding-bottom="10px" padding-top="20px">
|
|
4
|
-
<mj-column width="100%">
|
|
5
|
-
<mj-text>
|
|
6
|
-
<span style="font-size:25px">{{ translations.titleRefuelingReport }}</span>
|
|
7
|
-
</mj-text>
|
|
8
|
-
</mj-column>
|
|
9
|
-
</mj-section>
|
|
10
|
-
<mj-section>
|
|
11
|
-
<mj-section padding-bottom="15px">
|
|
12
|
-
<mj-table>
|
|
13
|
-
<tr style="font-size:12px">
|
|
14
|
-
<th colspan="3" style="text-align: left">
|
|
15
|
-
<span style="font-weight: bold;font-size:12px">{{ translations.from }} {{reportData.from}} {{ translations.to }} {{reportData.to}}</span>
|
|
16
|
-
</th>
|
|
17
|
-
</tr>
|
|
18
|
-
<tr style="font-size:12px">
|
|
19
|
-
<th><span style="font-weight: bold;">{{ translations.vehicles }}</span></th>
|
|
20
|
-
<th><span style="font-weight: bold;">{{ translations.refueling }}</span></th>
|
|
21
|
-
<th><span style="font-weight: bold;">{{ translations.totalRefueled }} (L)</span></th>
|
|
22
|
-
</tr>
|
|
23
|
-
<tr style="font-size:10px">
|
|
24
|
-
<th>{{reportData.totalDevices}}</th>
|
|
25
|
-
<th>{{reportData.totalRefueling}}</th>
|
|
26
|
-
<th>{{reportData.totalRefuelingLiters}}</th>
|
|
27
|
-
</tr>
|
|
28
|
-
</mj-table>
|
|
29
|
-
</mj-section>
|
|
30
|
-
<mj-section>
|
|
31
|
-
<mj-table>
|
|
32
|
-
<tr :style="'font-size:10px;background-color:'+color+';color:white'">
|
|
33
|
-
<th>{{ translations.date }}</th>
|
|
34
|
-
<th>{{ translations.address }}</th>
|
|
35
|
-
<th>{{ translations.totalRefueled }} (L)</th>
|
|
36
|
-
<th>{{ translations.driver }}</th>
|
|
37
|
-
</tr>
|
|
38
|
-
<mj-section v-for="(device, index) in reportData.devices" v-bind:key="device.deviceId" >
|
|
39
|
-
<tr>
|
|
40
|
-
<th colspan="4"><span style="float:left;font-weight: bold;font-size:11px">{{device.device.name}}</span><span style="float:right; font-size:11px">Depósito:{{device.device.attributes.fuel_tank_capacity}}L</span></th>
|
|
41
|
-
</tr>
|
|
42
|
-
<tr style="font-size:9px" v-for="(refueling, index) in device.refuelings" v-bind:key="device.deviceId">
|
|
43
|
-
<th>{{refueling.position.fixTime.substring(0, 10)}} {{refueling.position.fixTime.substring(11, 19)}}</th>
|
|
44
|
-
<th>{{refueling.position.geofenceName ? refueling.position.geofenceName : refueling.position.address}}</th>
|
|
45
|
-
<th>{{refueling.diff}}</th>
|
|
46
|
-
<th>{{refueling.position.driverName ? refueling.position.driverName : ''}}</th>
|
|
47
|
-
</tr>
|
|
48
|
-
</mj-section>
|
|
49
|
-
</mj-table>
|
|
50
|
-
</mj-section>
|
|
51
|
-
</mj-section>
|
|
52
|
-
<mj-section>
|
|
53
|
-
<mj-column width="100%">
|
|
54
|
-
<mj-text align="left" font-family="Ubuntu, Helvetica, Arial, sans-serif">
|
|
55
|
-
{{ translations.unsubscribeRefuelingReport.replace('%url%', url) }}
|
|
56
|
-
</mj-text>
|
|
57
|
-
</mj-column>
|
|
58
|
-
</mj-section>
|
|
59
|
-
</mj-body>
|
|
60
|
-
</mjml>
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<mjml>
|
|
2
|
-
<mj-head>
|
|
3
|
-
</mj-head>
|
|
4
|
-
<mj-body background-color="#fff" font-size="13px" padding-right="0px" padding-left="0px">
|
|
5
|
-
<mj-section padding="10px 5px 0px 5px" >
|
|
6
|
-
<mj-column width="60%" style="float: left" text-align="left">
|
|
7
|
-
<mj-text>
|
|
8
|
-
<span style="font-size:18px;font-weight: bold">{{ translations.titleSensorReport }}</span>
|
|
9
|
-
</mj-text>
|
|
10
|
-
</mj-column>
|
|
11
|
-
<mj-column width="40%">
|
|
12
|
-
<mj-image width="120px" :src="url + '/' + logo"></mj-image>
|
|
13
|
-
</mj-column>
|
|
14
|
-
</mj-section>
|
|
15
|
-
<mj-section>
|
|
16
|
-
<mj-column width="100%">
|
|
17
|
-
<mj-text align="left" font-family="Ubuntu, Helvetica, Arial, sans-serif">
|
|
18
|
-
{{ translations.unsubscribeTripReport.replace('%url%', url) }}
|
|
19
|
-
</mj-text>
|
|
20
|
-
</mj-column>
|
|
21
|
-
</mj-section>
|
|
22
|
-
</mj-body>
|
|
23
|
-
</mjml>
|
package/.claude/worktrees/eager-stonebraker-c08ac7/src/templates/SpeedingReportTemplate.mjml
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
<mjml>
|
|
2
|
-
<mj-body background-color="#fff">
|
|
3
|
-
<mj-section>
|
|
4
|
-
<mj-column>
|
|
5
|
-
<!--suppress UnknownAttribute -->
|
|
6
|
-
<mj-image :src="url + '/' + logo" width="256px"/>
|
|
7
|
-
<mj-text>
|
|
8
|
-
<span style="font-size:18px;font-weight: bold">{{ translations.titleSpeedingReport }}</span>
|
|
9
|
-
<br/>
|
|
10
|
-
<span>{{ reportData.devices && reportData.devices.length }} {{ translations.vehicles }}</span>
|
|
11
|
-
</mj-text>
|
|
12
|
-
</mj-column>
|
|
13
|
-
</mj-section>
|
|
14
|
-
<!--suppress UnknownAttribute -->
|
|
15
|
-
<mj-section v-for="device in reportData.devices" :key="device.deviceId" >
|
|
16
|
-
<mj-column>
|
|
17
|
-
<mj-wrapper border="1px solid #000000" padding="20px 10px">
|
|
18
|
-
<!--suppress InvalidParentTag -->
|
|
19
|
-
<mj-table>
|
|
20
|
-
<tr style="font-size:12px">
|
|
21
|
-
<th colspan="4" style="text-align: left">
|
|
22
|
-
<span style="font-weight: bold;font-size:12px">
|
|
23
|
-
{{device.device.name}}{{device.device.attributes.license_plate ? ', ' +device.device.attributes.license_plate : ''}}{{device.device.model ? ', ' + device.device.model : ''}}</span>
|
|
24
|
-
<span style="float:right; font-weight: bold;font-size:11px">
|
|
25
|
-
{{ device.device.groupName ? translations.group + ': ' + device.device.groupName : ''}}</span><br/>
|
|
26
|
-
<span style="font-weight: bold;font-size:11px">
|
|
27
|
-
{{ translations.from }} {{ device.from.toLocaleDateString(user.attributes.lang, { timeZone: user.attributes.timezone }) }}
|
|
28
|
-
{{ translations.to }} {{ device.to.toLocaleDateString(user.attributes.lang, { timeZone: user.attributes.timezone }) }}</span>
|
|
29
|
-
</th>
|
|
30
|
-
</tr>
|
|
31
|
-
<tr style="font-size:11px">
|
|
32
|
-
<th v-if="!userData.roadSpeedLimits"><span style="font-weight: bold;">{{ translations.speedLimit }}</span></th>
|
|
33
|
-
<th><span style="font-weight: bold;">{{ translations.headerMaxSpeed }}</span></th>
|
|
34
|
-
<th><span style="font-weight: bold;">{{ translations.totalAlerts }}</span></th>
|
|
35
|
-
</tr>
|
|
36
|
-
<tr style="font-size:10px">
|
|
37
|
-
<th v-if="!userData.roadSpeedLimits">{{ Math.round(device.alerts[0].attributes.speedLimit * 1.85200)}} Km\h</th>
|
|
38
|
-
<th>{{ Math.round(device.maxSpeed * 1.85200)}} Km\h</th>
|
|
39
|
-
<th>{{ device.alerts.length }}</th>
|
|
40
|
-
</tr>
|
|
41
|
-
</mj-table>
|
|
42
|
-
<!--suppress InvalidParentTag -->
|
|
43
|
-
<mj-table>
|
|
44
|
-
<tr :style="'font-size:10px;background-color:'+color+';color:white'">
|
|
45
|
-
<th style="min-width: 50px">{{ translations.date }}</th>
|
|
46
|
-
<th style="min-width: 200px">{{ translations.address }}</th>
|
|
47
|
-
<th style="min-width: 60px" v-if="userData.roadSpeedLimits">{{ translations.roadSpeedLimit }}</th>
|
|
48
|
-
<th style="min-width: 90px">{{ translations.alertSpeed }}<br/>(Km/h)</th>
|
|
49
|
-
<th style="min-width: 90px">{{ translations.maxSpeed }}<br/>(Km/h)</th>
|
|
50
|
-
<th style="min-width: 90px">{{ translations.duration }}</th>
|
|
51
|
-
<th style="min-width: 60px" v-if="device.alerts.find(a => a.driver)">{{ translations.driver }}</th>
|
|
52
|
-
<th style="min-width: 50px" v-if="userData.roadSpeedLimits">Info</th>
|
|
53
|
-
</tr>
|
|
54
|
-
<tr style="font-size:9px" v-for="(alert) in device.alerts" :key="alert.deviceId">
|
|
55
|
-
<td>{{new Date(alert.position.fixTime).toLocaleString(user.attributes.lang, { timeZone: user.attributes.timezone, hour12:false })}}</td>
|
|
56
|
-
<td><a target=_blank :href="`${url}/#/map?vehicleName=${userData.byDriver?alert.deviceName:device.device.name}&date=${new Date(alert.position.fixTime).toISOString()}`">{{alert.geofenceName ? alert.geofenceName : alert.position.address}}</a></td>
|
|
57
|
-
<td v-if="userData.roadSpeedLimits">{{ alert.roadSpeedLimit }}</td>
|
|
58
|
-
<td>{{Math.round(alert.attributes.speed * 1.85200)}}</td>
|
|
59
|
-
<td>{{Math.round(alert.attributes.maxSpeed * 1.85200)}}</td>
|
|
60
|
-
<td>{{convertMS(alert.eventTime, true)}}</td>
|
|
61
|
-
<td v-if="alert.driver">{{alert.driver}}</td>
|
|
62
|
-
<td v-if="userData.roadSpeedLimits">
|
|
63
|
-
<a :href="`https://openstreetmap.org/way/${alert.position.way_id}`" target="_blank">
|
|
64
|
-
{{alert.position.way_id}}
|
|
65
|
-
</a>
|
|
66
|
-
</td>
|
|
67
|
-
</tr>
|
|
68
|
-
</mj-table>
|
|
69
|
-
</mj-wrapper>
|
|
70
|
-
</mj-column>
|
|
71
|
-
</mj-section>
|
|
72
|
-
<mj-section>
|
|
73
|
-
<mj-column width="100%">
|
|
74
|
-
<mj-text align="left" font-family="Ubuntu, Helvetica, Arial, sans-serif">
|
|
75
|
-
{{ translations.unsubscribeSpeedingReport.replace('%url%', url) }}
|
|
76
|
-
</mj-text>
|
|
77
|
-
</mj-column>
|
|
78
|
-
</mj-section>
|
|
79
|
-
</mj-body>
|
|
80
|
-
</mjml>
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
<mjml>
|
|
2
|
-
<mj-head>
|
|
3
|
-
</mj-head>
|
|
4
|
-
<mj-body background-color="#fff" font-size="13px" padding-right="0px" padding-left="0px">
|
|
5
|
-
<mj-section padding="10px 5px 0px 5px" >
|
|
6
|
-
<mj-column width="60%" style="float: left" text-align="left">
|
|
7
|
-
<mj-text>
|
|
8
|
-
<span style="font-size:18px;font-weight: bold">{{ translations.titleTripReport }}</span>
|
|
9
|
-
</mj-text>
|
|
10
|
-
</mj-column>
|
|
11
|
-
<mj-column width="40%">
|
|
12
|
-
<mj-image width="120px" :src="url + '/' + logo"></mj-image>
|
|
13
|
-
</mj-column>
|
|
14
|
-
</mj-section>
|
|
15
|
-
<mj-section v-for="(device, index) in reportData.devices" v-bind:key="device.deviceId" >
|
|
16
|
-
<mj-column>
|
|
17
|
-
<mj-wrapper border="1px solid #000000" padding="20px 10px">
|
|
18
|
-
<mj-table>
|
|
19
|
-
<tr style="font-size:12px">
|
|
20
|
-
<th colspan="4" style="text-align: left">
|
|
21
|
-
<span style="font-weight: bold;font-size:12px">{{device.device.name}}{{device.device.attributes.license_plate ? ', ' +device.device.attributes.license_plate : ''}}{{device.device.model ? ', ' + device.device.model : ''}}</span>
|
|
22
|
-
<span style="float:right; font-weight: bold;font-size:11px">{{ device.device.groupName ? translations.group + ': ' + device.device.groupName : ''}}</span><br/>
|
|
23
|
-
<span style="font-weight: bold;font-size:11px">{{ translations.from }} {{ device.from.toLocaleString(user.attributes.lang, { timeZone: user.attributes.timezone }) }} {{ translations.to }} {{ device.to.toLocaleString(user.attributes.lang, { timeZone: user.attributes.timezone }) }}</span>
|
|
24
|
-
</th>
|
|
25
|
-
</tr>
|
|
26
|
-
<tr style="font-size:11px">
|
|
27
|
-
<th><span style="font-weight: bold;">{{ translations.headerStartAddress }}</span></th>
|
|
28
|
-
<th><span style="font-weight: bold;">{{ translations.headerDistance }}</span></th>
|
|
29
|
-
<th><span style="font-weight: bold;">{{ translations.headerDrivingTime }}</span></th>
|
|
30
|
-
<th><span style="font-weight: bold;">{{ translations.headerMaxSpeed}}</span></th>
|
|
31
|
-
</tr>
|
|
32
|
-
<tr style="font-size:10px">
|
|
33
|
-
<th>{{device.trips[0].startAddress}}</th>
|
|
34
|
-
<th>{{(device.totalDistance/1000).toFixed(2)}} Kms</th>
|
|
35
|
-
<th>{{convertMS(device.totalDuration)}}</th>
|
|
36
|
-
<th>{{Math.round(device.maxSpeed * 1.85200)}} Km\h</th>
|
|
37
|
-
</tr>
|
|
38
|
-
<tr v-if="device.device.attributes.xpert === true" style="font-size:11px">
|
|
39
|
-
<th colspan="2"><span style="font-weight: bold;">Consumo Total</span></th>
|
|
40
|
-
<th colspan="2"><span style="font-weight: bold;">Consumo Médio</span></th>
|
|
41
|
-
</tr>
|
|
42
|
-
<tr v-if="device.device.attributes.xpert" style="font-size:10px">
|
|
43
|
-
<th colspan="2">{{device.totalFuelConsumption}} L</th>
|
|
44
|
-
<th colspan="2">{{device.avgFuelConsumption}} L/100</th>
|
|
45
|
-
</tr>
|
|
46
|
-
</mj-table>
|
|
47
|
-
<mj-table>
|
|
48
|
-
<tr :style="'font-size:10px;background-color:'+color+';color:white'">
|
|
49
|
-
<th rowspan="2">{{ translations.date }}</th>
|
|
50
|
-
<th rowspan="2">{{ translations.start }}</th>
|
|
51
|
-
<th rowspan="2">{{ translations.end }}</th>
|
|
52
|
-
<th rowspan="2">{{ translations.tripTime }}</th>
|
|
53
|
-
<th rowspan="2">{{ translations.idleTime }}</th>
|
|
54
|
-
<th rowspan="2">{{ translations.stopTime }}</th>
|
|
55
|
-
<th rowspan="2">{{ translations.distance }}<br/>(Kms)</th>
|
|
56
|
-
<th colspan="2">Velocidade</th>
|
|
57
|
-
<th colspan="2" v-if="reportData.xpert === true"> Consumo</th>
|
|
58
|
-
<th rowspan="2">{{ translations.driver }}</th>
|
|
59
|
-
</tr>
|
|
60
|
-
<tr :style="'font-size:10px;background-color:'+color+';color:white'">
|
|
61
|
-
<th>Méd(Km/h)</th>
|
|
62
|
-
<th>Max(Km/h)</th>
|
|
63
|
-
<th v-if="reportData.xpert === true">(L)</th>
|
|
64
|
-
<th v-if="reportData.xpert === true">(L/100)</th>
|
|
65
|
-
</tr>
|
|
66
|
-
<mj-section v-for="(trip, index) in device.trips" v-bind:key="trip.deviceId">
|
|
67
|
-
<tr :style="index%2 ? 'text-align: center;background-color:#E3E3E3' : 'text-align: center;background-color:#FFFFFF'" >
|
|
68
|
-
<td style="font-size:10px">{{new Date(trip.startTime).toLocaleDateString(user.attributes.lang, { timeZone: user.attributes.timezone, hour12:false })}}</td>
|
|
69
|
-
<td style="font-size:10px">{{new Date(trip.startTime).toLocaleTimeString(user.attributes.lang, { timeZone: user.attributes.timezone, hour12:false })}}</td>
|
|
70
|
-
<td style="font-size:10px">{{new Date(trip.endTime).toLocaleTimeString(user.attributes.lang, { timeZone: user.attributes.timezone, hour12:false })}}</td>
|
|
71
|
-
<td style="font-size:10px">{{convertMS(trip.duration)}}</td>
|
|
72
|
-
<td style="font-size:10px">{{convertMS(trip.stopEngineHours)}}</td>
|
|
73
|
-
<td style="font-size:10px">{{convertMS(trip.stopDuration)}}</td>
|
|
74
|
-
<td style="font-size:10px">{{trip.totalKms.toFixed(2)}}</td>
|
|
75
|
-
<td style="font-size:10px">{{Math.round(trip.averageSpeed * 1.85200)}}</td>
|
|
76
|
-
<td style="font-size:10px">{{Math.round(trip.maxSpeed * 1.85200)}}</td>
|
|
77
|
-
<td style="font-size:10px" v-if="reportData.xpert === true">{{ trip.fuelConsumption }}</td>
|
|
78
|
-
<td style="font-size:10px" v-if="reportData.xpert === true">{{ trip.avgFuelConsumption}}</td>
|
|
79
|
-
<td style="font-size:9px">{{trip.driverName}}</td>
|
|
80
|
-
</tr>
|
|
81
|
-
<tr :style="index%2 ? 'vertical-align: top;background-color:#E3E3E3' : 'vertical-align: top;background-color:#FFFFFF'" >
|
|
82
|
-
<td style="font-size:9px;padding-left: 5px" :colspan="reportData.xpert === true ? 12 : 10">{{ translations.endAddress }}: {{trip.endPOIName || trip.endAddress}}</td>
|
|
83
|
-
</tr>
|
|
84
|
-
</mj-section>
|
|
85
|
-
</mj-table>
|
|
86
|
-
</mj-wrapper>
|
|
87
|
-
</mj-column>
|
|
88
|
-
</mj-section>
|
|
89
|
-
<mj-section>
|
|
90
|
-
<mj-column width="100%">
|
|
91
|
-
<mj-text align="left" font-family="Ubuntu, Helvetica, Arial, sans-serif">
|
|
92
|
-
{{ translations.unsubscribeTripReport.replace('%url%', url) }}
|
|
93
|
-
</mj-text>
|
|
94
|
-
</mj-column>
|
|
95
|
-
</mj-section>
|
|
96
|
-
</mj-body>
|
|
97
|
-
</mjml>
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
<mjml>
|
|
2
|
-
<mj-body background-color="#fff" font-size="13px" padding-right="0px" padding-left="0px">
|
|
3
|
-
<mj-section padding="10px 5px 0px 5px" >
|
|
4
|
-
<mj-column width="60%" style="float: left" text-align="left">
|
|
5
|
-
<mj-text>
|
|
6
|
-
<span style="font-size:18px;font-weight: bold">{{ translations.titleZoneReport }}</span>
|
|
7
|
-
</mj-text>
|
|
8
|
-
</mj-column>
|
|
9
|
-
<mj-column width="40%">
|
|
10
|
-
<mj-image width="120px" :src="url + '/' + logo"></mj-image>
|
|
11
|
-
</mj-column>
|
|
12
|
-
</mj-section>
|
|
13
|
-
<mj-section v-for="(device, index) in reportData.devices" v-bind:key="device.deviceId" >
|
|
14
|
-
<mj-column>
|
|
15
|
-
<mj-wrapper border="1px solid #000000" padding="20px 10px">
|
|
16
|
-
<mj-table>
|
|
17
|
-
<tr style="font-size:12px">
|
|
18
|
-
<th colspan="4" style="text-align: left">
|
|
19
|
-
<span style="font-weight: bold;font-size:12px">{{device.device.name}}{{device.device.attributes.license_plate ? ', ' +device.device.attributes.license_plate : ''}}{{device.device.model > 0 ? ', ' + device.device.model : ''}}</span>
|
|
20
|
-
<span style="float:right; font-weight: bold;font-size:11px">{{ device.device.groupName ? translations.group + ': ' + device.device.groupName : ''}}</span><br/>
|
|
21
|
-
<span style="font-weight: bold;font-size:11px">{{ translations.from }} {{ device.from.toLocaleString(user.attributes.lang, { timeZone: user.attributes.timezone }) }} {{ translations.to }} {{ device.to.toLocaleString(user.attributes.lang, { timeZone: user.attributes.timezone }) }}</span>
|
|
22
|
-
</th>
|
|
23
|
-
</tr>
|
|
24
|
-
</mj-table>
|
|
25
|
-
<mj-table>
|
|
26
|
-
<tr :style="'font-size:10px;background-color:'+color+';color:white'">
|
|
27
|
-
<th>{{ translations.enter }}</th>
|
|
28
|
-
<th>{{ translations.exit }}</th>
|
|
29
|
-
<th>{{ translations.duration }}</th>
|
|
30
|
-
<th>{{ translations.geofence }}</th>
|
|
31
|
-
<th>{{ translations.driver }}</th>
|
|
32
|
-
</tr>
|
|
33
|
-
<tr style="font-size:9px" v-for="(geofence, index) in device.geofences" v-bind:key="device.deviceId">
|
|
34
|
-
<th>{{geofence.inTime ? new Date(geofence.inTime.fixTime).toLocaleString(user.attributes.lang, { timeZone: user.attributes.timezone, hour12:false }) : ''}}</th>
|
|
35
|
-
<th>{{geofence.outTime ? new Date(geofence.outTime.fixTime).toLocaleString(user.attributes.lang, { timeZone: user.attributes.timezone, hour12:false }) : ''}}</th>
|
|
36
|
-
<th>{{geofence.totalTime ? convertMS(geofence.totalTime * 1000, true) : '-'}}</th>
|
|
37
|
-
<th>{{geofence.geofenceName}}</th>
|
|
38
|
-
<th>{{geofence.driverName}}</th>
|
|
39
|
-
</tr>
|
|
40
|
-
</mj-table>
|
|
41
|
-
</mj-wrapper>
|
|
42
|
-
</mj-column>
|
|
43
|
-
</mj-section>
|
|
44
|
-
<mj-section>
|
|
45
|
-
<mj-column width="100%">
|
|
46
|
-
<mj-text align="left" font-family="Ubuntu, Helvetica, Arial, sans-serif">
|
|
47
|
-
{{ translations.unsubscribeZoneReport.replace('%url%', url) }}
|
|
48
|
-
</mj-text>
|
|
49
|
-
</mj-column>
|
|
50
|
-
</mj-section>
|
|
51
|
-
</mj-body>
|
|
52
|
-
</mjml>
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
<mjml>
|
|
2
|
-
<mj-body background-color="#fff" font-size="13px" padding-right="0px" padding-left="0px">
|
|
3
|
-
<mj-section padding-bottom="10px" padding-top="20px">
|
|
4
|
-
<mj-column width="50%">
|
|
5
|
-
<mj-text>
|
|
6
|
-
<span style="font-size:25px">{{strings.report_title}}</span>
|
|
7
|
-
</mj-text>
|
|
8
|
-
</mj-column>
|
|
9
|
-
<mj-column width="50%">
|
|
10
|
-
<mj-image :src="'https://wuizy.co.ao'+header.logo_url" alt="" align="right" border="none" width="200px"></mj-image>
|
|
11
|
-
</mj-column>
|
|
12
|
-
</mj-section>
|
|
13
|
-
<mj-section v-for="(vehicleTrips, index) in trips" v-bind:key="vehicleTrips[0].device_id">
|
|
14
|
-
<mj-section>
|
|
15
|
-
<mj-column width="50%">
|
|
16
|
-
<mj-text align="left" font-size="12px" font-family="Ubuntu, Helvetica, Arial, sans-serif">
|
|
17
|
-
{{vehicleTrips[0].device_name}}, {{vehicleTrips[0].device_licenseplate}}, {{vehicleTrips[0].device_model}}
|
|
18
|
-
</mj-text>
|
|
19
|
-
</mj-column>
|
|
20
|
-
<mj-column width="50%">
|
|
21
|
-
<mj-text align="right" font-size="12px" font-family="Ubuntu, Helvetica, Arial, sans-serif" >
|
|
22
|
-
{{strings.from}} {{header.date_from}} {{strings.to}} {{header.date_to}}
|
|
23
|
-
</mj-text>
|
|
24
|
-
</mj-column>
|
|
25
|
-
</mj-section>
|
|
26
|
-
<mj-section>
|
|
27
|
-
<mj-column width="25%">
|
|
28
|
-
<mj-text align="left" font-size="12px" font-family="Ubuntu, Helvetica, Arial, sans-serif">
|
|
29
|
-
{{strings.start_place}}</br>
|
|
30
|
-
{{vehicleTrips[0].trip_start_address}}
|
|
31
|
-
</mj-text>
|
|
32
|
-
</mj-column>
|
|
33
|
-
<mj-column width="25%">
|
|
34
|
-
<mj-text align="left" font-size="12px" font-family="Ubuntu, Helvetica, Arial, sans-serif" >
|
|
35
|
-
{{strings.total_distance}}</br>
|
|
36
|
-
{{vehicleTrips[vehicleTrips.length-1].trip_incremental_distance}} km
|
|
37
|
-
</mj-text>
|
|
38
|
-
</mj-column>
|
|
39
|
-
<mj-column width="25%">
|
|
40
|
-
<mj-text align="left" font-size="12px" font-family="Ubuntu, Helvetica, Arial, sans-serif" >
|
|
41
|
-
{{strings.total_driving_time}}</br>
|
|
42
|
-
{{vehicleTrips[vehicleTrips.length-1].trip_incremental_driving_time}}
|
|
43
|
-
</mj-text>
|
|
44
|
-
</mj-column>
|
|
45
|
-
<mj-column width="25%">
|
|
46
|
-
<mj-text align="left" font-size="12px" font-family="Ubuntu, Helvetica, Arial, sans-serif" >
|
|
47
|
-
{{strings.total_max_speed}}</br>
|
|
48
|
-
{{vehicleTrips[vehicleTrips.length-1].trip_incremental_max_speed}} km/h
|
|
49
|
-
</mj-text>
|
|
50
|
-
</mj-column>
|
|
51
|
-
</mj-section>
|
|
52
|
-
<mj-section padding-bottom="15px">
|
|
53
|
-
<mj-table>
|
|
54
|
-
<tr style="font-size:10px">
|
|
55
|
-
<th>{{strings.date}}</th>
|
|
56
|
-
<th>{{strings.start}}</th>
|
|
57
|
-
<th>{{strings.end}}</th>
|
|
58
|
-
<th>{{strings.destination}}</th>
|
|
59
|
-
<th>{{strings.duration}}</th>
|
|
60
|
-
<th>{{strings.driving}}</th>
|
|
61
|
-
<th>{{strings.idle}}</th>
|
|
62
|
-
<th>{{strings.stop}}</th>
|
|
63
|
-
<th>{{strings.distance}}</th>
|
|
64
|
-
<th>{{strings.speed_avg}}</th>
|
|
65
|
-
<th>{{strings.speed_max}}</th>
|
|
66
|
-
<th>{{strings.speed_time}}</th>
|
|
67
|
-
<th>{{strings.driver}}</th>
|
|
68
|
-
</tr>
|
|
69
|
-
<tr style="font-size:9px" v-for="(trip,index) in vehicleTrips" :key="index">
|
|
70
|
-
<th>{{trip.trip_start_fixtime.substring(0, 10)}}</th>
|
|
71
|
-
<th>{{trip.trip_start_fixtime.substring(11)}}</th>
|
|
72
|
-
<th>{{trip.trip_end_fixtime.substring(11)}}</th>
|
|
73
|
-
<th>{{trip.trip_end_address}}</th>
|
|
74
|
-
<th>{{trip.trip_duration}}</th>
|
|
75
|
-
<th>{{trip.trip_driving_time}}</th>
|
|
76
|
-
<th>{{trip.trip_idle_time}}</th>
|
|
77
|
-
<th>{{trip.trip_stop_time}}</th>
|
|
78
|
-
<th>{{trip.trip_distance}}</th>
|
|
79
|
-
<th>{{trip.trip_avg_speed}}</th>
|
|
80
|
-
<th>{{trip.trip_max_speed}}</th>
|
|
81
|
-
<th>{{trip.trip_speeding_time}}</th>
|
|
82
|
-
<th>{{trip.trip_driver_uniqueid}}</th>
|
|
83
|
-
</tr>
|
|
84
|
-
</mj-table>
|
|
85
|
-
</mj-section>
|
|
86
|
-
</mj-section>
|
|
87
|
-
<mj-section background-color="#356cc7" padding-bottom="5px" padding-top="0">
|
|
88
|
-
<mj-column width="100%">
|
|
89
|
-
<mj-divider border-color="#ffffff" border-width="2px" border-style="solid" padding-left="20px" padding-right="20px" padding-bottom="0px" padding-top="0"></mj-divider>
|
|
90
|
-
<mj-text align="center" color="#FFF" font-size="15px" font-family="Helvetica" padding-left="25px" padding-right="25px" padding-bottom="20px" padding-top="20px">Best,
|
|
91
|
-
<br/>
|
|
92
|
-
<span style="font-size:15px">The Company Team</span></mj-text>
|
|
93
|
-
</mj-column>
|
|
94
|
-
</mj-section>
|
|
95
|
-
</mj-body>
|
|
96
|
-
</mjml>
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line no-undef
|
|
2
|
-
const { getReports } = require('./index')
|
|
3
|
-
const assert = require('assert')
|
|
4
|
-
// eslint-disable-next-line no-undef
|
|
5
|
-
describe('activity report', function () {
|
|
6
|
-
// eslint-disable-next-line no-undef
|
|
7
|
-
it('Activity by device', async () => {
|
|
8
|
-
const report = await getReports()
|
|
9
|
-
const userData = await report.getUserData()
|
|
10
|
-
|
|
11
|
-
const data = await report.activityReport(new Date(2022, 0, 1, 0, 0, 0, 0),
|
|
12
|
-
new Date(2022, 0, 31, 23, 59, 59, 0),
|
|
13
|
-
userData)
|
|
14
|
-
assert.equal(data.length, 1)
|
|
15
|
-
const device = data[0].devices.find(d => d.device.id === 22326)
|
|
16
|
-
assert.equal(device.summary[0].startOdometer, 0)
|
|
17
|
-
assert.equal(device.summary[0].distance, 0)
|
|
18
|
-
assert.equal(device.summary[0].startTime, 0)
|
|
19
|
-
assert.equal(device.summary[0].endTime, 0)
|
|
20
|
-
}, 80000)
|
|
21
|
-
|
|
22
|
-
// eslint-disable-next-line no-undef
|
|
23
|
-
it('Activity by driver', async () => {
|
|
24
|
-
const report = await getReports('felipe@codepa.com.br', process.env.password)
|
|
25
|
-
const userData = await report.getUserData()
|
|
26
|
-
userData.byDriver = true
|
|
27
|
-
const data = await report.activityReport(new Date(2023, 0, 1, 0, 0, 0, 0),
|
|
28
|
-
new Date(2023, 0, 1, 23, 59, 59, 0),
|
|
29
|
-
userData)
|
|
30
|
-
assert.equal(data.length, 1)
|
|
31
|
-
await report.activityReportToPDF(userData, data[0])
|
|
32
|
-
}, 800000)
|
|
33
|
-
// eslint-disable-next-line no-undef
|
|
34
|
-
it('Activity byDevice groupByDay', async () => {
|
|
35
|
-
const report = await getReports()
|
|
36
|
-
const userData = await report.getUserData()
|
|
37
|
-
userData.groupByDay = true
|
|
38
|
-
const data = await report.activityReport(new Date(2022, 0, 1, 0, 0, 0, 0),
|
|
39
|
-
new Date(2022, 0, 20, 23, 59, 59, 0),
|
|
40
|
-
userData)
|
|
41
|
-
assert.equal(data.length, 1)
|
|
42
|
-
const device = data[0].devices.find(d => d.device.id === 22326)
|
|
43
|
-
assert.equal(device.summary[5].startOdometer, 0)
|
|
44
|
-
assert.equal(device.summary[5].distance, 0)
|
|
45
|
-
assert.equal(device.summary[5].startTime, 0)
|
|
46
|
-
assert.equal(device.summary[5].endTime, 0)
|
|
47
|
-
}, 90000)
|
|
48
|
-
// eslint-disable-next-line no-undef
|
|
49
|
-
it('Activity check fuel consumption', async () => {
|
|
50
|
-
const report = await getReports()
|
|
51
|
-
const userData = await report.getUserData()
|
|
52
|
-
userData.devices = userData.devices.filter(d => d.id === 69114)
|
|
53
|
-
const data = await report.activityReport(new Date(2023, 5, 11, 0, 0, 0, 0),
|
|
54
|
-
new Date(2023, 6, 11, 23, 59, 59, 0),
|
|
55
|
-
userData)
|
|
56
|
-
assert.equal(data.length, 1)
|
|
57
|
-
const device = data[0].devices.find(d => d.device.id === 69114)
|
|
58
|
-
console.log(device)
|
|
59
|
-
assert.equal(device.summary[0].convertedSpentFuel, 168.6)
|
|
60
|
-
}, 800000)
|
|
61
|
-
// eslint-disable-next-line no-undef
|
|
62
|
-
it('Activity check fuel consumption group by day', async () => {
|
|
63
|
-
const report = await getReports()
|
|
64
|
-
const userData = await report.getUserData()
|
|
65
|
-
userData.groupByDay = true
|
|
66
|
-
userData.devices = userData.devices.filter(d => d.id === 69114)
|
|
67
|
-
const data = await report.activityReport(new Date(2023, 5, 11, 0, 0, 0, 0),
|
|
68
|
-
new Date(2023, 6, 11, 23, 59, 59, 0),
|
|
69
|
-
userData)
|
|
70
|
-
assert.equal(data.length, 1)
|
|
71
|
-
const device = data[0].devices.find(d => d.device.id === 69114)
|
|
72
|
-
console.log(device)
|
|
73
|
-
assert.equal(device.summary.reduce((a, b) => a + b.convertedSpentFuel, 0), 168.79999999999995)
|
|
74
|
-
}, 800000)
|
|
75
|
-
// eslint-disable-next-line no-undef
|
|
76
|
-
it('works with timetable', async () => {
|
|
77
|
-
const report = await getReports()
|
|
78
|
-
const userData = await report.getUserData()
|
|
79
|
-
userData.groupByDay = true
|
|
80
|
-
userData.allWeek = false
|
|
81
|
-
userData.weekDays = {
|
|
82
|
-
sunday: true,
|
|
83
|
-
monday: true,
|
|
84
|
-
tuesday: true,
|
|
85
|
-
wednesday: true,
|
|
86
|
-
thursday: true,
|
|
87
|
-
friday: true,
|
|
88
|
-
saturday: true
|
|
89
|
-
}
|
|
90
|
-
userData.dayHours = {
|
|
91
|
-
startTime: '22:00',
|
|
92
|
-
endTime: '05:00'
|
|
93
|
-
}
|
|
94
|
-
const data = await report.activityReport(new Date(2024, 1, 1, 0, 0, 0, 0),
|
|
95
|
-
new Date(2024, 1, 28, 23, 59, 59, 0),
|
|
96
|
-
userData)
|
|
97
|
-
assert.equal(data.length, 1)
|
|
98
|
-
}, 800000)
|
|
99
|
-
})
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const carbone = require('../carbone')
|
|
2
|
-
|
|
3
|
-
// eslint-disable-next-line no-undef
|
|
4
|
-
describe('test carbone', function () {
|
|
5
|
-
// eslint-disable-next-line no-undef
|
|
6
|
-
// eslint-disable-next-line no-undef
|
|
7
|
-
it('works', async () => {
|
|
8
|
-
try {
|
|
9
|
-
console.log(
|
|
10
|
-
await carbone.getPdf('a7322d5a19b6a37c3ceee4719ed701876a27e288f8b9b58b7e0f8c13b7f01bbb',
|
|
11
|
-
{
|
|
12
|
-
data: 1,
|
|
13
|
-
convertTo: 'pdf'
|
|
14
|
-
}))
|
|
15
|
-
} catch (e) {
|
|
16
|
-
console.error(e && e.response && e.response.data)
|
|
17
|
-
throw e
|
|
18
|
-
}
|
|
19
|
-
})
|
|
20
|
-
})
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
const { getReports } = require('./index')
|
|
2
|
-
// eslint-disable-next-line no-undef
|
|
3
|
-
describe('events', function () {
|
|
4
|
-
// eslint-disable-next-line no-undef
|
|
5
|
-
it('works with many devices', async () => {
|
|
6
|
-
const report = await getReports(process.env.USER_NOGARTEL, process.env.PASS_NOGARTEL)
|
|
7
|
-
const userData = await report.getUserData()
|
|
8
|
-
userData.devices = userData.devices.filter(d => d.name.startsWith('BBU-4428'))
|
|
9
|
-
userData.eventTypes = ['alarm_sensor']
|
|
10
|
-
console.log('devices.length', userData.devices.length)
|
|
11
|
-
const result = await report.eventsReport(
|
|
12
|
-
new Date(Date.UTC(2023, 8, 29, 0, 0, 0, 0)),
|
|
13
|
-
new Date(Date.UTC(2023, 8, 29, 23, 59, 59, 0)),
|
|
14
|
-
userData)
|
|
15
|
-
console.log('result', result[0].devices[0].alerts)
|
|
16
|
-
}, 4000000)
|
|
17
|
-
|
|
18
|
-
// eslint-disable-next-line no-undef
|
|
19
|
-
it('works with pois', async () => {
|
|
20
|
-
const report = await getReports(process.env.USER_NOGARTEL, process.env.PASS_NOGARTEL)
|
|
21
|
-
const userData = await report.getUserData()
|
|
22
|
-
userData.devices = userData.devices.filter(d => d.name === 'EPA5I95')
|
|
23
|
-
userData.eventTypes = ['ignitionOn']
|
|
24
|
-
const result = await report.eventsReport(
|
|
25
|
-
new Date(Date.UTC(2023, 8, 11, 0, 0, 0, 0)),
|
|
26
|
-
new Date(Date.UTC(2023, 8, 11, 23, 59, 59, 0)),
|
|
27
|
-
userData)
|
|
28
|
-
console.log('result', result)
|
|
29
|
-
}, 4000000)
|
|
30
|
-
})
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-undef */
|
|
2
|
-
const { getReports } = require('./index')
|
|
3
|
-
const assert = require('assert')
|
|
4
|
-
|
|
5
|
-
const deviceId = 122575
|
|
6
|
-
// eslint-disable-next-line no-undef
|
|
7
|
-
describe('Test_Reports', function () {
|
|
8
|
-
it('Trip by device', async () => {
|
|
9
|
-
console.log('trip by device')
|
|
10
|
-
const report = await getReports()
|
|
11
|
-
const userData = await report.getUserData()
|
|
12
|
-
|
|
13
|
-
const data = await report.tripReport(new Date(2023, 0, 26, 0, 0, 0, 0),
|
|
14
|
-
new Date(2023, 0, 26, 23, 59, 59, 0),
|
|
15
|
-
userData)
|
|
16
|
-
|
|
17
|
-
assert.equal(data.length, 1)
|
|
18
|
-
const device = data[0].devices.find(d => d.device.id === deviceId)
|
|
19
|
-
assert.equal(device.trips.length, 9) // Total Trips
|
|
20
|
-
}, 30000)
|
|
21
|
-
|
|
22
|
-
it('Fuel Consumption 1', async () => {
|
|
23
|
-
console.log('Fuel Consumption')
|
|
24
|
-
const report = await getReports(process.env.email, process.env.password)
|
|
25
|
-
const userData = await report.getUserData()
|
|
26
|
-
userData.devices = userData.devices.filter(d => d.id === 133608)
|
|
27
|
-
|
|
28
|
-
const data = await report.fuelConsumptionReport(new Date(2024, 2, 18, 0, 0, 0, 0),
|
|
29
|
-
new Date(2024, 2, 18, 23, 59, 59, 0),
|
|
30
|
-
userData)
|
|
31
|
-
|
|
32
|
-
const device = data[0].devices.find(d => d.device.id === 133608)
|
|
33
|
-
assert.equal(device.days[0].spentFuel, 9)
|
|
34
|
-
}, 30000)
|
|
35
|
-
})
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const { getReports } = require('./index')
|
|
2
|
-
// eslint-disable-next-line no-undef
|
|
3
|
-
describe('idle', function () {
|
|
4
|
-
// eslint-disable-next-line no-undef
|
|
5
|
-
it('works with afriquia', async () => {
|
|
6
|
-
const report = await getReports('moviflotte@gmail.com', 'moviflotte@gmail.com')
|
|
7
|
-
const userData = await report.getUserData()
|
|
8
|
-
console.log(userData.devices.length)
|
|
9
|
-
console.log(userData.geofences)
|
|
10
|
-
const result = await report.idleReport(
|
|
11
|
-
new Date(Date.UTC(2023, 5, 11, 0, 0, 0, 0)),
|
|
12
|
-
new Date(Date.UTC(2023, 5, 11, 23, 59, 59, 0)),
|
|
13
|
-
userData)
|
|
14
|
-
console.log('result', result)
|
|
15
|
-
}, 4000000)
|
|
16
|
-
})
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const Index = require('../index')
|
|
2
|
-
const { isClientSide } = require('../util/utils')
|
|
3
|
-
const { newDomains } = require('fleetmap-partners')
|
|
4
|
-
const serverHost = isClientSide() && newDomains.includes(window.location.hostname) ? window.location.hostname : 'api.pinme.io'
|
|
5
|
-
const traccarConfig = {
|
|
6
|
-
basePath: `https://${serverHost}/api`
|
|
7
|
-
}
|
|
8
|
-
process.env.TRACCAR_API_REPORTS = 'https://ltqgfyvcklxzaonv7h4rlmghai0rszop.lambda-url.us-east-1.on.aws/api'
|
|
9
|
-
process.env.SERVER_HOST = 'api.pinme.io'
|
|
10
|
-
const getReports = async () => {
|
|
11
|
-
try {
|
|
12
|
-
const axios = require('axios').create({
|
|
13
|
-
...traccarConfig.baseOptions,
|
|
14
|
-
baseURL: traccarConfig.basePath,
|
|
15
|
-
headers: { cookie: process.env.COOKIE }
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
return new Index(traccarConfig, axios)
|
|
19
|
-
} catch (e) {
|
|
20
|
-
console.error(e)
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
exports.getReports = getReports
|