aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--modern/src/common/formatter.js1
-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
-rw-r--r--web/l10n/en.json1
-rw-r--r--web/l10n/es.json1
10 files changed, 43 insertions, 16 deletions
diff --git a/modern/src/common/formatter.js b/modern/src/common/formatter.js
index ad0ffa2..87d8b00 100644
--- a/modern/src/common/formatter.js
+++ b/modern/src/common/formatter.js
@@ -7,6 +7,7 @@ export const formatNumber = (value, precision = 1) => Number(value.toFixed(preci
export const formatDate = (value, locale = 'es') => value ? new Intl.DateTimeFormat(locale, {
dateStyle: 'medium',
timeStyle: 'short',
+ hour12: true,
}).format(new Date(value)) : '';
export const formatPosition = (value, key, t, locale = 'es') => {
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>
);
};
diff --git a/web/l10n/en.json b/web/l10n/en.json
index a8b7c02..27cdab7 100644
--- a/web/l10n/en.json
+++ b/web/l10n/en.json
@@ -84,6 +84,7 @@
"sharedAlarms": "Alarms",
"sharedLocation": "Location",
"sharedImport": "Import",
+ "sharedNoRows": "No rows",
"attributeSpeedLimit": "Speed Limit",
"attributePolylineDistance": "Polyline Distance",
"attributeReportIgnoreOdometer": "Report: Ignore Odometer",
diff --git a/web/l10n/es.json b/web/l10n/es.json
index c131d10..dacbb22 100644
--- a/web/l10n/es.json
+++ b/web/l10n/es.json
@@ -84,6 +84,7 @@
"sharedAlarms": "Alarmas",
"sharedLocation": "Ubicación",
"sharedImport": "Import",
+ "sharedNoRows": "No hay filas",
"attributeSpeedLimit": "Límite de velocidad",
"attributePolylineDistance": "Distancia de polilínea",
"attributeReportIgnoreOdometer": "Reporte: Ignorar el odómetro",