From 04bff93e3244708471176f22b8d5c4d9f7da764f Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Thu, 18 Mar 2021 13:44:47 +0530 Subject: More code improvements --- modern/src/reports/RouteReportPage.js | 54 +++++++++++++++++------------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/modern/src/reports/RouteReportPage.js b/modern/src/reports/RouteReportPage.js index 48a13737..6bfe993c 100644 --- a/modern/src/reports/RouteReportPage.js +++ b/modern/src/reports/RouteReportPage.js @@ -29,49 +29,49 @@ const Filter = ({ setItems }) => { const RouteReportPage = () => { const distanceUnit = useAttributePreference('distanceUnit'); - const columns = [ - { + const columns = [{ headerName: t('positionFixTime'), field: 'fixTime', + type: 'dateTime', flex: 1, - valueFormatter: params => formatPosition(params.value, 'fixTime'), - }, - { + valueFormatter: ({ value }) => formatPosition(value, 'fixTime'), + }, { headerName: t('positionLatitude'), field: 'latitude', + type: 'number', flex: 1, - valueFormatter: params => formatPosition(params.value, 'latitude'), - }, - { + valueFormatter: ({ value }) => formatPosition(value, 'latitude'), + }, { headerName: t('positionLongitude'), field: 'longitude', + type: 'number', flex: 1, - valueFormatter: params => formatPosition(params.value, 'longitude'), - }, - { + valueFormatter: ({ value }) => formatPosition(value, 'longitude'), + }, { headerName: t('positionSpeed'), field: 'speed', + type: 'number', flex: 1, - valueFormatter: params => formatPosition(params.value, 'speed'), - }, - { + valueFormatter: ({ value }) => formatPosition(value, 'speed'), + }, { headerName: t('positionAddress'), field: 'address', + type: 'string', flex: 1, - valueFormatter: params => formatPosition(params.value, 'address'), - }, - { + valueFormatter: ({ value }) => formatPosition(value, 'address'), + }, { headerName: t('positionIgnition'), field: 'ignition', + type: 'boolean', flex: 1, - valueFormatter: params => params.getValue('attributes').ignition ? 'Yes' : 'No', - }, - { + valueFormatter: ({ getValue }) => getValue('attributes').ignition ? 'Yes' : 'No', + }, { headerName: t('deviceTotalDistance'), - hide: true, field: 'totalDistance', + type: 'number', + hide: true, flex: 1, - valueFormatter: params => formatDistance(params.getValue('attributes').totalDistance, distanceUnit), + valueFormatter: ({ getValue }) => formatDistance(getValue('attributes').totalDistance, distanceUnit), }, ] @@ -79,11 +79,11 @@ const RouteReportPage = () => { return ( }> - + ); }; -- cgit v1.2.3