Skip to content

Commit

Permalink
feat: add RapportNav as MissionSource
Browse files Browse the repository at this point in the history
  • Loading branch information
lwih committed Jan 28, 2025
1 parent 9dca311 commit f39bc90
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ enum class MissionSource {
MONITORFISH,
POSEIDON_CACEM,
POSEIDON_CNSP,
RAPPORT_NAV,
}
29 changes: 29 additions & 0 deletions frontend/cypress/mappings/get-missions.json
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,35 @@
"envActions": [],
"missionSource": "MONITORENV",
"isUnderJdp": false
},
{
"id": 50,
"missionTypes": ["SEA"],
"controlUnits": [
{
"id": 10484,
"administration": "Douane",
"name": "BGC Lorient - DF 36 Kan An Avel",
"resources": [],
"contact": null,
"isArchived": false
}
],
"openBy": "Michael Wilson",
"completedBy": "Michael Brooks",
"observationsCacem": "",
"observationsCnsp": null,
"facade": null,
"isGeometryComputedFromControls": false,
"geom": {
"type": "MultiPolygon",
"coordinates": []
},
"startDateTimeUtc": "2023-03-15T11:22:11.923703Z",
"endDateTimeUtc": "2023-03-20T12:14:02.923703Z",
"envActions": [],
"missionSource": "RAPPORT_NAV",
"isUnderJdp": false
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ type ExternalActionsModalProps = {

export function ExternalActionsDialog({ onClose, sources }: ExternalActionsModalProps) {
const isCACEM = sources.includes(Mission.MissionSource.MONITORENV)
const isRapportNav = sources.includes(Mission.MissionSource.RAPPORT_NAV)

const getPersonToContact = () => {
if (isCACEM) {
return 'le CACEM'
}
if (isRapportNav) {
return "l'unité"
}

return ''
}

return (
<Dialog data-cy="external-actions-modal" isAbsolute>
Expand All @@ -17,13 +29,9 @@ export function ExternalActionsDialog({ onClose, sources }: ExternalActionsModal
<Alert>
<Icon.Attention color={THEME.color.maximumRed} size={30} />
</Alert>
<Text>{`La mission ne peut pas être supprimée, car elle comporte des événements ajoutés par ${
isCACEM ? 'le CACEM' : ''
}.`}</Text>
<Text>{`La mission ne peut pas être supprimée, car elle comporte des événements ajoutés par ${getPersonToContact()}.`}</Text>
<Bold>
{`Si vous souhaitez tout de même la supprimer, veuillez contacter ${
isCACEM ? 'le CACEM' : ''
} pour qu'il supprime d'abord
{`Si vous souhaitez tout de même la supprimer, veuillez contacter ${getPersonToContact()} pour qu'il supprime d'abord
ses événements.`}
</Bold>
</Dialog.Body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ export const MISSION_SOURCE_LABEL: Record<Mission.MissionSource, string> = {
[Mission.MissionSource.MONITORENV]: 'CACEM',
[Mission.MissionSource.MONITORFISH]: 'CNSP',
[Mission.MissionSource.POSEIDON_CACEM]: 'CACEM (Poseidon)',
[Mission.MissionSource.POSEIDON_CNSP]: 'CNSP (Poseidon)'
[Mission.MissionSource.POSEIDON_CNSP]: 'CNSP (Poseidon)',
[Mission.MissionSource.RAPPORT_NAV]: 'RapportNav'
}

export const MISSION_TYPE_LABEL: Record<Mission.MissionType, string> = {
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/features/Mission/mission.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ export namespace Mission {
MONITORENV = 'MONITORENV',
MONITORFISH = 'MONITORFISH',
POSEIDON_CACEM = 'POSEIDON_CACEM',
POSEIDON_CNSP = 'POSEIDON_CNSP'
POSEIDON_CNSP = 'POSEIDON_CNSP',
RAPPORT_NAV = 'RAPPORT_NAV'
}
export enum MissionSourceLabel {
MONITORENV = 'CACEM',
MONITORFISH = 'CNSP',
POSEIDON_CACEM = 'CACEM (Poseidon)',
POSEIDON_CNSP = 'CNSP (Poseidon)'
POSEIDON_CNSP = 'CNSP (Poseidon)',
RAPPORT_NAV = 'RapportNav'
}

/* eslint-disable typescript-sort-keys/string-enum */
Expand Down

0 comments on commit f39bc90

Please sign in to comment.