diff options
author | Ashutosh Bishnoi <mail2bishnoi@gmail.com> | 2020-11-13 12:19:51 +0530 |
---|---|---|
committer | Ashutosh Bishnoi <mail2bishnoi@gmail.com> | 2020-11-13 12:19:51 +0530 |
commit | 651dfa0ca0626a47c684077ab39feeade177a28d (patch) | |
tree | 050ad5109ac0eb6fc0386a1292eeb6a6e75057c4 /modern/src/reports | |
parent | d7bfb9ac6fabf09f4675ea58bc58e12dbd04eee9 (diff) | |
download | etbsa-traccar-web-651dfa0ca0626a47c684077ab39feeade177a28d.tar.gz etbsa-traccar-web-651dfa0ca0626a47c684077ab39feeade177a28d.tar.bz2 etbsa-traccar-web-651dfa0ca0626a47c684077ab39feeade177a28d.zip |
Minor bug fixes and improvements in Trips report
Diffstat (limited to 'modern/src/reports')
-rw-r--r-- | modern/src/reports/TripReportPage.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/modern/src/reports/TripReportPage.js b/modern/src/reports/TripReportPage.js index 89f2240..71b9596 100644 --- a/modern/src/reports/TripReportPage.js +++ b/modern/src/reports/TripReportPage.js @@ -1,7 +1,7 @@ import React, { useState } from 'react'; import { TableContainer, Table, TableRow, TableCell, TableHead, TableBody, Paper } from '@material-ui/core'; import t from '../common/localization'; -import { formatPosition, formatDistance, formatSpeed, formatHours } from '../common/formatter'; +import { formatPosition, formatDistance, formatSpeed, formatHours, formatDate } from '../common/formatter'; import ReportFilter from './ReportFilter'; import ReportLayoutPage from './ReportLayoutPage'; import { useAttributePreference } from '../common/preferences'; @@ -15,7 +15,7 @@ const ReportFilterForm = ({ onResult }) => { to: to.toISOString(), }); const response = await fetch(`/api/reports/trips?${query.toString()}`, { headers: { Accept: 'application/json' } }); - if(response.ok) { + if (response.ok) { onResult(await response.json()); } } @@ -26,6 +26,7 @@ const TripReportPage = () => { const distanceUnit = useAttributePreference('distanceUnit'); const speedUnit = useAttributePreference('speedUnit'); const [items, setItems] = useState([]); + return ( <ReportLayoutPage reportFilterForm={ReportFilterForm} setItems={setItems}> <TableContainer component={Paper}> @@ -45,9 +46,9 @@ const TripReportPage = () => { <TableBody> {items.map((item) => ( <TableRow key={item.id}> - <TableCell>{formatPosition(item, 'startTime')}</TableCell> + <TableCell>{formatDate(item.startTime)}</TableCell> <TableCell>{formatDistance(item.startOdometer, distanceUnit)}</TableCell> - <TableCell>{formatPosition(item, 'endTime')}</TableCell> + <TableCell>{formatDate(item.endTime)}</TableCell> <TableCell>{formatDistance(item.endOdometer, distanceUnit)}</TableCell> <TableCell>{formatDistance(item.distance, distanceUnit)}</TableCell> <TableCell>{formatSpeed(item.averageSpeed, speedUnit)}</TableCell> |