aboutsummaryrefslogtreecommitdiff
path: root/modern/src
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src')
-rw-r--r--modern/src/App.js2
-rw-r--r--modern/src/MainToolbar.js6
-rw-r--r--modern/src/common/formatter.js2
-rw-r--r--modern/src/reports/SummaryReportPage.js13
4 files changed, 11 insertions, 12 deletions
diff --git a/modern/src/App.js b/modern/src/App.js
index c54e648..8a308c1 100644
--- a/modern/src/App.js
+++ b/modern/src/App.js
@@ -21,7 +21,6 @@ import { LinearProgress } from '@material-ui/core';
import TripReportPage from './reports/TripReportPage';
import StopReportPage from './reports/StopReportPage';
import SummaryReportPage from './reports/SummaryReportPage';
-import DailySummaryReportPage from './reports/DailySummaryReportPage';
const App = () => {
const initialized = useSelector(state => !!state.session.server && !!state.session.user);
@@ -51,7 +50,6 @@ const App = () => {
<Route exact path='/reports/trip' component={TripReportPage} />
<Route exact path='/reports/stop' component={StopReportPage} />
<Route exact path='/reports/summary' component={SummaryReportPage} />
- <Route exact path='/reports/daily-summary' component={DailySummaryReportPage} />
</Switch>
)}
</Route>
diff --git a/modern/src/MainToolbar.js b/modern/src/MainToolbar.js
index a2a9c9f..a899950 100644
--- a/modern/src/MainToolbar.js
+++ b/modern/src/MainToolbar.js
@@ -140,12 +140,6 @@ const MainToolbar = () => {
<FormatListBulletedIcon />
</ListItemIcon>
<ListItemText primary={t('reportSummary')} />
- </ListItem>
- <ListItem button onClick={() => history.push('/reports/daily-summary')}>
- <ListItemIcon>
- <FormatListBulletedIcon />
- </ListItemIcon>
- <ListItemText primary={t('reportDaily')} />
</ListItem>
<ListItem button disabled>
<ListItemIcon>
diff --git a/modern/src/common/formatter.js b/modern/src/common/formatter.js
index 7221618..e41e591 100644
--- a/modern/src/common/formatter.js
+++ b/modern/src/common/formatter.js
@@ -9,8 +9,6 @@ export const formatPosition = (value, key) => {
case 'fixTime':
case 'deviceTime':
case 'serverTime':
- case 'startTime':
- case 'endTime':
return moment(value).format('LLL');
case 'latitude':
case 'longitude':
diff --git a/modern/src/reports/SummaryReportPage.js b/modern/src/reports/SummaryReportPage.js
index e482d0f..c90ddb4 100644
--- a/modern/src/reports/SummaryReportPage.js
+++ b/modern/src/reports/SummaryReportPage.js
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
-import { TableContainer, Table, TableRow, TableCell, TableHead, TableBody, Paper } from '@material-ui/core';
+import { TableContainer, Table, TableRow, TableCell, TableHead, TableBody, Paper, FormControlLabel, Checkbox } from '@material-ui/core';
import t from '../common/localization';
import { formatDistance, formatHours, formatDate, formatSpeed, formatVolume } from '../common/formatter';
import ReportFilter from './ReportFilter';
@@ -8,18 +8,27 @@ import { useAttributePreference } from '../common/preferences';
const ReportFilterForm = ({ onResult }) => {
+ const [daily, setDaily] = useState(false);
+
const handleSubmit = async (deviceId, from, to) => {
const query = new URLSearchParams({
deviceId,
from: from.toISOString(),
to: to.toISOString(),
+ daily
});
const response = await fetch(`/api/reports/summary?${query.toString()}`, { headers: { Accept: 'application/json' } });
if (response.ok) {
onResult(await response.json());
}
}
- return <ReportFilter handleSubmit={handleSubmit} />;
+ return (
+ <ReportFilter handleSubmit={handleSubmit}>
+ <FormControlLabel
+ control={<Checkbox checked={daily} onChange={event => setDaily(event.target.checked)} />}
+ label={t('reportDaily')} />
+ </ReportFilter>
+ );
}
const SummaryReportPage = () => {