aboutsummaryrefslogtreecommitdiff
path: root/modern/src/reports
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2021-12-20 22:27:38 -0600
committerIván Ávalos <avalos@disroot.org>2021-12-20 22:27:38 -0600
commit5b77af549c94a4cda8c5ca4764c7fbc4d8f065a3 (patch)
tree0213e1a13662716ca002e891da285a1d1c486942 /modern/src/reports
parentcb9728775b0e5eca8c705c0e2c61f9171b7068d9 (diff)
downloadetbsa-traccar-web-5b77af549c94a4cda8c5ca4764c7fbc4d8f065a3.tar.gz
etbsa-traccar-web-5b77af549c94a4cda8c5ca4764c7fbc4d8f065a3.tar.bz2
etbsa-traccar-web-5b77af549c94a4cda8c5ca4764c7fbc4d8f065a3.zip
Localized grid no rows message, removed e-mail report button, among other report-related changes
Diffstat (limited to 'modern/src/reports')
-rw-r--r--modern/src/reports/EventReportPage.js4
-rw-r--r--modern/src/reports/NoRowsOverlay.js15
-rw-r--r--modern/src/reports/ReportFilter.js13
-rw-r--r--modern/src/reports/RouteReportPage.js10
-rw-r--r--modern/src/reports/StopReportPage.js4
-rw-r--r--modern/src/reports/SummaryReportPage.js4
-rw-r--r--modern/src/reports/TripReportPage.js6
7 files changed, 40 insertions, 16 deletions
diff --git a/modern/src/reports/EventReportPage.js b/modern/src/reports/EventReportPage.js
index 45d13a2..66372c9 100644
--- a/modern/src/reports/EventReportPage.js
+++ b/modern/src/reports/EventReportPage.js
@@ -8,6 +8,7 @@ import { useSelector } from 'react-redux';
import { formatDate, formatPosition } from '../common/formatter';
import ReportFilter from './ReportFilter';
import ReportLayout from './ReportLayout';
+import NoRowsOverlay from './NoRowsOverlay';
import { prefixString } from '../common/stringUtils';
import { useTranslation } from '../LocalizationProvider';
@@ -110,6 +111,9 @@ const EventReportPage = () => {
<DataGrid
rows={items}
columns={columns}
+ components={{
+ NoRowsOverlay: NoRowsOverlay,
+ }}
hideFooter
autoHeight
/>
diff --git a/modern/src/reports/NoRowsOverlay.js b/modern/src/reports/NoRowsOverlay.js
new file mode 100644
index 0000000..9fe53b1
--- /dev/null
+++ b/modern/src/reports/NoRowsOverlay.js
@@ -0,0 +1,15 @@
+import React, { useState } from 'react';
+import { Typography } from '@material-ui/core';
+import { GridOverlay } from '@material-ui/data-grid';
+import { useTranslation } from '../LocalizationProvider';
+
+const NoRowsOverlay = () => {
+ const t = useTranslation();
+ return (
+ <GridOverlay>
+ <Typography>{t('sharedNoRows')}</Typography>
+ </GridOverlay>
+ );
+}
+
+export default NoRowsOverlay;
diff --git a/modern/src/reports/ReportFilter.js b/modern/src/reports/ReportFilter.js
index 25b0af7..6c85047 100644
--- a/modern/src/reports/ReportFilter.js
+++ b/modern/src/reports/ReportFilter.js
@@ -135,19 +135,6 @@ const ReportFilter = ({ children, handleSubmit, showOnly, defaultSelected }) =>
</Button>
</Grid>
)}
- {!showOnly
- && (
- <Grid item xs={4} sm={2}>
- <Button
- onClick={() => handleClick(true, false)}
- variant="outlined"
- color="secondary"
- fullWidth
- >
- <Typography variant="button" noWrap>{t('reportEmail')}</Typography>
- </Button>
- </Grid>
- )}
</Grid>
);
};
diff --git a/modern/src/reports/RouteReportPage.js b/modern/src/reports/RouteReportPage.js
index a748334..db514e8 100644
--- a/modern/src/reports/RouteReportPage.js
+++ b/modern/src/reports/RouteReportPage.js
@@ -1,12 +1,13 @@
import React, { useState } from 'react';
-import { Paper } from '@material-ui/core';
-import { DataGrid } from '@material-ui/data-grid';
+import { Paper, Typography } from '@material-ui/core';
+import { DataGrid, GridOverlay } from '@material-ui/data-grid';
import { useTheme } from '@material-ui/core/styles';
import {
formatDistance, formatSpeed, formatBoolean, formatDate, formatCoordinate, formatPosition,
} from '../common/formatter';
import ReportFilter from './ReportFilter';
import ReportLayout from './ReportLayout';
+import NoRowsOverlay from './NoRowsOverlay';
import { useAttributePreference, usePreference } from '../common/preferences';
import { useTranslation } from '../LocalizationProvider';
@@ -31,6 +32,8 @@ const Filter = ({ setItems }) => {
return <ReportFilter handleSubmit={handleSubmit} />;
};
+
+
const RouteReportPage = () => {
const theme = useTheme();
const t = useTranslation();
@@ -93,6 +96,9 @@ const RouteReportPage = () => {
<DataGrid
rows={items}
columns={columns}
+ components={{
+ NoRowsOverlay: NoRowsOverlay,
+ }}
hideFooter
autoHeight
/>
diff --git a/modern/src/reports/StopReportPage.js b/modern/src/reports/StopReportPage.js
index f84b7e6..8b3974f 100644
--- a/modern/src/reports/StopReportPage.js
+++ b/modern/src/reports/StopReportPage.js
@@ -6,6 +6,7 @@ import {
} from '../common/formatter';
import ReportFilter from './ReportFilter';
import ReportLayout from './ReportLayout';
+import NoRowsOverlay from './NoRowsOverlay';
import { useAttributePreference } from '../common/preferences';
import { useTranslation } from '../LocalizationProvider';
@@ -89,6 +90,9 @@ const StopReportPage = () => {
<DataGrid
rows={items}
columns={columns}
+ components={{
+ NoRowsOverlay: NoRowsOverlay
+ }}
hideFooter
autoHeight
getRowId={() => Math.random()}
diff --git a/modern/src/reports/SummaryReportPage.js b/modern/src/reports/SummaryReportPage.js
index 2199d49..28b9db5 100644
--- a/modern/src/reports/SummaryReportPage.js
+++ b/modern/src/reports/SummaryReportPage.js
@@ -7,6 +7,7 @@ import {
} from '../common/formatter';
import ReportFilter from './ReportFilter';
import ReportLayout from './ReportLayout';
+import NoRowsOverlay from './NoRowsOverlay';
import { useAttributePreference } from '../common/preferences';
import { useTranslation } from '../LocalizationProvider';
@@ -110,6 +111,9 @@ const SummaryReportPage = () => {
<DataGrid
rows={items}
columns={columns}
+ components={{
+ NoRowsOverlay: NoRowsOverlay
+ }}
hideFooter
autoHeight
getRowId={() => Math.random()}
diff --git a/modern/src/reports/TripReportPage.js b/modern/src/reports/TripReportPage.js
index 91c165d..5ea8a19 100644
--- a/modern/src/reports/TripReportPage.js
+++ b/modern/src/reports/TripReportPage.js
@@ -6,6 +6,7 @@ import {
} from '../common/formatter';
import ReportFilter from './ReportFilter';
import ReportLayout from './ReportLayout';
+import NoRowsOverlay from './NoRowsOverlay';
import { useAttributePreference } from '../common/preferences';
import { useTranslation } from '../LocalizationProvider';
@@ -120,10 +121,13 @@ const TripReportPage = () => {
<DataGrid
rows={items}
columns={columns}
+ components={{
+ NoRowsOverlay: NoRowsOverlay,
+ }}
hideFooter
autoHeight
getRowId={() => Math.random()}
- />
+ />
</ReportLayout>
);
};