aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshutosh Bishnoi <mail2bishnoi@gmail.com>2021-02-19 14:32:29 +0530
committerAshutosh Bishnoi <mail2bishnoi@gmail.com>2021-02-19 14:32:29 +0530
commit1c057b9ee6efb05e8092ecbdbe2e68bc02322a4a (patch)
tree6e93231a74ce4e014fb76da7f25de20aa9f6f4f8
parent8560d1f0f4f6709cc964762dbe5d65f63d40190e (diff)
downloadtrackermap-web-1c057b9ee6efb05e8092ecbdbe2e68bc02322a4a.tar.gz
trackermap-web-1c057b9ee6efb05e8092ecbdbe2e68bc02322a4a.tar.bz2
trackermap-web-1c057b9ee6efb05e8092ecbdbe2e68bc02322a4a.zip
Completed statistics Screen
-rw-r--r--modern/src/App.js2
-rw-r--r--modern/src/MainToolbar.js2
-rw-r--r--modern/src/reports/ReportFilter.js22
3 files changed, 15 insertions, 11 deletions
diff --git a/modern/src/App.js b/modern/src/App.js
index db2f7a9c..a01451b4 100644
--- a/modern/src/App.js
+++ b/modern/src/App.js
@@ -28,6 +28,7 @@ import ComputedAttributesPage from './settings/ComputedAttributesPage';
import ComputedAttributePage from './settings/ComputedAttributePage';
import MaintenancesPage from './settings/MaintenancesPage';
import MaintenancePage from './settings/MaintenancePage';
+import StatisticsPage from './admin/StatisticsPage';
const App = () => {
const initialized = useSelector(state => !!state.session.server && !!state.session.user);
@@ -58,6 +59,7 @@ const App = () => {
<Route exact path='/settings/maintenance/:id?' component={MaintenancePage} />
<Route exact path='/admin/server' component={ServerPage} />
<Route exact path='/admin/users' component={UsersPage} />
+ <Route exact path='/admin/statistics' component={StatisticsPage} />
<Route exact path='/reports/route' component={RouteReportPage} />
<Route exact path='/reports/event' component={EventReportPage} />
<Route exact path='/reports/trip' component={TripReportPage} />
diff --git a/modern/src/MainToolbar.js b/modern/src/MainToolbar.js
index ebe2efd5..702a7e50 100644
--- a/modern/src/MainToolbar.js
+++ b/modern/src/MainToolbar.js
@@ -214,7 +214,7 @@ const MainToolbar = () => {
</ListItemIcon>
<ListItemText primary={t('settingsUsers')} />
</ListItem>
- <ListItem button disabled>
+ <ListItem button onClick={() => history.push('/admin/statistics')}>
<ListItemIcon>
<BarChartIcon />
</ListItemIcon>
diff --git a/modern/src/reports/ReportFilter.js b/modern/src/reports/ReportFilter.js
index 164dbf9b..48da114f 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 }) => {
+const ReportFilter = ({ children, handleSubmit, showOnly, showDevices }) => {
const devices = useSelector(state => Object.values(state.devices.items));
const [deviceId, setDeviceId] = useState();
const [period, setPeriod] = useState('today');
@@ -57,14 +57,16 @@ const ReportFilter = ({ children, handleSubmit, showOnly }) => {
return (
<>
- <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>
+ {!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('reportPeriod')}</InputLabel>
<Select value={period} onChange={(e) => setPeriod(e.target.value)}>
@@ -99,7 +101,7 @@ const ReportFilter = ({ children, handleSubmit, showOnly }) => {
)}
{children}
<FormControl margin="normal" fullWidth>
- <ButtonGroup color="primary" orientation="vertical" disabled={!deviceId}>
+ <ButtonGroup color="primary" orientation="vertical" disabled={ showDevices ? !showDevices : !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>}