diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-04-19 09:34:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-19 09:34:28 -0700 |
commit | 047bf86480e2b3e215c13df2af0da456a664b507 (patch) | |
tree | 9edd2ceef5a1a381d416a1b03f529b0088c559a7 /modern/src/reports | |
parent | 2de99a83b3c45bc15faed44a1b248d56698b292b (diff) | |
parent | 2691e78cd4d5486581656a490b9fb5386e68a5d9 (diff) | |
download | trackermap-web-047bf86480e2b3e215c13df2af0da456a664b507.tar.gz trackermap-web-047bf86480e2b3e215c13df2af0da456a664b507.tar.bz2 trackermap-web-047bf86480e2b3e215c13df2af0da456a664b507.zip |
Merge pull request #839 from mail2bishnoi/event_type_convsersion
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..a14fc930 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', |