aboutsummaryrefslogtreecommitdiff
path: root/modern/src/reports/SummaryReportPage.js
diff options
context:
space:
mode:
authorAshutosh Bishnoi <mail2bishnoi@gmail.com>2020-11-14 09:02:34 +0530
committerAshutosh Bishnoi <mail2bishnoi@gmail.com>2020-11-14 09:02:34 +0530
commit37ff59bbdc540bf2293a96ecbedcf210f6b4548a (patch)
tree6c316a5c0774ef0b57907dc677c8cb6c0ae02a06 /modern/src/reports/SummaryReportPage.js
parent28d1fc9ce25922467498df1a0b602afc37ca89af (diff)
downloadtrackermap-web-37ff59bbdc540bf2293a96ecbedcf210f6b4548a.tar.gz
trackermap-web-37ff59bbdc540bf2293a96ecbedcf210f6b4548a.tar.bz2
trackermap-web-37ff59bbdc540bf2293a96ecbedcf210f6b4548a.zip
Adding DailySummary param to summary report and minor code improvements
Diffstat (limited to 'modern/src/reports/SummaryReportPage.js')
-rw-r--r--modern/src/reports/SummaryReportPage.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/modern/src/reports/SummaryReportPage.js b/modern/src/reports/SummaryReportPage.js
index e482d0fa..c90ddb4a 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 = () => {