diff options
-rw-r--r-- | modern/src/common/formatter.js | 1 | ||||
-rw-r--r-- | modern/src/reports/EventReportPage.js | 4 | ||||
-rw-r--r-- | modern/src/reports/NoRowsOverlay.js | 15 | ||||
-rw-r--r-- | modern/src/reports/ReportFilter.js | 13 | ||||
-rw-r--r-- | modern/src/reports/RouteReportPage.js | 10 | ||||
-rw-r--r-- | modern/src/reports/StopReportPage.js | 4 | ||||
-rw-r--r-- | modern/src/reports/SummaryReportPage.js | 4 | ||||
-rw-r--r-- | modern/src/reports/TripReportPage.js | 6 | ||||
-rw-r--r-- | web/l10n/en.json | 1 | ||||
-rw-r--r-- | web/l10n/es.json | 1 |
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", |