diff options
author | Ashutosh Bishnoi <mail2bishnoi@gmail.com> | 2021-02-24 12:06:13 +0530 |
---|---|---|
committer | Ashutosh Bishnoi <mail2bishnoi@gmail.com> | 2021-02-24 12:06:13 +0530 |
commit | 4807ad55511c936bcfefca59a584ac8712ef1efd (patch) | |
tree | 0e707c703b7b0e92611c158c795e11c0b053c123 /modern/src/reports | |
parent | 9d6458439e3a842ff33eefc61258441ff1296975 (diff) | |
download | trackermap-web-4807ad55511c936bcfefca59a584ac8712ef1efd.tar.gz trackermap-web-4807ad55511c936bcfefca59a584ac8712ef1efd.tar.bz2 trackermap-web-4807ad55511c936bcfefca59a584ac8712ef1efd.zip |
More code improvements
Diffstat (limited to 'modern/src/reports')
-rw-r--r-- | modern/src/reports/ReportFilter.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/modern/src/reports/ReportFilter.js b/modern/src/reports/ReportFilter.js index 48da114f..9af3f7dc 100644 --- a/modern/src/reports/ReportFilter.js +++ b/modern/src/reports/ReportFilter.js @@ -4,7 +4,7 @@ import t from '../common/localization'; import { useSelector } from 'react-redux'; import moment from 'moment'; -const ReportFilter = ({ children, handleSubmit, showOnly, showDevices }) => { +const ReportFilter = ({ children, handleSubmit, showOnly }) => { const devices = useSelector(state => Object.values(state.devices.items)); const [deviceId, setDeviceId] = useState(); const [period, setPeriod] = useState('today'); @@ -57,16 +57,14 @@ const ReportFilter = ({ children, handleSubmit, showOnly, showDevices }) => { return ( <> - {!showDevices && ( - <FormControl variant="filled" margin="normal" fullWidth> - <InputLabel>{t('reportDevice')}</InputLabel> - <Select value={deviceId} onChange={(e) => setDeviceId(e.target.value)}> - {devices.map((device) => ( - <MenuItem value={device.id}>{device.name}</MenuItem> - ))} - </Select> - </FormControl> - )} + <FormControl variant="filled" margin="normal" fullWidth> + <InputLabel>{t('reportDevice')}</InputLabel> + <Select value={deviceId} onChange={(e) => setDeviceId(e.target.value)}> + {devices.map((device) => ( + <MenuItem value={device.id}>{device.name}</MenuItem> + ))} + </Select> + </FormControl> <FormControl variant="filled" margin="normal" fullWidth> <InputLabel>{t('reportPeriod')}</InputLabel> <Select value={period} onChange={(e) => setPeriod(e.target.value)}> @@ -101,7 +99,7 @@ const ReportFilter = ({ children, handleSubmit, showOnly, showDevices }) => { )} {children} <FormControl margin="normal" fullWidth> - <ButtonGroup color="primary" orientation="vertical" disabled={ showDevices ? !showDevices : !deviceId }> + <ButtonGroup color="primary" orientation="vertical" disabled={ !deviceId }> <Button onClick={() => handleClick(false, true)}>{t('reportShow')}</Button> {!showOnly && <Button onClick={() => handleClick(false, false)}>{t('reportExport')}</Button>} {!showOnly && <Button onClick={() => handleClick(true, false)}>{t('reportEmail')}</Button>} |