diff options
author | Ashutosh Bishnoi <mail2bishnoi@gmail.com> | 2020-11-25 14:07:59 +0530 |
---|---|---|
committer | Ashutosh Bishnoi <mail2bishnoi@gmail.com> | 2020-11-25 14:07:59 +0530 |
commit | 032d1a787384430a5bd93a3caf7e92bb0a5fa8aa (patch) | |
tree | 87a3fc0b466b37108c8f5c6a4a0a6787fa8293fb /modern/src/reports/ReportLayoutPage.js | |
parent | 34ec9a62ac0b65665f15f6e80729495e2558547f (diff) | |
download | trackermap-web-032d1a787384430a5bd93a3caf7e92bb0a5fa8aa.tar.gz trackermap-web-032d1a787384430a5bd93a3caf7e92bb0a5fa8aa.tar.bz2 trackermap-web-032d1a787384430a5bd93a3caf7e92bb0a5fa8aa.zip |
Improvements and minor refactoring in chart report
Diffstat (limited to 'modern/src/reports/ReportLayoutPage.js')
-rw-r--r-- | modern/src/reports/ReportLayoutPage.js | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/modern/src/reports/ReportLayoutPage.js b/modern/src/reports/ReportLayoutPage.js index e4219bfd..53b7039a 100644 --- a/modern/src/reports/ReportLayoutPage.js +++ b/modern/src/reports/ReportLayoutPage.js @@ -1,6 +1,8 @@ import React from 'react'; -import { Grid, Paper, makeStyles } from '@material-ui/core'; +import { Grid, Paper, makeStyles, FormControl, InputLabel, Select, MenuItem } from '@material-ui/core'; import MainToolbar from '../MainToolbar'; +import { chartTypes } from '../common/chartTypes'; +import t from '../common/localization'; const useStyles = makeStyles(theme => ({ root: { @@ -16,9 +18,13 @@ const useStyles = makeStyles(theme => ({ form: { padding: theme.spacing(1, 2, 2), }, + chart: { + padding: theme.spacing(1, 2, 2), + marginTop: theme.spacing(1), + }, })); -const ReportLayoutPage = ({ reportFilterForm:ReportFilterForm, setItems, setType, children }) => { +const ReportLayoutPage = ({ reportFilterForm:ReportFilterForm, setItems, setType, showChartType, children }) => { const classes = useStyles(); return ( <div className={classes.root}> @@ -27,8 +33,20 @@ const ReportLayoutPage = ({ reportFilterForm:ReportFilterForm, setItems, setType <Grid container spacing={2}> <Grid item xs={12} md={3} lg={2}> <Paper className={classes.form}> - <ReportFilterForm setItems={ setItems } setType={ setType }/> + <ReportFilterForm setItems={ setItems } /> </Paper> + {showChartType && ( + <Paper className={classes.chart}> + <FormControl variant="filled" margin="normal" fullWidth> + <InputLabel>{t('reportChartType')}</InputLabel> + <Select defaultValue="speed" onChange={e => setType(e.target.value)}> + {chartTypes.map(item => ( + <MenuItem key={item.id} value={item.id}>{item.name}</MenuItem> + ))} + </Select> + </FormControl> + </Paper> + )} </Grid> <Grid item xs={12} md={9} lg={10}> {children} |