From 589244b4a65813271440d11c09fa63dfb4d8ad78 Mon Sep 17 00:00:00 2001 From: Ashutosh Bishnoi Date: Mon, 17 May 2021 13:09:25 +0530 Subject: Sidebar and Report Filter completed --- modern/src/reports/ChartReportPage.js | 22 +++-- modern/src/reports/EventReportPage.js | 50 +++++----- modern/src/reports/ReportFilter.js | 157 +++++++++++++++----------------- modern/src/reports/ReportLayoutPage.js | 61 +++++++------ modern/src/reports/SummaryReportPage.js | 10 +- modern/src/theme/dimensions.js | 4 +- 6 files changed, 154 insertions(+), 150 deletions(-) (limited to 'modern') diff --git a/modern/src/reports/ChartReportPage.js b/modern/src/reports/ChartReportPage.js index 80424cc..c75c9b7 100644 --- a/modern/src/reports/ChartReportPage.js +++ b/modern/src/reports/ChartReportPage.js @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { FormControl, InputLabel, Select, MenuItem } from '@material-ui/core'; +import { Grid, FormControl, InputLabel, Select, MenuItem } from '@material-ui/core'; import ReportLayoutPage from './ReportLayoutPage'; import ReportFilter from './ReportFilter'; import Graph from './Graph'; @@ -39,14 +39,18 @@ const Filter = ({ children, setItems }) => { const ChartType = ({ type, setType }) => { return ( - - {t('reportChartType')} - - + + + + {t('reportChartType')} + + + + ) } diff --git a/modern/src/reports/EventReportPage.js b/modern/src/reports/EventReportPage.js index daa4ab8..b20984f 100644 --- a/modern/src/reports/EventReportPage.js +++ b/modern/src/reports/EventReportPage.js @@ -1,6 +1,6 @@ import React, { useState } from 'react'; import { DataGrid } from '@material-ui/data-grid'; -import { FormControl, InputLabel, Select, MenuItem } from '@material-ui/core'; +import { Grid, FormControl, InputLabel, Select, MenuItem } from '@material-ui/core'; import t from '../common/localization'; import { formatDate } from '../common/formatter'; import ReportFilter from './ReportFilter'; @@ -30,29 +30,31 @@ const Filter = ({ setItems }) => { return ( - - {t('reportEventTypes')} - - + + + {t('reportEventTypes')} + + + ); } diff --git a/modern/src/reports/ReportFilter.js b/modern/src/reports/ReportFilter.js index e6164e2..1d67691 100644 --- a/modern/src/reports/ReportFilter.js +++ b/modern/src/reports/ReportFilter.js @@ -1,10 +1,11 @@ import React, { useState } from 'react'; -import { FormControl, InputLabel, Select, MenuItem, Button, TextField, ButtonGroup, Grid } from '@material-ui/core'; +import { FormControl, InputLabel, Select, MenuItem, Button, TextField, Grid } from '@material-ui/core'; import t from '../common/localization'; import { useSelector } from 'react-redux'; import moment from 'moment'; const ReportFilter = ({ children, handleSubmit, showOnly }) => { + const devices = useSelector(state => Object.values(state.devices.items)); const [deviceId, setDeviceId] = useState(); const [period, setPeriod] = useState('today'); @@ -56,88 +57,80 @@ const ReportFilter = ({ children, handleSubmit, showOnly }) => { } return ( - <> - - - - - {t('reportDevice')} - - - - - - {t('reportPeriod')} - - - - {period === 'custom' && - setFrom(moment(e.target.value, moment.HTML5_FMT.DATETIME_LOCAL))} - fullWidth /> - } - {period === 'custom' && - setTo(moment(e.target.value, moment.HTML5_FMT.DATETIME_LOCAL))} - fullWidth /> - } - - - {children && - {children} - } - - - - - {!showOnly && - } - - - {!showOnly && - } - - + + + + {t('reportDevice')} + + + + + + {t('reportPeriod')} + + + + {period === 'custom' && + setFrom(moment(e.target.value, moment.HTML5_FMT.DATETIME_LOCAL))} + fullWidth /> + } + {period === 'custom' && + setTo(moment(e.target.value, moment.HTML5_FMT.DATETIME_LOCAL))} + fullWidth /> + } + {children} + + + + + {!showOnly && + } + + + {!showOnly && + } - + ); } diff --git a/modern/src/reports/ReportLayoutPage.js b/modern/src/reports/ReportLayoutPage.js index ae7b3da..e203b5a 100644 --- a/modern/src/reports/ReportLayoutPage.js +++ b/modern/src/reports/ReportLayoutPage.js @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import { AppBar, Toolbar, Typography, List, ListItem, ListItemText, ListItemIcon, Divider, Grid, Paper, Drawer, makeStyles, useMediaQuery, IconButton } from '@material-ui/core'; +import { AppBar, Toolbar, Typography, List, ListItem, ListItemText, ListItemIcon, Divider, Drawer, makeStyles, useMediaQuery, IconButton } from '@material-ui/core'; import { useTheme } from "@material-ui/core/styles"; import MenuIcon from '@material-ui/icons/Menu'; import TimelineIcon from '@material-ui/icons/Timeline'; @@ -16,24 +16,24 @@ import t from '../common/localization'; const useStyles = makeStyles(theme => ({ root: { - height: '100%', display: 'flex', + height: '100%', }, - drawer: { - width: 360, + drawerContainer: { + width: theme.dimensions.drawerWidth, [theme.breakpoints.down("md")]: { width: 0, } - }, - content: { - flex: 1, - padding: theme.spacing(3), }, - drawerPaper: { - width: 360, + drawer: { + width: theme.dimensions.drawerWidth, [theme.breakpoints.down("md")]: { - width: 320, + width: theme.dimensions.tabletDrawerWidth, } + }, + content: { + flex: 1, + padding: theme.spacing(5, 3, 3, 3), }, drawerHeader: { ...theme.mixins.toolbar, @@ -41,14 +41,16 @@ const useStyles = makeStyles(theme => ({ alignItems: 'center', padding: theme.spacing(0, 1), }, + backArrowIconContainer: { + '&:hover': { + backgroundColor:"transparent" + } + }, toolbar: { [theme.breakpoints.down("md")]: { ...theme.mixins.toolbar, } }, - form: { - padding: theme.spacing(1, 2, 2), - }, })); const ReportLayoutPage = ({ children, filter }) => { @@ -73,8 +75,7 @@ const ReportLayoutPage = ({ children, filter }) => { handleListItemClick(route)} - > + onClick={() => handleListItemClick(route)}> {route.icon} @@ -87,11 +88,13 @@ const ReportLayoutPage = ({ children, filter }) => { const drawerHeader = ( <>
- + - - Reports + + {t('reportTitle')}
@@ -99,19 +102,18 @@ const ReportLayoutPage = ({ children, filter }) => { ); const appBar = ( - + setOpenDrawer(!openDrawer)} - className={classes.menuButton} - > + className={classes.menuButton}> - Reports + {t('reportTitle')} @@ -123,18 +125,17 @@ const ReportLayoutPage = ({ children, filter }) => { return (
- { matchesMD && appBar } - +
{filter} diff --git a/modern/src/reports/SummaryReportPage.js b/modern/src/reports/SummaryReportPage.js index 2af7d3b..f63f50b 100644 --- a/modern/src/reports/SummaryReportPage.js +++ b/modern/src/reports/SummaryReportPage.js @@ -1,6 +1,6 @@ import React, { useState } from 'react'; import { DataGrid } from '@material-ui/data-grid'; -import { FormControlLabel, Checkbox } from '@material-ui/core'; +import { Grid, FormControlLabel, Checkbox } from '@material-ui/core'; import t from '../common/localization'; import { formatDistance, formatHours, formatDate, formatSpeed, formatVolume } from '../common/formatter'; import ReportFilter from './ReportFilter'; @@ -28,9 +28,11 @@ const Filter = ({ setItems }) => { return ( - setDaily(e.target.checked)} />} - label={t('reportDaily')} /> + + setDaily(e.target.checked)} />} + label={t('reportDaily')} /> + ); } diff --git a/modern/src/theme/dimensions.js b/modern/src/theme/dimensions.js index e36fc23..59959d7 100644 --- a/modern/src/theme/dimensions.js +++ b/modern/src/theme/dimensions.js @@ -2,5 +2,7 @@ export default { inputHeight: '42px', borderRadius: '4px', sidebarWidth: '28%', - tabletSidebarWidth: '52px' + tabletSidebarWidth: '52px', + drawerWidth: 360, + tabletDrawerWidth: 320, }; -- cgit v1.2.3