aboutsummaryrefslogtreecommitdiff
path: root/modern/src
diff options
context:
space:
mode:
authorAshutosh Bishnoi <mail2bishnoi@gmail.com>2021-03-24 10:40:31 +0530
committerAshutosh Bishnoi <mail2bishnoi@gmail.com>2021-03-24 10:40:31 +0530
commit31d7007d6a199299e541a93477342e3eef73aa47 (patch)
tree564d98d68a44ec94ca3b98675908f19659f64761 /modern/src
parentfb10eae09daf7e922ee5e2d94785d55b8b5f6b4b (diff)
downloadtrackermap-web-31d7007d6a199299e541a93477342e3eef73aa47.tar.gz
trackermap-web-31d7007d6a199299e541a93477342e3eef73aa47.tar.bz2
trackermap-web-31d7007d6a199299e541a93477342e3eef73aa47.zip
Some more code improvements
Diffstat (limited to 'modern/src')
-rw-r--r--modern/src/reports/RouteReportPage.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/modern/src/reports/RouteReportPage.js b/modern/src/reports/RouteReportPage.js
index 1c13a132..807207d8 100644
--- a/modern/src/reports/RouteReportPage.js
+++ b/modern/src/reports/RouteReportPage.js
@@ -1,7 +1,7 @@
import React, { useState } from 'react';
import { DataGrid } from '@material-ui/data-grid';
import t from '../common/localization';
-import { formatPosition, formatDistance } from '../common/formatter';
+import { formatPosition, formatDistance, formatSpeed, formatBoolean, formatDate, formatNumber } from '../common/formatter';
import ReportFilter from './ReportFilter';
import ReportLayoutPage from './ReportLayoutPage';
import { useAttributePreference } from '../common/preferences';
@@ -28,31 +28,32 @@ const Filter = ({ setItems }) => {
const RouteReportPage = () => {
const distanceUnit = useAttributePreference('distanceUnit');
+ const speedUnit = useAttributePreference('speedUnit');
const columns = [{
headerName: t('positionFixTime'),
field: 'fixTime',
type: 'dateTime',
flex: 1,
- valueFormatter: ({ value }) => formatPosition(value, 'fixTime'),
+ valueFormatter: ({ value }) => formatDate(value),
}, {
headerName: t('positionLatitude'),
field: 'latitude',
type: 'number',
flex: 1,
- valueFormatter: ({ value }) => formatPosition(value, 'latitude'),
+ valueFormatter: ({ value }) => formatNumber(value, 5),
}, {
headerName: t('positionLongitude'),
field: 'longitude',
type: 'number',
flex: 1,
- valueFormatter: ({ value }) => formatPosition(value, 'longitude'),
+ valueFormatter: ({ value }) => formatNumber(value, 5),
}, {
headerName: t('positionSpeed'),
field: 'speed',
type: 'number',
flex: 1,
- valueFormatter: ({ value }) => formatPosition(value, 'speed'),
+ valueFormatter: ({ value }) => formatSpeed(value, speedUnit),
}, {
headerName: t('positionAddress'),
field: 'address',
@@ -65,7 +66,7 @@ const RouteReportPage = () => {
type: 'boolean',
flex: 1,
valueGetter: ({ row }) => row.attributes.ignition,
- valueFormatter: ({ value }) => value ? 'Yes' : 'No',
+ valueFormatter: ({ value }) => formatBoolean(value),
}, {
headerName: t('deviceTotalDistance'),
field: 'totalDistance',