diff options
author | Ashutosh Bishnoi <mail2bishnoi@gmail.com> | 2021-04-13 17:48:27 +0530 |
---|---|---|
committer | Ashutosh Bishnoi <mail2bishnoi@gmail.com> | 2021-04-13 17:48:27 +0530 |
commit | 48489f116b996ceebd7e3a8d08b2223d4f8021cf (patch) | |
tree | 350f93942bf9ce96fbd040580b71883be28061c1 /modern/src/reports | |
parent | bfe5b547bc7c6dee70fc95034a175a5c9d8012af (diff) | |
download | trackermap-web-48489f116b996ceebd7e3a8d08b2223d4f8021cf.tar.gz trackermap-web-48489f116b996ceebd7e3a8d08b2223d4f8021cf.tar.bz2 trackermap-web-48489f116b996ceebd7e3a8d08b2223d4f8021cf.zip |
Event Type Localization and geofence store creation
Diffstat (limited to 'modern/src/reports')
-rw-r--r-- | modern/src/reports/EventReportPage.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/modern/src/reports/EventReportPage.js b/modern/src/reports/EventReportPage.js index cbe2ced5..2478cad0 100644 --- a/modern/src/reports/EventReportPage.js +++ b/modern/src/reports/EventReportPage.js @@ -5,6 +5,8 @@ import t from '../common/localization'; import { formatDate } from '../common/formatter'; import ReportFilter from './ReportFilter'; import ReportLayoutPage from './ReportLayoutPage'; +import { prefixString } from '../common/stringUtils'; +import { useSelector } from 'react-redux'; const Filter = ({ setItems }) => { @@ -57,8 +59,17 @@ const Filter = ({ setItems }) => { const EventReportPage = () => { + const geofences = useSelector(state => state.geofences.items); const [items, setItems] = useState([]); + const formatGeofence = value => { + if (value !== 0) { + const geofence = geofences[value]; + return geofence ? geofence.name : ''; + } + return null; + } + const columns = [{ headerName: t('positionFixTime'), field: 'serverTime', @@ -70,11 +81,12 @@ const EventReportPage = () => { field: 'type', type: 'string', flex:1, + valueFormatter: ({ value }) => t(prefixString('event', value)), }, { headerName: t('sharedGeofence'), field: 'geofenceId', - type: 'number', flex: 1, + valueFormatter: ({ value }) => formatGeofence(value), }, { headerName: t('sharedMaintenance'), field: 'maintenanceId', |