mirror of
https://github.com/traccar/traccar-web.git
synced 2025-01-07 03:26:42 +08:00
Option to hide individual geofences
This commit is contained in:
parent
9f85b7b16d
commit
d1fc3cafba
@ -15,4 +15,8 @@ export default (t) => useMemo(() => ({
|
||||
type: 'number',
|
||||
subtype: 'distance',
|
||||
},
|
||||
hide: {
|
||||
name: t('sharedFilterMap'),
|
||||
type: 'boolean',
|
||||
},
|
||||
}), [t]);
|
||||
|
@ -83,7 +83,9 @@ const MapGeofence = () => {
|
||||
if (mapGeofences) {
|
||||
map.getSource(id)?.setData({
|
||||
type: 'FeatureCollection',
|
||||
features: Object.values(geofences).map((geofence) => geofenceToFeature(theme, geofence)),
|
||||
features: Object.values(geofences)
|
||||
.filter((geofence) => !geofence.attributes.hide)
|
||||
.map((geofence) => geofenceToFeature(theme, geofence)),
|
||||
});
|
||||
}
|
||||
}, [mapGeofences, geofences]);
|
||||
|
@ -1,7 +1,13 @@
|
||||
import React, { useState } from 'react';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import {
|
||||
Accordion, AccordionSummary, AccordionDetails, Typography, TextField,
|
||||
Accordion,
|
||||
AccordionSummary,
|
||||
AccordionDetails,
|
||||
Typography,
|
||||
TextField,
|
||||
FormControlLabel,
|
||||
Checkbox,
|
||||
} from '@mui/material';
|
||||
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
||||
import EditItemView from './components/EditItemView';
|
||||
@ -72,6 +78,10 @@ const GeofencePage = () => {
|
||||
endpoint="/api/calendars"
|
||||
label={t('sharedCalendar')}
|
||||
/>
|
||||
<FormControlLabel
|
||||
control={<Checkbox checked={item.attributes.hide} onChange={(e) => setItem({ ...item, attributes: { ...item.attributes, hide: e.target.checked }})} />}
|
||||
label={t('sharedFilterMap')}
|
||||
/>
|
||||
</AccordionDetails>
|
||||
</Accordion>
|
||||
<EditAttributesAccordion
|
||||
|
Loading…
Reference in New Issue
Block a user