diff options
author | Ashutosh Bishnoi <mail2bishnoi@gmail.com> | 2021-03-18 13:44:47 +0530 |
---|---|---|
committer | Ashutosh Bishnoi <mail2bishnoi@gmail.com> | 2021-03-18 13:44:47 +0530 |
commit | 04bff93e3244708471176f22b8d5c4d9f7da764f (patch) | |
tree | fc9d4fdb3fadafce8318e80d227106bcbc9a788b /modern/src/reports | |
parent | fac4b2c8679f459a184c41eeee18f81edbd1ee77 (diff) | |
download | trackermap-web-04bff93e3244708471176f22b8d5c4d9f7da764f.tar.gz trackermap-web-04bff93e3244708471176f22b8d5c4d9f7da764f.tar.bz2 trackermap-web-04bff93e3244708471176f22b8d5c4d9f7da764f.zip |
More code improvements
Diffstat (limited to 'modern/src/reports')
-rw-r--r-- | modern/src/reports/RouteReportPage.js | 54 |
1 files 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 ( <ReportLayoutPage filter={<Filter setItems={setItems} />}> - <DataGrid - rows={items} - columns={columns} - hideFooter - autoHeight/> + <DataGrid + rows={items} + columns={columns} + hideFooter + autoHeight /> </ReportLayoutPage> ); }; |