fleetmap-reports 1.0.232 → 1.0.233
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/lang/enGB.js +0 -1
- package/lang/ptBR.js +0 -1
- package/lang/ptPT.js +0 -1
- package/package.json +1 -1
- package/src/index.js +1 -1
- package/src/index.test.js +14 -31
- package/src/kms-report.js +20 -21
- package/src/location-report.js +1 -1
- package/.idea/runConfigurations.xml +0 -10
- package/.idea/workspace.xml +0 -204
package/lang/enGB.js
CHANGED
package/lang/ptBR.js
CHANGED
package/lang/ptPT.js
CHANGED
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -23,7 +23,7 @@ function Reports(config, axios) {
|
|
|
23
23
|
return require('./speeding-report').createSpeedingReport(from, to, userData, this.traccar, roadSpeedLimits)
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
this.speedingReportToPDF =
|
|
26
|
+
this.speedingReportToPDF = (userData, reportData) => {
|
|
27
27
|
return require('./speeding-report').exportSpeedingReportToPDF(userData, reportData)
|
|
28
28
|
}
|
|
29
29
|
|
package/src/index.test.js
CHANGED
|
@@ -3,42 +3,25 @@ const {SessionApi} = require("traccar-api");
|
|
|
3
3
|
const axios = require('axios')
|
|
4
4
|
const axiosCookieJarSupport = require('axios-cookiejar-support').default;
|
|
5
5
|
const tough = require('tough-cookie');
|
|
6
|
-
const style = require("./reportStyle");
|
|
7
6
|
const cookieJar = new tough.CookieJar();
|
|
8
7
|
|
|
9
8
|
axiosCookieJarSupport(axios)
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
baseOptions: {
|
|
18
|
-
withCredentials: true,
|
|
19
|
-
jar: cookieJar
|
|
20
|
-
}
|
|
10
|
+
test('speedingReport', async () => {
|
|
11
|
+
const traccarConfig = {
|
|
12
|
+
basePath: 'https://api.pinme.io/api',
|
|
13
|
+
baseOptions: {
|
|
14
|
+
withCredentials: true,
|
|
15
|
+
jar: cookieJar
|
|
21
16
|
}
|
|
17
|
+
}
|
|
22
18
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
userData.groupByDay = true
|
|
27
|
-
const reportData = await report.kmsReport(new Date(2021, 10, 19, 0, 0, 0, 0),
|
|
28
|
-
new Date(2021, 10, 21, 23, 59, 59, 0),
|
|
29
|
-
userData)
|
|
30
|
-
|
|
31
|
-
const reportResult = reportData[0]
|
|
32
|
-
reportResult.devices.forEach(d => {
|
|
33
|
-
console.log(d.device.name)
|
|
34
|
-
d.days.forEach(day => {
|
|
35
|
-
console.log(day.date + ' - ' + day.kms)
|
|
36
|
-
})
|
|
37
|
-
})
|
|
38
|
-
|
|
19
|
+
await new SessionApi(traccarConfig, null, axios).sessionPost('-','-')
|
|
20
|
+
const report = new Index(traccarConfig, axios)
|
|
21
|
+
const userData = await report.getUserData()
|
|
39
22
|
|
|
40
|
-
|
|
23
|
+
await report.speedingReport(new Date(2021, 2, 30, 0, 0, 0, 0),
|
|
24
|
+
new Date(2021, 2, 30, 23, 59, 59, 0),
|
|
25
|
+
userData)
|
|
41
26
|
|
|
42
|
-
|
|
43
|
-
})
|
|
44
|
-
})
|
|
27
|
+
}, 10000)
|
package/src/kms-report.js
CHANGED
|
@@ -156,7 +156,7 @@ async function exportKmsReportToPDF(userData, reportData) {
|
|
|
156
156
|
const data = []
|
|
157
157
|
d.days.forEach(day => {
|
|
158
158
|
const temp = [
|
|
159
|
-
day.date,
|
|
159
|
+
new Date(day.date).toLocaleDateString(),
|
|
160
160
|
(day.kms/1000).toFixed(0)
|
|
161
161
|
]
|
|
162
162
|
|
|
@@ -240,7 +240,6 @@ function exportKmsReportToExcel(userData, reportData) {
|
|
|
240
240
|
if(userData.groupByDay) {
|
|
241
241
|
headers.push(
|
|
242
242
|
{label: translations.report.vehicle, value: 'name'},
|
|
243
|
-
{label: translations.report.licensePlate, value: 'licenseplate'},
|
|
244
243
|
{label: translations.report.group, value: 'group'},
|
|
245
244
|
{label: translations.report.date, value: 'date'},
|
|
246
245
|
{label: translations.report.distance, value: 'distance'})
|
|
@@ -251,8 +250,8 @@ function exportKmsReportToExcel(userData, reportData) {
|
|
|
251
250
|
{label: translations.report.distance, value: 'distance'})
|
|
252
251
|
} else {
|
|
253
252
|
headers.push(
|
|
254
|
-
{label: translations.report.
|
|
255
|
-
{label: translations.
|
|
253
|
+
{label: translations.report.driver, value: 'name'},
|
|
254
|
+
{label: translations.settings.vehicle_licenseplate, value: 'licenseplate'},
|
|
256
255
|
{label: translations.report.group, value: 'group'},
|
|
257
256
|
{label: translations.report.distance, value: 'distance'})
|
|
258
257
|
}
|
|
@@ -263,25 +262,25 @@ function exportKmsReportToExcel(userData, reportData) {
|
|
|
263
262
|
const group = userData.byDriver ? userData.groups.find(g => g.drivers.includes(d.driver.id)) :
|
|
264
263
|
userData.groups.find(g => d.device.groupId === g.id)
|
|
265
264
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
265
|
+
if (userData.groupByDay) {
|
|
266
|
+
data = data.concat([{}])
|
|
267
|
+
data = data.concat(d.days.map(a => {
|
|
268
|
+
return {
|
|
269
|
+
name: userData.byDriver ? d.driver.name : d.device.name,
|
|
270
|
+
group: group ? group.name : '',
|
|
271
|
+
licenseplate: d.device.attributes.license_plate,
|
|
272
|
+
date: a.date,
|
|
273
|
+
distance: Number((a.kms / 1000).toFixed(0))
|
|
274
|
+
}
|
|
275
|
+
}))
|
|
276
|
+
} else {
|
|
277
|
+
data = data.concat([{
|
|
278
|
+
name: userData.byDriver ? d.driver.name : d.summary.deviceName,
|
|
271
279
|
group: group ? group.name : '',
|
|
272
280
|
licenseplate: d.device.attributes.license_plate,
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}))
|
|
277
|
-
} else {
|
|
278
|
-
data = data.concat([{
|
|
279
|
-
name: userData.byDriver ? d.driver.name : d.summary.deviceName,
|
|
280
|
-
group: group ? group.name : '',
|
|
281
|
-
licenseplate: userData.byDriver ? '' : d.device.attributes.license_plate,
|
|
282
|
-
distance: Number((d.summary.distance / 1000).toFixed(0))
|
|
283
|
-
}])
|
|
284
|
-
}
|
|
281
|
+
distance: Number((d.summary.distance / 1000).toFixed(0))
|
|
282
|
+
}])
|
|
283
|
+
}
|
|
285
284
|
})
|
|
286
285
|
|
|
287
286
|
return {
|
package/src/location-report.js
CHANGED
|
@@ -139,7 +139,7 @@ async function exportLocationReportToPDF(userData, reportData) {
|
|
|
139
139
|
doc.text(new Date(d.from).toLocaleString() + ' - ' + new Date(d.to).toLocaleString(), 20, space + 25)
|
|
140
140
|
d.positions.map(a => {
|
|
141
141
|
const temp = [
|
|
142
|
-
|
|
142
|
+
a.fixTime,
|
|
143
143
|
a.address,
|
|
144
144
|
Math.round(a.speed * 1.85200),
|
|
145
145
|
a.attributes.ignition ? translations.report.ignitionOn : translations.report.ignitionOff,
|
|
@@ -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>
|
package/.idea/workspace.xml
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ChangeListManager">
|
|
4
|
-
<list default="true" id="eb665c86-c893-4333-bd2a-721dc27980b9" name="Changes" comment="Kms report grouped by day">
|
|
5
|
-
<change beforePath="$PROJECT_DIR$/lang/enGB.js" beforeDir="false" afterPath="$PROJECT_DIR$/lang/enGB.js" afterDir="false" />
|
|
6
|
-
<change beforePath="$PROJECT_DIR$/lang/ptBR.js" beforeDir="false" afterPath="$PROJECT_DIR$/lang/ptBR.js" afterDir="false" />
|
|
7
|
-
<change beforePath="$PROJECT_DIR$/lang/ptPT.js" beforeDir="false" afterPath="$PROJECT_DIR$/lang/ptPT.js" afterDir="false" />
|
|
8
|
-
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
|
|
9
|
-
<change beforePath="$PROJECT_DIR$/src/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/index.js" afterDir="false" />
|
|
10
|
-
<change beforePath="$PROJECT_DIR$/src/index.test.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/index.test.js" afterDir="false" />
|
|
11
|
-
<change beforePath="$PROJECT_DIR$/src/kms-report.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/kms-report.js" afterDir="false" />
|
|
12
|
-
</list>
|
|
13
|
-
<option name="SHOW_DIALOG" value="false" />
|
|
14
|
-
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
15
|
-
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
16
|
-
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
17
|
-
</component>
|
|
18
|
-
<component name="Git.Settings">
|
|
19
|
-
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
20
|
-
</component>
|
|
21
|
-
<component name="ProjectId" id="20NIxbej0qfi8RaO3jr1XOU0xol" />
|
|
22
|
-
<component name="ProjectViewState">
|
|
23
|
-
<option name="hideEmptyMiddlePackages" value="true" />
|
|
24
|
-
<option name="showLibraryContents" value="true" />
|
|
25
|
-
</component>
|
|
26
|
-
<component name="PropertiesComponent">
|
|
27
|
-
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
|
28
|
-
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
|
29
|
-
<property name="WebServerToolWindowFactoryState" value="false" />
|
|
30
|
-
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
|
31
|
-
<property name="nodejs.mocha.mocha_node_package_dir" value="$PROJECT_DIR$/node_modules/mocha" />
|
|
32
|
-
<property name="nodejs_package_manager_path" value="npm" />
|
|
33
|
-
<property name="ts.external.directory.path" value="$APPLICATION_HOME_DIR$/plugins/JavaScriptLanguage/jsLanguageServicesImpl/external" />
|
|
34
|
-
<property name="vue.rearranger.settings.migration" value="true" />
|
|
35
|
-
</component>
|
|
36
|
-
<component name="RunManager" selected="Mocha.test reports">
|
|
37
|
-
<configuration name="here" type="mocha-javascript-test-runner" temporary="true" nameIsGenerated="true">
|
|
38
|
-
<node-interpreter>project</node-interpreter>
|
|
39
|
-
<node-options />
|
|
40
|
-
<mocha-package>$PROJECT_DIR$/node_modules/mocha</mocha-package>
|
|
41
|
-
<working-directory>$PROJECT_DIR$</working-directory>
|
|
42
|
-
<pass-parent-env>true</pass-parent-env>
|
|
43
|
-
<ui>bdd</ui>
|
|
44
|
-
<extra-mocha-options />
|
|
45
|
-
<test-kind>SUITE</test-kind>
|
|
46
|
-
<test-file>$PROJECT_DIR$/src/index.test.js</test-file>
|
|
47
|
-
<test-names>
|
|
48
|
-
<name value="here" />
|
|
49
|
-
</test-names>
|
|
50
|
-
<method v="2" />
|
|
51
|
-
</configuration>
|
|
52
|
-
<configuration name="report" type="mocha-javascript-test-runner" temporary="true" nameIsGenerated="true">
|
|
53
|
-
<node-interpreter>project</node-interpreter>
|
|
54
|
-
<node-options />
|
|
55
|
-
<mocha-package>$PROJECT_DIR$/node_modules/mocha</mocha-package>
|
|
56
|
-
<working-directory>$PROJECT_DIR$</working-directory>
|
|
57
|
-
<pass-parent-env>true</pass-parent-env>
|
|
58
|
-
<ui>bdd</ui>
|
|
59
|
-
<extra-mocha-options />
|
|
60
|
-
<test-kind>SUITE</test-kind>
|
|
61
|
-
<test-file>$PROJECT_DIR$/src/index.test.js</test-file>
|
|
62
|
-
<test-names>
|
|
63
|
-
<name value="report" />
|
|
64
|
-
</test-names>
|
|
65
|
-
<method v="2" />
|
|
66
|
-
</configuration>
|
|
67
|
-
<configuration name="speedingReport" type="mocha-javascript-test-runner" temporary="true" nameIsGenerated="true">
|
|
68
|
-
<node-interpreter>project</node-interpreter>
|
|
69
|
-
<node-options />
|
|
70
|
-
<mocha-package>$PROJECT_DIR$/node_modules/mocha</mocha-package>
|
|
71
|
-
<working-directory>$PROJECT_DIR$</working-directory>
|
|
72
|
-
<pass-parent-env>true</pass-parent-env>
|
|
73
|
-
<ui>bdd</ui>
|
|
74
|
-
<extra-mocha-options />
|
|
75
|
-
<test-kind>TEST</test-kind>
|
|
76
|
-
<test-file>$PROJECT_DIR$/src/index.test.js</test-file>
|
|
77
|
-
<test-names>
|
|
78
|
-
<name value="speedingReport" />
|
|
79
|
-
</test-names>
|
|
80
|
-
<method v="2" />
|
|
81
|
-
</configuration>
|
|
82
|
-
<configuration name="test reports" type="mocha-javascript-test-runner" temporary="true" nameIsGenerated="true">
|
|
83
|
-
<node-interpreter>project</node-interpreter>
|
|
84
|
-
<node-options />
|
|
85
|
-
<mocha-package>$PROJECT_DIR$/node_modules/mocha</mocha-package>
|
|
86
|
-
<working-directory>$PROJECT_DIR$</working-directory>
|
|
87
|
-
<pass-parent-env>true</pass-parent-env>
|
|
88
|
-
<ui>bdd</ui>
|
|
89
|
-
<extra-mocha-options />
|
|
90
|
-
<test-kind>SUITE</test-kind>
|
|
91
|
-
<test-file>$PROJECT_DIR$/src/index.test.js</test-file>
|
|
92
|
-
<test-names>
|
|
93
|
-
<name value="test reports" />
|
|
94
|
-
</test-names>
|
|
95
|
-
<method v="2" />
|
|
96
|
-
</configuration>
|
|
97
|
-
<configuration name="test reports.test queue" type="mocha-javascript-test-runner" temporary="true" nameIsGenerated="true">
|
|
98
|
-
<node-interpreter>project</node-interpreter>
|
|
99
|
-
<node-options />
|
|
100
|
-
<mocha-package>$PROJECT_DIR$/node_modules/mocha</mocha-package>
|
|
101
|
-
<working-directory>$PROJECT_DIR$</working-directory>
|
|
102
|
-
<pass-parent-env>true</pass-parent-env>
|
|
103
|
-
<ui>bdd</ui>
|
|
104
|
-
<extra-mocha-options />
|
|
105
|
-
<test-kind>TEST</test-kind>
|
|
106
|
-
<test-file>$PROJECT_DIR$/src/index.test.js</test-file>
|
|
107
|
-
<test-names>
|
|
108
|
-
<name value="test reports" />
|
|
109
|
-
<name value="test queue" />
|
|
110
|
-
</test-names>
|
|
111
|
-
<method v="2" />
|
|
112
|
-
</configuration>
|
|
113
|
-
<recent_temporary>
|
|
114
|
-
<list>
|
|
115
|
-
<item itemvalue="Mocha.test reports" />
|
|
116
|
-
<item itemvalue="Mocha.test reports.test queue" />
|
|
117
|
-
<item itemvalue="Mocha.speedingReport" />
|
|
118
|
-
<item itemvalue="Mocha.report" />
|
|
119
|
-
<item itemvalue="Mocha.here" />
|
|
120
|
-
</list>
|
|
121
|
-
</recent_temporary>
|
|
122
|
-
</component>
|
|
123
|
-
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
|
124
|
-
<component name="TaskManager">
|
|
125
|
-
<task active="true" id="Default" summary="Default task">
|
|
126
|
-
<changelist id="eb665c86-c893-4333-bd2a-721dc27980b9" name="Changes" comment="" />
|
|
127
|
-
<created>1635878866368</created>
|
|
128
|
-
<option name="number" value="Default" />
|
|
129
|
-
<option name="presentableId" value="Default" />
|
|
130
|
-
<updated>1635878866368</updated>
|
|
131
|
-
<workItem from="1635878870054" duration="105000" />
|
|
132
|
-
<workItem from="1635943211865" duration="371000" />
|
|
133
|
-
<workItem from="1636030918716" duration="808000" />
|
|
134
|
-
<workItem from="1636366400735" duration="3018000" />
|
|
135
|
-
<workItem from="1636371409243" duration="45000" />
|
|
136
|
-
<workItem from="1636371621773" duration="4750000" />
|
|
137
|
-
<workItem from="1636623371114" duration="675000" />
|
|
138
|
-
<workItem from="1636624396937" duration="1987000" />
|
|
139
|
-
<workItem from="1636627666406" duration="1616000" />
|
|
140
|
-
<workItem from="1636647112207" duration="1748000" />
|
|
141
|
-
<workItem from="1636981640447" duration="4315000" />
|
|
142
|
-
<workItem from="1637009407292" duration="1470000" />
|
|
143
|
-
<workItem from="1637012863006" duration="5376000" />
|
|
144
|
-
<workItem from="1637087797229" duration="5701000" />
|
|
145
|
-
<workItem from="1637227826845" duration="1275000" />
|
|
146
|
-
<workItem from="1637441942952" duration="4543000" />
|
|
147
|
-
<workItem from="1637670815688" duration="2973000" />
|
|
148
|
-
<workItem from="1637674107929" duration="13419000" />
|
|
149
|
-
<workItem from="1637756665591" duration="3093000" />
|
|
150
|
-
</task>
|
|
151
|
-
<task id="LOCAL-00001" summary="Fix getStyle">
|
|
152
|
-
<created>1636983717385</created>
|
|
153
|
-
<option name="number" value="00001" />
|
|
154
|
-
<option name="presentableId" value="LOCAL-00001" />
|
|
155
|
-
<option name="project" value="LOCAL" />
|
|
156
|
-
<updated>1636983717385</updated>
|
|
157
|
-
</task>
|
|
158
|
-
<task id="LOCAL-00002" summary="Fix getStyle in all reports">
|
|
159
|
-
<created>1637020728356</created>
|
|
160
|
-
<option name="number" value="00002" />
|
|
161
|
-
<option name="presentableId" value="LOCAL-00002" />
|
|
162
|
-
<option name="project" value="LOCAL" />
|
|
163
|
-
<updated>1637020728356</updated>
|
|
164
|
-
</task>
|
|
165
|
-
<task id="LOCAL-00003" summary="try catch on pdf addImage">
|
|
166
|
-
<created>1637247013210</created>
|
|
167
|
-
<option name="number" value="00003" />
|
|
168
|
-
<option name="presentableId" value="LOCAL-00003" />
|
|
169
|
-
<option name="project" value="LOCAL" />
|
|
170
|
-
<updated>1637247013211</updated>
|
|
171
|
-
</task>
|
|
172
|
-
<task id="LOCAL-00004" summary="Kms report grouped by day">
|
|
173
|
-
<created>1637715473148</created>
|
|
174
|
-
<option name="number" value="00004" />
|
|
175
|
-
<option name="presentableId" value="LOCAL-00004" />
|
|
176
|
-
<option name="project" value="LOCAL" />
|
|
177
|
-
<updated>1637715473149</updated>
|
|
178
|
-
</task>
|
|
179
|
-
<option name="localTasksCounter" value="5" />
|
|
180
|
-
<servers />
|
|
181
|
-
</component>
|
|
182
|
-
<component name="TypeScriptGeneratedFilesManager">
|
|
183
|
-
<option name="version" value="3" />
|
|
184
|
-
</component>
|
|
185
|
-
<component name="Vcs.Log.Tabs.Properties">
|
|
186
|
-
<option name="TAB_STATES">
|
|
187
|
-
<map>
|
|
188
|
-
<entry key="MAIN">
|
|
189
|
-
<value>
|
|
190
|
-
<State />
|
|
191
|
-
</value>
|
|
192
|
-
</entry>
|
|
193
|
-
</map>
|
|
194
|
-
</option>
|
|
195
|
-
<option name="oldMeFiltersMigrated" value="true" />
|
|
196
|
-
</component>
|
|
197
|
-
<component name="VcsManagerConfiguration">
|
|
198
|
-
<MESSAGE value="Fix getStyle" />
|
|
199
|
-
<MESSAGE value="Fix getStyle in all reports" />
|
|
200
|
-
<MESSAGE value="try catch on pdf addImage" />
|
|
201
|
-
<MESSAGE value="Kms report grouped by day" />
|
|
202
|
-
<option name="LAST_COMMIT_MESSAGE" value="Kms report grouped by day" />
|
|
203
|
-
</component>
|
|
204
|
-
</project>
|