Skip to content

Commit 03c9fea

Browse files
authored
[Surveillance] Lors de l'édition de la zone de surveillance le bouton "zone identique a zone de mission" est décoché et inactif (#579)
- Resolve #571 - Resolve #570
2 parents 473dd56 + a383344 commit 03c9fea

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

frontend/src/features/missions/MissionForm/ActionForm/SurveillanceForm.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { FormikCheckbox, FormikDatePicker, FormikTextarea } from '@mtes-mct/monitor-ui'
22
import { useField } from 'formik'
3+
import { useMemo } from 'react'
34
import { Form, IconButton } from 'rsuite'
45
import styled from 'styled-components'
56

67
import { InteractionListener } from '../../../../domain/entities/map/constants'
78
import { ActionTypeEnum, type EnvAction } from '../../../../domain/entities/missions'
9+
import { useAppSelector } from '../../../../hooks/useAppSelector'
810
import { useNewWindow } from '../../../../ui/NewWindow'
911
import { ReactComponent as DeleteSVG } from '../../../../uiMonitor/icons/Delete.svg'
1012
import { ReactComponent as SurveillanceIconSVG } from '../../../../uiMonitor/icons/Observation.svg'
@@ -25,6 +27,9 @@ export function SurveillanceForm({ currentActionIndex, readOnly, remove, setCurr
2527
const hasCustomZone = geomField.value && geomField.value.coordinates.length > 0
2628
const surveillances = actionsFields.value.filter(action => action.actionType === ActionTypeEnum.SURVEILLANCE)
2729

30+
const { listener } = useAppSelector(state => state.draw)
31+
const isEditingZone = useMemo(() => listener === InteractionListener.SURVEILLANCE_ZONE, [listener])
32+
2833
const duration = dateDifferenceInHours(
2934
envActionField.value.actionStartDateTimeUtc,
3035
envActionField.value.actionEndDateTimeUtc
@@ -107,7 +112,7 @@ export function SurveillanceForm({ currentActionIndex, readOnly, remove, setCurr
107112
readOnly={readOnly}
108113
/>
109114
<StyledFormikCheckbox
110-
disabled={hasCustomZone}
115+
disabled={hasCustomZone || isEditingZone}
111116
inline
112117
label="Zone de surveillance équivalente à la zone de mission"
113118
name={`envActions[${currentActionIndex}].coverMissionZone`}

frontend/src/features/missions/MultiPointPicker.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,6 @@ const Field = styled.div`
148148
align-items: flex-start;
149149
display: flex;
150150
flex-direction: column;
151-
> button {
152-
max-width: 416px;
153-
}
154151
`
155152
const Center = styled.div`
156153
cursor: pointer;
@@ -170,7 +167,7 @@ const Row = styled.div`
170167
}
171168
align-items: center;
172169
display: flex;
173-
170+
width: 100%;
174171
margin-bottom: 4px;
175172
176173
> button {
@@ -185,5 +182,4 @@ const ZoneWrapper = styled.div`
185182
font-size: 13px;
186183
justify-content: space-between;
187184
padding: 5px 0.75rem 4px;
188-
width: 416px;
189185
`

frontend/src/features/missions/MultiZonePicker.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ export function MultiZonePicker({
4747
const { value } = field
4848

4949
const { listener } = useAppSelector(state => state.draw)
50-
const isEditingZone = useMemo(() => listener === InteractionListener.MISSION_ZONE, [listener])
50+
const isEditingZone = useMemo(
51+
() => listener === InteractionListener.MISSION_ZONE || listener === InteractionListener.SURVEILLANCE_ZONE,
52+
[listener]
53+
)
5154

5255
const polygons = useMemo(() => {
5356
if (!value) {
@@ -143,6 +146,7 @@ const Field = styled.div`
143146
align-items: flex-start;
144147
display: flex;
145148
flex-direction: column;
149+
width: 100%;
146150
`
147151
const Center = styled.a`
148152
cursor: pointer;
@@ -160,6 +164,7 @@ const Row = styled.div`
160164
align-items: center;
161165
display: flex;
162166
margin: 0.5rem 0 0;
167+
width: 100%;
163168
164169
> button {
165170
margin: 0 0 0 0.5rem;
@@ -173,7 +178,6 @@ const ZoneWrapper = styled.div<{ isLight?: boolean }>`
173178
font-size: 13px;
174179
justify-content: space-between;
175180
padding: 5px 0.75rem 4px;
176-
width: 416px;
177181
`
178182

179183
const ErrorMessage = styled.div`

0 commit comments

Comments
 (0)