diff options
author | Anton Tananaev <anton@traccar.org> | 2022-05-15 15:47:03 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-05-15 15:47:03 -0700 |
commit | 2a7d1a41dc897018a2bf17d3ca9f85cfb66bbb5f (patch) | |
tree | 664edf952e35084ec3f8f3be99011d2ac836d1fa /modern/src/reports/RouteReportPage.js | |
parent | 3d3b8096392f074baa7178d2a026525503657d50 (diff) | |
download | trackermap-web-2a7d1a41dc897018a2bf17d3ca9f85cfb66bbb5f.tar.gz trackermap-web-2a7d1a41dc897018a2bf17d3ca9f85cfb66bbb5f.tar.bz2 trackermap-web-2a7d1a41dc897018a2bf17d3ca9f85cfb66bbb5f.zip |
Add missing position values
Diffstat (limited to 'modern/src/reports/RouteReportPage.js')
-rw-r--r-- | modern/src/reports/RouteReportPage.js | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/modern/src/reports/RouteReportPage.js b/modern/src/reports/RouteReportPage.js index 98f2cd5c..e1dd59a0 100644 --- a/modern/src/reports/RouteReportPage.js +++ b/modern/src/reports/RouteReportPage.js @@ -9,21 +9,16 @@ import ReportsMenu from './components/ReportsMenu'; import usePersistedState from '../common/util/usePersistedState'; import PositionValue from '../common/components/PositionValue'; import ColumnSelect from './components/ColumnSelect'; - -const columnsArray = [ - ['fixTime', 'positionFixTime'], - ['latitude', 'positionLatitude'], - ['longitude', 'positionLongitude'], - ['speed', 'positionSpeed'], - ['address', 'positionAddress'], - ['ignition', 'positionIgnition'], - ['totalDistance', 'deviceTotalDistance'], -]; -const columnsMap = new Map(columnsArray); +import usePositionProperties from '../common/attributes/usePositionProperties'; +import usePositionAttributes from '../common/attributes/usePositionAttributes'; const RouteReportPage = () => { const t = useTranslation(); + const positionProperties = usePositionProperties(t); + const positionAttributes = usePositionAttributes(t); + const columnsObject = { ...positionProperties, ...positionAttributes }; + const [columns, setColumns] = usePersistedState('routeColumns', ['fixTime', 'latitude', 'longitude', 'speed', 'address']); const [items, setItems] = useState([]); @@ -47,13 +42,17 @@ const RouteReportPage = () => { return ( <PageLayout menu={<ReportsMenu />} breadcrumbs={['reportTitle', 'reportRoute']}> <ReportFilter handleSubmit={handleSubmit}> - <ColumnSelect columns={columns} setColumns={setColumns} columnsArray={columnsArray} /> + <ColumnSelect + columns={columns} + setColumns={setColumns} + columnsObject={columnsObject} + /> </ReportFilter> <TableContainer> <Table> <TableHead> <TableRow> - {columns.map((key) => (<TableCell>{t(columnsMap.get(key))}</TableCell>))} + {columns.map((key) => (<TableCell>{columnsObject[key].name}</TableCell>))} </TableRow> </TableHead> <TableBody> |