From d21eb6a6ada04ee71860b4cf31b2f8a939c16fe2 Mon Sep 17 00:00:00 2001 From: Iván Ávalos Date: Tue, 21 Dec 2021 00:40:46 -0600 Subject: Added support for l18n string interpolation and set custom renderValue property on EventReportPage select --- modern/src/reports/EventReportPage.js | 39 ++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'modern/src/reports/EventReportPage.js') diff --git a/modern/src/reports/EventReportPage.js b/modern/src/reports/EventReportPage.js index 66372c9..3ed80e7 100644 --- a/modern/src/reports/EventReportPage.js +++ b/modern/src/reports/EventReportPage.js @@ -1,7 +1,7 @@ import React, { useState } from 'react'; import { DataGrid } from '@material-ui/data-grid'; import { - Grid, FormControl, InputLabel, Select, MenuItem, + Grid, FormControl, InputLabel, Select, MenuItem, Typography } from '@material-ui/core'; import { useTheme } from '@material-ui/core/styles'; import { useSelector } from 'react-redux'; @@ -15,7 +15,30 @@ import { useTranslation } from '../LocalizationProvider'; const Filter = ({ setItems }) => { const t = useTranslation(); - const [eventTypes, setEventTypes] = useState(['allEvents']); + const [eventTypes, setEventTypes] = useState([ + 'deviceInactive', + 'deviceMoving', + 'deviceStopped', + 'deviceOverspeed', + 'deviceFuelDrop', + 'commandResult', + 'geofenceEnter', + 'geofenceExit', + 'alarm', + 'ignitionOn', + 'ignitionOff', + 'maintenance', + 'textMessage', + 'driverChanged', + ]); + + const renderSelectedEvents = (value) => { + return ( + + {t('sharedSelectedOptions', {0: value.length})} + + ); + } const handleSubmit = async (deviceId, from, to, mail, headers) => { const query = new URLSearchParams({ @@ -38,13 +61,13 @@ const Filter = ({ setItems }) => { return ( - + {t('reportEventTypes')} - setEventTypes(e.target.value)} multiple> + {/*{t('eventAll')}*/} + {/*{t('eventDeviceOnline')}*/} + {/*{t('eventDeviceUnknown')}*/} + {/*{t('eventDeviceOffline')}*/} {t('eventDeviceInactive')} {t('eventDeviceMoving')} {t('eventDeviceStopped')} -- cgit v1.2.3