aboutsummaryrefslogtreecommitdiff
path: root/modern/src/reports/SummaryReportPage.js
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/reports/SummaryReportPage.js')
-rw-r--r--modern/src/reports/SummaryReportPage.js38
1 files changed, 21 insertions, 17 deletions
diff --git a/modern/src/reports/SummaryReportPage.js b/modern/src/reports/SummaryReportPage.js
index 53e697d..4523e65 100644
--- a/modern/src/reports/SummaryReportPage.js
+++ b/modern/src/reports/SummaryReportPage.js
@@ -1,19 +1,22 @@
import React, { useState } from 'react';
import { DataGrid } from '@material-ui/data-grid';
import { Grid, FormControlLabel, Checkbox } from '@material-ui/core';
-import { useTheme } from "@material-ui/core/styles";
-import { formatDistance, formatHours, formatDate, formatSpeed, formatVolume } from '../common/formatter';
+import { useTheme } from '@material-ui/core/styles';
+import {
+ formatDistance, formatHours, formatDate, formatSpeed, formatVolume,
+} from '../common/formatter';
import ReportFilter from './ReportFilter';
import ReportLayout from './ReportLayout';
import { useAttributePreference } from '../common/preferences';
import t from '../common/localization';
const Filter = ({ setItems }) => {
-
const [daily, setDaily] = useState(false);
const handleSubmit = async (deviceId, from, to, mail, headers) => {
- const query = new URLSearchParams({ deviceId, from, to, daily, mail });
+ const query = new URLSearchParams({
+ deviceId, from, to, daily, mail,
+ });
const response = await fetch(`/api/reports/summary?${query.toString()}`, { headers });
if (response.ok) {
const contentType = response.headers.get('content-type');
@@ -25,21 +28,21 @@ const Filter = ({ setItems }) => {
}
}
}
- }
+ };
return (
<ReportFilter handleSubmit={handleSubmit}>
<Grid item xs={12} sm={6}>
<FormControlLabel
- control={<Checkbox checked={daily} onChange={e => setDaily(e.target.checked)} />}
- label={t('reportDaily')} />
+ control={<Checkbox checked={daily} onChange={(e) => setDaily(e.target.checked)} />}
+ label={t('reportDaily')}
+ />
</Grid>
</ReportFilter>
);
-}
+};
const SummaryReportPage = () => {
-
const theme = useTheme();
const distanceUnit = useAttributePreference('distanceUnit');
@@ -96,19 +99,20 @@ const SummaryReportPage = () => {
type: 'number',
width: theme.dimensions.columnWidthNumber,
hide: true,
- valueFormatter: ({ value }) => formatVolume(value, volumeUnit),
- }]
-
+ valueFormatter: ({ value }) => formatVolume(value, volumeUnit),
+ }];
+
return (
<ReportLayout filter={<Filter setItems={setItems} />}>
<DataGrid
- rows={items}
- columns={columns}
- hideFooter
+ rows={items}
+ columns={columns}
+ hideFooter
autoHeight
- getRowId={() => Math.random()} />
+ getRowId={() => Math.random()}
+ />
</ReportLayout>
);
-}
+};
export default SummaryReportPage;