From 8e1bddcc608ba4e52699c30084f5ef950bd7e329 Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Mon, 31 May 2021 14:17:13 +0530 Subject: Finalizing reports implemetations --- modern/src/reports/SummaryReportPage.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'modern/src/reports/SummaryReportPage.js') diff --git a/modern/src/reports/SummaryReportPage.js b/modern/src/reports/SummaryReportPage.js index f63f50b..a2392f2 100644 --- a/modern/src/reports/SummaryReportPage.js +++ b/modern/src/reports/SummaryReportPage.js @@ -1,11 +1,12 @@ import React, { useState } from 'react'; import { DataGrid } from '@material-ui/data-grid'; import { Grid, FormControlLabel, Checkbox } from '@material-ui/core'; -import t from '../common/localization'; +import { useTheme } from "@material-ui/core/styles"; import { formatDistance, formatHours, formatDate, formatSpeed, formatVolume } from '../common/formatter'; import ReportFilter from './ReportFilter'; import ReportLayoutPage from './ReportLayoutPage'; import { useAttributePreference } from '../common/preferences'; +import t from '../common/localization'; const Filter = ({ setItems }) => { @@ -39,6 +40,8 @@ const Filter = ({ setItems }) => { const SummaryReportPage = () => { + const theme = useTheme(); + const distanceUnit = useAttributePreference('distanceUnit'); const speedUnit = useAttributePreference('speedUnit'); const volumeUnit = useAttributePreference('volumeUnit'); @@ -49,49 +52,49 @@ const SummaryReportPage = () => { headerName: t('reportStartDate'), field: 'startTime', type: 'dateTime', - flex: 1, + width: theme.dimensions.dateColumnWidth, valueFormatter: ({ value }) => formatDate(value, 'YYYY-MM-DD'), }, { headerName: t('sharedDistance'), field: 'distance', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }, { headerName: t('reportStartOdometer'), field: 'startOdometer', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }, { headerName: t('reportEndOdometer'), field: 'endOdometer', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, valueFormatter: ({ value }) => formatDistance(value, distanceUnit), }, { headerName: t('reportAverageSpeed'), field: 'averageSpeed', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, valueFormatter: ({ value }) => formatSpeed(value, speedUnit), }, { headerName: t('reportMaximumSpeed'), field: 'maxSpeed', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, valueFormatter: ({ value }) => formatSpeed(value, speedUnit), }, { headerName: t('reportEngineHours'), field: 'engineHours', type: 'string', - flex: 1, + width: theme.dimensions.numberColumnWidth, valueFormatter: ({ value }) => formatHours(value), }, { headerName: t('reportSpentFuel'), field: 'spentFuel', type: 'number', - flex: 1, + width: theme.dimensions.numberColumnWidth, hide: true, valueFormatter: ({ value }) => formatVolume(value, volumeUnit), }] -- cgit v1.2.3