diff --git a/frontend/src/features/Mission/components/MissionForm/ActionForm/SurveillanceForm/Awareness.tsx b/frontend/src/features/Mission/components/MissionForm/ActionForm/SurveillanceForm/Awareness.tsx index 228407e6a..c75096635 100644 --- a/frontend/src/features/Mission/components/MissionForm/ActionForm/SurveillanceForm/Awareness.tsx +++ b/frontend/src/features/Mission/components/MissionForm/ActionForm/SurveillanceForm/Awareness.tsx @@ -1,4 +1,4 @@ -import { FormikCheckbox, FormikNumberInput, FormikSelect, Label } from '@mtes-mct/monitor-ui' +import { Checkbox, FormikNumberInput, FormikSelect, Label } from '@mtes-mct/monitor-ui' import { useField, useFormikContext } from 'formik' import { useEffect } from 'react' import styled from 'styled-components' @@ -22,21 +22,28 @@ export function Awareness({ awarenessOptions, formPath }: AwarenessProps) { if (controlPlans.value.length === 1 && isRisingAwareness) { setFieldValue(`${formPath}.awareness.themeId`, controlPlans.value[0]?.themeId) } - if (!isRisingAwareness) { + }, [controlPlans.value, formPath, isRisingAwareness, setFieldValue]) + + const updateIsRisingAwareness = (isChecked: boolean | undefined) => { + if (isChecked) { + setFieldValue(`${formPath}.awareness`, { isRisingAwareness: true }) + } else { setFieldValue(`${formPath}.awareness`, undefined) } - }, [controlPlans.value, formPath, isRisingAwareness, setFieldValue]) + } return ( <>
-
diff --git a/frontend/src/features/Mission/components/MissionForm/constants.ts b/frontend/src/features/Mission/components/MissionForm/constants.ts index 974b8a6e4..c5abb6734 100644 --- a/frontend/src/features/Mission/components/MissionForm/constants.ts +++ b/frontend/src/features/Mission/components/MissionForm/constants.ts @@ -11,7 +11,8 @@ export const MISSION_EVENT_UNSYNCHRONIZED_PROPERTIES = [ // `envActions` is included but `reportingIds` is missing 'envActions', 'fishActions', - 'hasRapportNavActions' + 'hasRapportNavActions', + 'observationsByUnit' ] export const MISSION_EVENT_UNSYNCHRONIZED_PROPERTIES_IN_FORM = [