aboutsummaryrefslogtreecommitdiff
path: root/modern/src/reports/TripReportPage.js
diff options
context:
space:
mode:
authorAshutosh Bishnoi <mail2bishnoi@gmail.com>2021-05-31 14:17:13 +0530
committerAshutosh Bishnoi <mail2bishnoi@gmail.com>2021-05-31 14:17:13 +0530
commit8e1bddcc608ba4e52699c30084f5ef950bd7e329 (patch)
tree540c52116542c484f74a09042d83653582b5dc77 /modern/src/reports/TripReportPage.js
parent402b30df63f6dfafda32ae37aa2d4df9ef638fd2 (diff)
downloadetbsa-traccar-web-8e1bddcc608ba4e52699c30084f5ef950bd7e329.tar.gz
etbsa-traccar-web-8e1bddcc608ba4e52699c30084f5ef950bd7e329.tar.bz2
etbsa-traccar-web-8e1bddcc608ba4e52699c30084f5ef950bd7e329.zip
Finalizing reports implemetations
Diffstat (limited to 'modern/src/reports/TripReportPage.js')
-rw-r--r--modern/src/reports/TripReportPage.js29
1 files changed, 16 insertions, 13 deletions
diff --git a/modern/src/reports/TripReportPage.js b/modern/src/reports/TripReportPage.js
index 45a7786..ab5f449 100644
--- a/modern/src/reports/TripReportPage.js
+++ b/modern/src/reports/TripReportPage.js
@@ -1,10 +1,11 @@
import React, { useState } from 'react';
import { DataGrid } from '@material-ui/data-grid';
-import t from '../common/localization';
+import { useTheme } from "@material-ui/core/styles";
import { formatDistance, formatSpeed, formatHours, formatDate, 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 }) => {
@@ -27,6 +28,8 @@ const Filter = ({ setItems }) => {
}
const TripReportPage = () => {
+
+ const theme = useTheme();
const distanceUnit = useAttributePreference('distanceUnit');
const speedUnit = useAttributePreference('speedUnit');
@@ -38,74 +41,74 @@ const TripReportPage = () => {
headerName: t('reportStartTime'),
field: 'startTime',
type: 'dateTime',
- flex: 1,
+ width: theme.dimensions.dateColumnWidth,
valueFormatter: ({ value }) => formatDate(value),
}, {
headerName: t('reportStartOdometer'),
field: 'startOdometer',
type: 'number',
- flex: 1,
+ width: theme.dimensions.numberColumnWidth,
valueFormatter: ({ value }) => formatDistance(value, distanceUnit),
}, {
headerName: t('reportStartAddress'),
field: 'startAddress',
type: 'string',
hide: true,
- flex: 1,
+ width: theme.dimensions.stringColumnWidth,
}, {
headerName: t('reportEndTime'),
field: 'endTime',
type: 'dateTime',
- flex: 1,
+ width: theme.dimensions.dateColumnWidth,
valueFormatter: ({ value }) => formatDate(value),
}, {
headerName: t('reportEndOdometer'),
field: 'endOdometer',
type: 'number',
- flex: 1,
+ width: theme.dimensions.numberColumnWidth,
valueFormatter: ({ value }) => formatDistance(value, distanceUnit),
}, {
headerName: t('reportEndAddress'),
field: 'endAddress',
type: 'string',
hide: true,
- flex: 1,
+ width: theme.dimensions.stringColumnWidth,
}, {
headerName: t('sharedDistance'),
field: 'distance',
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('reportDuration'),
field: 'duration',
type: 'string',
- flex: 1,
+ width: theme.dimensions.stringColumnWidth,
valueFormatter: ({ value }) => formatHours(value),
}, {
headerName: t('reportSpentFuel'),
field: 'spentFuel',
type: 'number',
- flex: 1,
+ width: theme.dimensions.numberColumnWidth,
hide: true,
valueFormatter: ({ value }) => formatVolume(value, volumeUnit),
}, {
headerName: t('sharedDriver'),
field: 'driverName',
type: 'string',
- flex: 1,
+ width: theme.dimensions.stringColumnWidth,
hide: true
}]