diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/entities/mission/Mission.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/entities/mission/Mission.kt index 1cf38aca9b..0c6166fa35 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/entities/mission/Mission.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/entities/mission/Mission.kt @@ -11,7 +11,7 @@ data class Mission( val id: Int, val missionTypes: List, val openBy: String? = null, - val closedBy: String? = null, + val completedBy: String? = null, val observationsCacem: String? = null, val observationsCnsp: String? = null, val facade: String? = null, @@ -23,7 +23,6 @@ data class Mission( val endDateTimeUtc: ZonedDateTime? = null, val isGeometryComputedFromControls: Boolean, val missionSource: MissionSource, - val isClosed: Boolean, val hasMissionOrder: Boolean? = false, val isUnderJdp: Boolean? = false, val controlUnits: List = listOf(), diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/outputs/MissionWithActionsDataOutput.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/outputs/MissionWithActionsDataOutput.kt index 7b09381f91..f5ce3bf568 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/outputs/MissionWithActionsDataOutput.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/outputs/MissionWithActionsDataOutput.kt @@ -11,7 +11,7 @@ data class MissionWithActionsDataOutput( val id: Int, val missionTypes: List, val openBy: String? = null, - val closedBy: String? = null, + val completedBy: String? = null, val observationsCacem: String? = null, val observationsCnsp: String? = null, val facade: String? = null, @@ -23,7 +23,6 @@ data class MissionWithActionsDataOutput( val endDateTimeUtc: ZonedDateTime? = null, val isGeometryComputedFromControls: Boolean, val missionSource: MissionSource, - val isClosed: Boolean, val hasMissionOrder: Boolean? = false, val isUnderJdp: Boolean? = false, val controlUnits: List = listOf(), @@ -34,7 +33,7 @@ data class MissionWithActionsDataOutput( id = missionAndActions.mission.id, missionTypes = missionAndActions.mission.missionTypes, openBy = missionAndActions.mission.openBy, - closedBy = missionAndActions.mission.closedBy, + completedBy = missionAndActions.mission.completedBy, observationsCacem = missionAndActions.mission.observationsCacem, observationsCnsp = missionAndActions.mission.observationsCnsp, facade = missionAndActions.mission.facade, @@ -47,7 +46,6 @@ data class MissionWithActionsDataOutput( endDateTimeUtc = missionAndActions.mission.endDateTimeUtc, isGeometryComputedFromControls = missionAndActions.mission.isGeometryComputedFromControls, missionSource = missionAndActions.mission.missionSource, - isClosed = missionAndActions.mission.isClosed, hasMissionOrder = missionAndActions.mission.hasMissionOrder, isUnderJdp = missionAndActions.mission.isUnderJdp, controlUnits = missionAndActions.mission.controlUnits, diff --git a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/monitorenv/input/MissionDataResponse.kt b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/monitorenv/input/MissionDataResponse.kt index b4c81fd37f..330e546d16 100644 --- a/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/monitorenv/input/MissionDataResponse.kt +++ b/backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/monitorenv/input/MissionDataResponse.kt @@ -14,7 +14,7 @@ data class MissionDataResponse( val controlUnits: List = listOf(), val missionTypes: List, val openBy: String? = null, - val closedBy: String? = null, + val completedBy: String? = null, val observationsCacem: String? = null, val observationsCnsp: String? = null, val facade: String? = null, @@ -26,7 +26,6 @@ data class MissionDataResponse( val endDateTimeUtc: String? = null, val isGeometryComputedFromControls: Boolean, val missionSource: MissionSource, - val isClosed: Boolean, val hasMissionOrder: Boolean? = false, val isUnderJdp: Boolean? = false, ) { @@ -35,7 +34,7 @@ data class MissionDataResponse( controlUnits = controlUnits, missionTypes = missionTypes, openBy = openBy, - closedBy = closedBy, + completedBy = completedBy, observationsCacem = observationsCacem, observationsCnsp = observationsCnsp, facade = facade, @@ -44,7 +43,6 @@ data class MissionDataResponse( endDateTimeUtc = endDateTimeUtc?.let { ZonedDateTime.parse(endDateTimeUtc) }, isGeometryComputedFromControls = isGeometryComputedFromControls, missionSource = missionSource, - isClosed = isClosed, hasMissionOrder = hasMissionOrder, isUnderJdp = isUnderJdp, ) diff --git a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/mission/GetMissionUTests.kt b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/mission/GetMissionUTests.kt index 25e891b0de..9d2e08bca2 100644 --- a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/mission/GetMissionUTests.kt +++ b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/mission/GetMissionUTests.kt @@ -41,7 +41,6 @@ class GetMissionUTests { startDateTimeUtc = ZonedDateTime.now(), isGeometryComputedFromControls = false, missionSource = MissionSource.MONITORFISH, - isClosed = false, envActions = listOf( EnvMissionAction( id = UUID.randomUUID(), diff --git a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/mission/TestUtils.kt b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/mission/TestUtils.kt index 247ce8aefe..9d3a75a6cb 100644 --- a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/mission/TestUtils.kt +++ b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/mission/TestUtils.kt @@ -20,7 +20,6 @@ object TestUtils { startDateTimeUtc = ZonedDateTime.now(), isGeometryComputedFromControls = false, missionSource = MissionSource.MONITORFISH, - isClosed = false, ) } } diff --git a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/mission/mission_actions/GetActivityReportsUTests.kt b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/mission/mission_actions/GetActivityReportsUTests.kt index 92549bc540..685812b564 100644 --- a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/mission/mission_actions/GetActivityReportsUTests.kt +++ b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/domain/use_cases/mission/mission_actions/GetActivityReportsUTests.kt @@ -124,7 +124,6 @@ class GetActivityReportsUTests { 1, missionTypes = listOf(MissionType.LAND), missionSource = MissionSource.MONITORFISH, - isClosed = false, isUnderJdp = false, isGeometryComputedFromControls = false, startDateTimeUtc = ZonedDateTime.of(2020, 5, 5, 3, 4, 5, 3, ZoneOffset.UTC), @@ -133,7 +132,6 @@ class GetActivityReportsUTests { 2, missionTypes = listOf(MissionType.SEA), missionSource = MissionSource.MONITORFISH, - isClosed = false, isUnderJdp = true, isGeometryComputedFromControls = false, startDateTimeUtc = ZonedDateTime.of(2020, 5, 5, 3, 4, 5, 3, ZoneOffset.UTC), @@ -142,7 +140,6 @@ class GetActivityReportsUTests { 2, missionTypes = listOf(MissionType.SEA), missionSource = MissionSource.MONITORFISH, - isClosed = false, isUnderJdp = false, isGeometryComputedFromControls = false, startDateTimeUtc = ZonedDateTime.of(2020, 5, 5, 3, 4, 5, 3, ZoneOffset.UTC), @@ -256,7 +253,6 @@ class GetActivityReportsUTests { 1, missionTypes = listOf(MissionType.LAND), missionSource = MissionSource.MONITORFISH, - isClosed = false, isUnderJdp = false, isGeometryComputedFromControls = false, startDateTimeUtc = ZonedDateTime.of(2020, 5, 5, 3, 4, 5, 3, ZoneOffset.UTC), @@ -265,7 +261,6 @@ class GetActivityReportsUTests { 3, missionTypes = listOf(MissionType.SEA), missionSource = MissionSource.MONITORFISH, - isClosed = false, isUnderJdp = false, isGeometryComputedFromControls = false, startDateTimeUtc = ZonedDateTime.of(2020, 5, 5, 3, 4, 5, 3, ZoneOffset.UTC), @@ -363,7 +358,6 @@ class GetActivityReportsUTests { 3, missionTypes = listOf(MissionType.SEA), missionSource = MissionSource.MONITORFISH, - isClosed = false, isUnderJdp = false, isGeometryComputedFromControls = false, startDateTimeUtc = ZonedDateTime.of(2020, 5, 5, 3, 4, 5, 3, ZoneOffset.UTC), diff --git a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/bff/MissionsControllerITests.kt b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/bff/MissionsControllerITests.kt index 54a8f86afa..e31f11a9d4 100644 --- a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/bff/MissionsControllerITests.kt +++ b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/api/bff/MissionsControllerITests.kt @@ -64,7 +64,6 @@ class MissionsControllerITests { 123, missionTypes = listOf(MissionType.SEA), missionSource = MissionSource.MONITORFISH, - isClosed = false, isGeometryComputedFromControls = false, startDateTimeUtc = ZonedDateTime.of(2020, 5, 5, 3, 4, 5, 3, ZoneOffset.UTC), ), @@ -134,7 +133,6 @@ class MissionsControllerITests { 123, missionTypes = listOf(MissionType.SEA), missionSource = MissionSource.MONITORFISH, - isClosed = false, isGeometryComputedFromControls = false, startDateTimeUtc = ZonedDateTime.of(2020, 5, 5, 3, 4, 5, 3, ZoneOffset.UTC), ), diff --git a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/monitorenv/APIMissionRepositoryITest.kt b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/monitorenv/APIMissionRepositoryITest.kt index b99cde2d2d..8843ce4bd8 100644 --- a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/monitorenv/APIMissionRepositoryITest.kt +++ b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/monitorenv/APIMissionRepositoryITest.kt @@ -54,7 +54,7 @@ class APIMissionRepositoryITest { } ], "openBy": "Steve Snyder", - "closedBy": "Jacob Martin", + "completedBy": "Jacob Martin", "observationsCacem": "Surface different shoulder interview. Job together area probably. Of alone class capital determine machine always.", "observationsCnsp": null, "facade": "MEMN", @@ -129,7 +129,6 @@ class APIMissionRepositoryITest { ], "isGeometryComputedFromControls": false, "missionSource": "MONITORENV", - "isClosed": false, "isUnderJdp": false }""", ), diff --git a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/monitorenv/TestUtils.kt b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/monitorenv/TestUtils.kt index 621fa059a8..9ae70cd08b 100644 --- a/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/monitorenv/TestUtils.kt +++ b/backend/src/test/kotlin/fr/gouv/cnsp/monitorfish/infrastructure/monitorenv/TestUtils.kt @@ -14,7 +14,7 @@ class TestUtils { "resources":[], "contact":null}], "openBy":null, - "closedBy":null, + "completedBy":null, "observationsCacem":null, "observationsCnsp":null, "facade":"NAMO", @@ -37,8 +37,7 @@ class TestUtils { } ], "isGeometryComputedFromControls":false, - "missionSource":"MONITORFISH", - "isClosed":false + "missionSource":"MONITORFISH" } """.trimIndent() } @@ -55,7 +54,7 @@ class TestUtils { "resources":[], "contact":null}], "openBy":null, - "closedBy":null, + "completedBy":null, "observationsCacem":null, "observationsCnsp":null, "facade":"NAMO", @@ -77,8 +76,7 @@ class TestUtils { } ], "isGeometryComputedFromControls":false, - "missionSource":"MONITORFISH", - "isClosed":false + "missionSource":"MONITORFISH" }, { "id":264, @@ -90,7 +88,7 @@ class TestUtils { "resources":[], "contact":null}], "openBy":"ADE", - "closedBy":"", + "completedBy":"", "observationsCacem":"", "observationsCnsp":"", "facade":"MEMN", @@ -99,8 +97,7 @@ class TestUtils { "endDateTimeUtc":"2023-04-21T00:00:00Z", "envActions":[], "isGeometryComputedFromControls":false, - "missionSource":"MONITORENV", - "isClosed":true + "missionSource":"MONITORENV" }, { "id":262, @@ -112,7 +109,7 @@ class TestUtils { "resources":[], "contact":"0101010101"}], "openBy":"ADE", - "closedBy":null, + "completedBy":null, "observationsCacem":null, "observationsCnsp":null, "facade":"MEMN", @@ -121,8 +118,7 @@ class TestUtils { "endDateTimeUtc":"2023-04-18T15:15:08.43Z", "envActions":[], "isGeometryComputedFromControls":false, - "missionSource":"MONITORFISH", - "isClosed":false + "missionSource":"MONITORFISH" }, { "id":257, @@ -134,7 +130,7 @@ class TestUtils { "resources":[], "contact":null}], "openBy":"", - "closedBy":"", + "completedBy":"", "observationsCacem":"", "observationsCnsp":"", "facade":"MED", @@ -143,8 +139,7 @@ class TestUtils { "endDateTimeUtc":"2023-04-19T00:00:00Z", "envActions":[], "isGeometryComputedFromControls":false, - "missionSource":"MONITORFISH", - "isClosed":false + "missionSource":"MONITORFISH" }, { "id":261, @@ -156,7 +151,7 @@ class TestUtils { "resources":[], "contact":null}], "openBy":null, - "closedBy":null, + "completedBy":null, "observationsCacem":null, "observationsCnsp":null, "facade":"NAMO", @@ -183,8 +178,7 @@ class TestUtils { "endDateTimeUtc":"2023-04-18T11:07:08.941Z", "envActions":[], "isGeometryComputedFromControls":false, - "missionSource":"MONITORFISH", - "isClosed":false + "missionSource":"MONITORFISH" }, { "id":258, @@ -196,7 +190,7 @@ class TestUtils { "resources":[], "contact":null}], "openBy":null, - "closedBy":null, + "completedBy":null, "observationsCacem":null, "observationsCnsp":null, "facade":null, @@ -205,8 +199,7 @@ class TestUtils { "endDateTimeUtc":"2023-04-18T10:38:20.178Z", "envActions":[], "isGeometryComputedFromControls":false, - "missionSource":"MONITORFISH", - "isClosed":false + "missionSource":"MONITORFISH" }, { "id":259, @@ -218,7 +211,7 @@ class TestUtils { "resources":[], "contact":null}], "openBy":null, - "closedBy":null, + "completedBy":null, "observationsCacem":null, "observationsCnsp":null, "facade":"NAMO", @@ -233,8 +226,7 @@ class TestUtils { "endDateTimeUtc":"2023-04-18T18:00:59Z", "envActions":[], "isGeometryComputedFromControls":false, - "missionSource":"MONITORFISH", - "isClosed":false + "missionSource":"MONITORFISH" }, { "id":260, @@ -246,7 +238,7 @@ class TestUtils { "resources":[], "contact":"154785263"}], "openBy":"", - "closedBy":"", + "completedBy":"", "observationsCacem":"", "observationsCnsp":"", "facade":"MED", @@ -255,8 +247,7 @@ class TestUtils { "endDateTimeUtc":"2023-04-18T09:09:59.578Z", "envActions":[], "isGeometryComputedFromControls":false, - "missionSource":"MONITORFISH", - "isClosed":false + "missionSource":"MONITORFISH" }, { "id":250, @@ -268,15 +259,14 @@ class TestUtils { "resources":[], "contact":"080012654"}], "openBy":"ADE", - "closedBy":"", + "completedBy":"", "observationsCacem":"", "observationsCnsp":"", "facade":"MED", "geom":{"type":"MultiPolygon","coordinates":[[[[51.49119758, -18.10424171],[53.53854137,-22.2000453],[59.22261425,-22.89666373],[61.86261019,-19.04903036],[51.49119758,-18.10424171]]]]},"startDateTimeUtc":"2023-04-16T08:00:00Z","endDateTimeUtc":"2023-04-20T18:00:00Z", "envActions":[], "isGeometryComputedFromControls":false, - "missionSource":"MONITORFISH", - "isClosed":false + "missionSource":"MONITORFISH" }, { "id":256, @@ -289,7 +279,7 @@ class TestUtils { "name":"Voiture"}], "contact":null}], "openBy":"ADE", - "closedBy":"", + "completedBy":"", "observationsCacem":"TEST 2", "observationsCnsp":"TEST", "facade":null, @@ -298,8 +288,7 @@ class TestUtils { "endDateTimeUtc":"2023-04-13T17:48:53.005Z", "envActions":[], "isGeometryComputedFromControls":false, - "missionSource":"MONITORFISH", - "isClosed":false + "missionSource":"MONITORFISH" }, { "id":254, @@ -312,15 +301,14 @@ class TestUtils { "resources":[], "contact":null}], "openBy":"ASE", - "closedBy":"", + "completedBy":"", "observationsCacem":"", "observationsCnsp":"", "facade":"MED", "geom":{"type":"MultiPolygon","coordinates":[[[[3.70244841, 43.39883986],[3.69556248,43.39696361],[3.69470173,43.39321095],[3.70876052,43.39300246],[3.70244841,43.39883986]]]]},"startDateTimeUtc":"2023-04-13T16:40:17.766Z","endDateTimeUtc":null, "envActions":[], "isGeometryComputedFromControls":false, - "missionSource":"MONITORENV", - "isClosed":false + "missionSource":"MONITORENV" }, { "id":253, @@ -332,7 +320,7 @@ class TestUtils { "resources":[], "contact":"qsdf"}], "openBy":"qs", - "closedBy":"dd", + "completedBy":"dd", "observationsCacem":"qsdf", "observationsCnsp":"sqdf", "facade":"NAMO", @@ -341,8 +329,7 @@ class TestUtils { "endDateTimeUtc":"2023-04-13T13:14:59.149Z", "envActions":[], "isGeometryComputedFromControls":false, - "missionSource":"MONITORFISH", - "isClosed":false + "missionSource":"MONITORFISH" }] """.trimIndent() } diff --git a/frontend/cypress/e2e/side_window/mission_form/air_control.spec.ts b/frontend/cypress/e2e/side_window/mission_form/air_control.spec.ts index 800a96c440..528128812e 100644 --- a/frontend/cypress/e2e/side_window/mission_form/air_control.spec.ts +++ b/frontend/cypress/e2e/side_window/mission_form/air_control.spec.ts @@ -59,7 +59,7 @@ context('Side Window > Mission Form > Air Control', () => { cy.fill('Saisi par', 'Marlin') // Complété par - cy.get('[name="completedBy"]').type('Alice') + cy.fill('Complété par', 'Alice', { index: 1 }) cy.wait(500) diff --git a/frontend/cypress/e2e/side_window/mission_form/air_surveillance.spec.ts b/frontend/cypress/e2e/side_window/mission_form/air_surveillance.spec.ts index df2046caf3..5c96a03187 100644 --- a/frontend/cypress/e2e/side_window/mission_form/air_surveillance.spec.ts +++ b/frontend/cypress/e2e/side_window/mission_form/air_surveillance.spec.ts @@ -86,7 +86,7 @@ context('Side Window > Mission Form > Air Surveillance', () => { cy.fill('Saisi par', 'Marlin') // Complété par - cy.get('[name="completedBy"]').type('Alice') + cy.fill('Complété par', 'Alice', { index: 1 }) cy.wait(500) diff --git a/frontend/cypress/e2e/side_window/mission_form/land_control.spec.ts b/frontend/cypress/e2e/side_window/mission_form/land_control.spec.ts index 049fbe0a33..82b218c282 100644 --- a/frontend/cypress/e2e/side_window/mission_form/land_control.spec.ts +++ b/frontend/cypress/e2e/side_window/mission_form/land_control.spec.ts @@ -117,7 +117,7 @@ context('Side Window > Mission Form > Land Control', () => { cy.fill('Saisi par', 'Marlin') // Complété par - cy.get('[name="completedBy"]').type('Alice') + cy.fill('Complété par', 'Alice', { index: 1 }) cy.wait(500) diff --git a/frontend/cypress/e2e/side_window/mission_form/main_form.spec.ts b/frontend/cypress/e2e/side_window/mission_form/main_form.spec.ts index 9dd1690df6..b90156a370 100644 --- a/frontend/cypress/e2e/side_window/mission_form/main_form.spec.ts +++ b/frontend/cypress/e2e/side_window/mission_form/main_form.spec.ts @@ -224,7 +224,7 @@ context('Side Window > Mission Form > Main Form', () => { cy.fill('CNSP : orientations, observations', 'Une autre note.') cy.wait(250) cy.fill('Ouvert par', 'Nemo') - cy.fill('Complété par', 'Doris') + cy.fill('Complété par', 'Doris', { index: 0 }) cy.wait(500) @@ -232,7 +232,7 @@ context('Side Window > Mission Form > Main Form', () => { '@updateMission', { body: { - closedBy: 'Doris', + completedBy: 'Doris', controlUnits: [ { administration: 'DDTM', @@ -304,7 +304,7 @@ context('Side Window > Mission Form > Main Form', () => { assert.isString(interception.request.body.endDateTimeUtc) assert.isString(interception.request.body.startDateTimeUtc) assert.deepInclude(interception.request.body, { - closedBy: 'Samantha Jones', + completedBy: 'Samantha Jones', controlUnits: [ { administration: 'Douane', @@ -530,7 +530,7 @@ context('Side Window > Mission Form > Main Form', () => { 'MISSION_UPDATE', new MessageEvent('MISSION_UPDATE', { data: JSON.stringify({ - closedBy: 'Heidi Silva', + completedBy: 'Heidi Silva', controlUnits: [ { administration: 'DREAL', @@ -561,7 +561,6 @@ context('Side Window > Mission Form > Main Form', () => { type: 'MultiPolygon' }, id: 43, - isClosed: false, isGeometryComputedFromControls: false, // MODIFIED FIELD isUnderJdp: true, @@ -651,7 +650,7 @@ context('Side Window > Mission Form > Main Form', () => { 'MISSION_UPDATE', new MessageEvent('MISSION_UPDATE', { data: JSON.stringify({ - closedBy: 'Heidi Silva', + completedBy: 'Heidi Silva', controlUnits: [ { administration: 'DREAL', @@ -682,7 +681,6 @@ context('Side Window > Mission Form > Main Form', () => { type: 'MultiPolygon' }, id: 43, - isClosed: false, isGeometryComputedFromControls: false, // MODIFIED FIELD isUnderJdp: true, @@ -721,7 +719,7 @@ context('Side Window > Mission Form > Main Form', () => { 'MISSION_UPDATE', new MessageEvent('MISSION_UPDATE', { data: JSON.stringify({ - closedBy: 'Heidi Silva', + completedBy: 'Heidi Silva', controlUnits: [ { administration: 'DREAL', @@ -751,7 +749,6 @@ context('Side Window > Mission Form > Main Form', () => { type: 'MultiPolygon' }, id: 43, - isClosed: false, isGeometryComputedFromControls: false, isUnderJdp: true, missionSource: 'MONITORENV', diff --git a/frontend/cypress/e2e/side_window/mission_form/sea_control.spec.ts b/frontend/cypress/e2e/side_window/mission_form/sea_control.spec.ts index d22d86e2e5..a99c152cb2 100644 --- a/frontend/cypress/e2e/side_window/mission_form/sea_control.spec.ts +++ b/frontend/cypress/e2e/side_window/mission_form/sea_control.spec.ts @@ -167,7 +167,7 @@ context('Side Window > Mission Form > Sea Control', () => { cy.fill('Saisi par', 'Marlin') // Complété par - cy.get('[name="completedBy"]').type('Alice') + cy.fill('Complété par', 'Alice', { index: 1 }) cy.wait(500) @@ -300,7 +300,7 @@ context('Side Window > Mission Form > Sea Control', () => { cy.wait(500) /// Complété par - cy.get('[name="completedBy"]').type('Alice') + cy.fill('Complété par', 'Alice', { index: 1 }) cy.wait(500) diff --git a/frontend/cypress/e2e/sidebars/regulatory_layers.spec.ts b/frontend/cypress/e2e/sidebars/regulatory_layers.spec.ts index cf355cf4b3..ac3c28816c 100644 --- a/frontend/cypress/e2e/sidebars/regulatory_layers.spec.ts +++ b/frontend/cypress/e2e/sidebars/regulatory_layers.spec.ts @@ -441,7 +441,7 @@ context('Sidebars > Regulatory Layers', () => { // Unselect one of the "Corse - Chaluts" regulation zones cy.contains('Corse - Chaluts').click() - cy.contains('Interdiction temporaire').parent().find('span').last().find('svg').last().click() + cy.contains('Interdiction temporaire').parent().find('[title="Supprimer la zone de ma sélection"]').click() cy.get('.regulatory').toMatchImageSnapshot({ screenshotConfig: { @@ -474,7 +474,7 @@ context('Sidebars > Regulatory Layers', () => { // Show metadata for one of the "Corse - Chaluts" regulation zones cy.contains('Corse - Chaluts').click() - cy.contains('6 MN').parent().find('span').last().find('svg').first().click() + cy.contains('6 MN').parent().find('[title="Afficher la réglementation"]').click() // Check a few of its metadata values cy.contains('Reg. MED').should('be.visible') @@ -482,7 +482,7 @@ context('Sidebars > Regulatory Layers', () => { cy.contains('Création et Réglementation de zone').should('be.visible') // Unselect one of the "Corse - Chaluts" regulation zones - cy.contains('Interdiction temporaire').parent().find('span').last().find('svg').last().click() + cy.contains('Interdiction temporaire').parent().find('[title="Supprimer la zone de ma sélection"]').click() // Select all the "Armor CSJ Dragues" regulation zones (there is only 1) cy.getDataCy('regulatory-search-clean-input').click() @@ -491,16 +491,9 @@ context('Sidebars > Regulatory Layers', () => { cy.clickButton('Ajouter 1 zone') // Show metadata the only "Armor CSJ Dragues" regulation zone + cy.getDataCy('regulatory-search-clean-input').click() cy.contains('Mes zones réglementaires').parent().contains('Armor CSJ Dragues').click() - cy.contains('Mes zones réglementaires') - .parent() - .contains('Secteur 3') - .parent() - .find('span') - .last() - .find('svg') - .first() - .click() + cy.contains('Secteur 3').parent().find('[title="Afficher la réglementation"]').click() // Check a few of its metadata values cy.contains('Reg. MEMN').should('be.visible') diff --git a/frontend/cypress/mappings/create-mission-with-unit-scenario.json b/frontend/cypress/mappings/create-mission-with-unit-scenario.json index 52219f89d7..9a66347f86 100644 --- a/frontend/cypress/mappings/create-mission-with-unit-scenario.json +++ b/frontend/cypress/mappings/create-mission-with-unit-scenario.json @@ -32,7 +32,7 @@ } ], "openBy": "", - "closedBy": "", + "completedBy": "", "observationsCacem": "", "observationsCnsp": "Scénario qui permet de stubber l'API MonitorEnv", "facade": null, @@ -43,7 +43,6 @@ "updatedAtUtc": "2023-03-15T23:21:14.923703Z", "envActions": [], "missionSource": "MONITORFISH", - "isClosed": false, "isUnderJdp": false, "isGeometryComputedFromControls": false } @@ -77,7 +76,7 @@ } ], "openBy": "", - "closedBy": "", + "completedBy": "", "observationsCacem": "", "observationsCnsp": "Scénario qui permet de stubber l'API MonitorEnv", "facade": null, @@ -88,7 +87,6 @@ "updatedAtUtc": "2023-03-15T23:21:14.923703Z", "envActions": [], "missionSource": "MONITORFISH", - "isClosed": false, "isUnderJdp": false, "isGeometryComputedFromControls": false } diff --git a/frontend/cypress/mappings/get-mission-2.json b/frontend/cypress/mappings/get-mission-2.json index 552e66b6aa..b0de5d3192 100644 --- a/frontend/cypress/mappings/get-mission-2.json +++ b/frontend/cypress/mappings/get-mission-2.json @@ -24,7 +24,7 @@ } ], "openBy": "Brittany Graham", - "closedBy": "Samantha Jones", + "completedBy": "Samantha Jones", "observationsCacem": "Maybe own each college away likely major. Former space technology million cell. Outside body my drop require.", "observationsCnsp": null, "facade": "MEMN", @@ -35,7 +35,6 @@ "updatedAtUtc": "2024-01-23T02:49:25.923703Z", "envActions": [], "missionSource": "POSEIDON_CNSP", - "isClosed": false, "isUnderJdp": false, "isGeometryComputedFromControls": false } diff --git a/frontend/cypress/mappings/get-mission-24.json b/frontend/cypress/mappings/get-mission-24.json index 8643ba808c..ce277c1e5d 100644 --- a/frontend/cypress/mappings/get-mission-24.json +++ b/frontend/cypress/mappings/get-mission-24.json @@ -29,7 +29,7 @@ } ], "openBy": "Kara Heath", - "closedBy": "James Reed", + "completedBy": "James Reed", "observationsCacem": "Machine office recently answer dark such toward west. Around tree green management opportunity central then. Can time into magazine.", "observationsCnsp": null, "facade": "MEMN", @@ -40,7 +40,6 @@ "updatedAtUtc": "2021-01-20T08:29:11.923703Z", "envActions": [], "missionSource": "MONITORENV", - "isClosed": false, "isUnderJdp": false, "isGeometryComputedFromControls": false } diff --git a/frontend/cypress/mappings/get-mission-25.json b/frontend/cypress/mappings/get-mission-25.json index 8b89b85a45..534364dfed 100644 --- a/frontend/cypress/mappings/get-mission-25.json +++ b/frontend/cypress/mappings/get-mission-25.json @@ -29,7 +29,7 @@ } ], "openBy": "Kevin Torres", - "closedBy": "Cynthia Phillips", + "completedBy": "Cynthia Phillips", "observationsCacem": "Toward agency blue now hand. Meet answer someone stand.", "observationsCnsp": null, "facade": "MED", @@ -40,7 +40,6 @@ "updatedAtUtc": "2021-01-20T08:29:11.923703Z", "envActions": [], "missionSource": "POSEIDON_CNSP", - "isClosed": true, "isUnderJdp": false, "isGeometryComputedFromControls": false } diff --git a/frontend/cypress/mappings/get-mission-34.json b/frontend/cypress/mappings/get-mission-34.json index c49cffa98d..e08c27a0fb 100644 --- a/frontend/cypress/mappings/get-mission-34.json +++ b/frontend/cypress/mappings/get-mission-34.json @@ -40,7 +40,7 @@ } ], "openBy": "Steve Snyder", - "closedBy": "Jacob Martin", + "completedBy": "Jacob Martin", "observationsCacem": "Surface different shoulder interview. Job together area probably. Of alone class capital determine machine always.", "observationsCnsp": null, "facade": "MEMN", @@ -77,7 +77,7 @@ "geom": null, "hasSomeGearsSeized": false, "hasSomeSpeciesSeized": false, - "closedBy": null, + "completedBy": null, "id": "88713755-3966-4ca4-ae18-10cab6249485", "observations": "Surveillance ok", "protectedSpecies": [] @@ -114,19 +114,18 @@ ], "hasSomeGearsSeized": false, "hasSomeSpeciesSeized": false, - "closedBy": null + "completedBy": null }, { "actionStartDateTimeUtc": "2022-11-03T13:59:20.176Z", "actionType": "NOTE", "geom": null, - "closedBy": null, + "completedBy": null, "id": "88713755-3966-4ca4-ae18-10cab6249483", "observations": "Une note avec des informations sur la mission." } ], "missionSource": "MONITORENV", - "isClosed": false, "isUnderJdp": false, "isGeometryComputedFromControls": true } diff --git a/frontend/cypress/mappings/get-mission-35.json b/frontend/cypress/mappings/get-mission-35.json index 6d811c48f1..0af9be1b31 100644 --- a/frontend/cypress/mappings/get-mission-35.json +++ b/frontend/cypress/mappings/get-mission-35.json @@ -24,7 +24,7 @@ } ], "openBy": "Brittany Graham", - "closedBy": "Samantha Jones", + "completedBy": "Samantha Jones", "observationsCacem": "Maybe own each college away likely major. Former space technology million cell. Outside body my drop require.", "observationsCnsp": null, "facade": "MEMN", @@ -35,7 +35,6 @@ "updatedAtUtc": "2021-01-20T08:29:11.923703Z", "envActions": [], "missionSource": "POSEIDON_CNSP", - "isClosed": false, "isUnderJdp": false, "isGeometryComputedFromControls": false } diff --git a/frontend/cypress/mappings/get-mission-36.json b/frontend/cypress/mappings/get-mission-36.json index 956e042528..381e94c028 100644 --- a/frontend/cypress/mappings/get-mission-36.json +++ b/frontend/cypress/mappings/get-mission-36.json @@ -24,7 +24,7 @@ } ], "openBy": "Brittany Graham", - "closedBy": "Samantha Jones", + "completedBy": "Samantha Jones", "observationsCacem": "Maybe own each college away likely major. Former space technology million cell. Outside body my drop require.", "observationsCnsp": null, "facade": "MEMN", @@ -35,7 +35,6 @@ "updatedAtUtc": "2021-01-20T08:29:11.923703Z", "envActions": [], "missionSource": "POSEIDON_CNSP", - "isClosed": false, "isUnderJdp": false, "isGeometryComputedFromControls": false } diff --git a/frontend/cypress/mappings/get-mission-4.json b/frontend/cypress/mappings/get-mission-4.json index c632f34d18..c7d3c66ef8 100644 --- a/frontend/cypress/mappings/get-mission-4.json +++ b/frontend/cypress/mappings/get-mission-4.json @@ -24,7 +24,7 @@ } ], "openBy": "Brian Gibbs", - "closedBy": "Mary Rogers", + "completedBy": "Mary Rogers", "observationsCacem": "Magazine more morning we career born. Language notice site next history.", "observationsCnsp": null, "facade": "MEMN", @@ -35,7 +35,6 @@ "updatedAtUtc": "2022-02-15T13:11:59.923703Z", "envActions": [], "missionSource": "MONITORFISH", - "isClosed": false, "isUnderJdp": false, "isGeometryComputedFromControls": false } diff --git a/frontend/cypress/mappings/get-mission-43.json b/frontend/cypress/mappings/get-mission-43.json index 1754f81035..febd833ed9 100644 --- a/frontend/cypress/mappings/get-mission-43.json +++ b/frontend/cypress/mappings/get-mission-43.json @@ -24,7 +24,7 @@ } ], "openBy": "Darren Clark", - "closedBy": "Heidi Silva", + "completedBy": "Heidi Silva", "observationsCacem": "Anything box film quality. Lot series agent out rule end young pressure.", "observationsCnsp": null, "facade": "MED", @@ -49,7 +49,6 @@ "updatedAtUtc": "2021-01-20T08:29:11.923703Z", "envActions": [], "missionSource": "MONITORENV", - "isClosed": false, "isUnderJdp": false, "isGeometryComputedFromControls": false } diff --git a/frontend/cypress/mappings/get-mission-45.json b/frontend/cypress/mappings/get-mission-45.json index 9f68faed83..c5d7e371d3 100644 --- a/frontend/cypress/mappings/get-mission-45.json +++ b/frontend/cypress/mappings/get-mission-45.json @@ -24,7 +24,7 @@ } ], "openBy": "Brittany Graham", - "closedBy": "Samantha Jones", + "completedBy": "Samantha Jones", "observationsCacem": "Maybe own each college away likely major. Former space technology million cell. Outside body my drop require.", "observationsCnsp": null, "facade": "MEMN", @@ -35,7 +35,6 @@ "updatedAtUtc": "2021-01-20T08:29:11.923703Z", "envActions": [], "missionSource": "POSEIDON_CNSP", - "isClosed": false, "isUnderJdp": false, "isGeometryComputedFromControls": false } diff --git a/frontend/cypress/mappings/get-mission-47.json b/frontend/cypress/mappings/get-mission-47.json index 6b16faeca9..f023a32c13 100644 --- a/frontend/cypress/mappings/get-mission-47.json +++ b/frontend/cypress/mappings/get-mission-47.json @@ -24,7 +24,7 @@ } ], "openBy": "Christina Thomas", - "closedBy": "Amanda Smith", + "completedBy": "Amanda Smith", "observationsCacem": "Decision about effect sport hour field. Care finally minute stop.", "observationsCnsp": null, "facade": "SA", @@ -35,7 +35,6 @@ "updatedAtUtc": "2021-01-20T08:29:11.923703Z", "envActions": [], "missionSource": "POSEIDON_CNSP", - "isClosed": true, "isUnderJdp": false, "isGeometryComputedFromControls": false } diff --git a/frontend/cypress/mappings/get-mission-48.json b/frontend/cypress/mappings/get-mission-48.json index f598a7bd93..15aea5e5e3 100644 --- a/frontend/cypress/mappings/get-mission-48.json +++ b/frontend/cypress/mappings/get-mission-48.json @@ -24,7 +24,7 @@ } ], "openBy": "Chase Hernandez", - "closedBy": "Matthew Buckley", + "completedBy": "Matthew Buckley", "observationsCacem": "Fly chance record lawyer those. Once position indicate war medical through. Interest read possible.", "observationsCnsp": null, "facade": "SA", @@ -35,7 +35,6 @@ "updatedAtUtc": "2021-01-20T08:29:11.923703Z", "envActions": [], "missionSource": "MONITORENV", - "isClosed": false, "isUnderJdp": false, "isGeometryComputedFromControls": false } diff --git a/frontend/cypress/mappings/get-mission-49.json b/frontend/cypress/mappings/get-mission-49.json index 502c56b08a..b06328f8e3 100644 --- a/frontend/cypress/mappings/get-mission-49.json +++ b/frontend/cypress/mappings/get-mission-49.json @@ -24,7 +24,7 @@ } ], "openBy": "Michael Wilson", - "closedBy": "Michael Brooks", + "completedBy": "Michael Brooks", "observationsCacem": "Check environment role actually whether majority blood. And action section bag middle. Somebody main stage sense.", "observationsCnsp": null, "facade": null, @@ -38,7 +38,6 @@ "updatedAtUtc": "2021-01-20T08:29:11.923703Z", "envActions": [], "missionSource": "MONITORENV", - "isClosed": true, "isUnderJdp": false, "isGeometryComputedFromControls": false } diff --git a/frontend/cypress/mappings/get-mission-6.json b/frontend/cypress/mappings/get-mission-6.json index a366bf8db1..e466fea12e 100644 --- a/frontend/cypress/mappings/get-mission-6.json +++ b/frontend/cypress/mappings/get-mission-6.json @@ -29,7 +29,7 @@ } ], "openBy": "Kevin Torres", - "closedBy": "Cynthia Phillips", + "completedBy": "Cynthia Phillips", "observationsCacem": "Toward agency blue now hand. Meet answer someone stand.", "observationsCnsp": null, "facade": "MED", @@ -40,7 +40,6 @@ "updatedAtUtc": "2021-01-20T08:29:11.923703Z", "envActions": [], "missionSource": "POSEIDON_CNSP", - "isClosed": true, "isUnderJdp": false, "isGeometryComputedFromControls": false } diff --git a/frontend/cypress/mappings/get-missions-by-ids-5.json b/frontend/cypress/mappings/get-missions-by-ids-5.json index 1b9e082a95..54642f9272 100644 --- a/frontend/cypress/mappings/get-missions-by-ids-5.json +++ b/frontend/cypress/mappings/get-missions-by-ids-5.json @@ -30,7 +30,7 @@ } ], "openBy": "Chase Hernandez", - "closedBy": "Matthew Buckley", + "completedBy": "Matthew Buckley", "observationsCacem": "Fly chance record lawyer those. Once position indicate war medical through. Interest read possible.", "observationsCnsp": null, "facade": "SA", @@ -40,7 +40,6 @@ "endDateTimeUtc": null, "envActions": [], "missionSource": "MONITORENV", - "isClosed": false, "isUnderJdp": false } ] diff --git a/frontend/cypress/mappings/get-missions.json b/frontend/cypress/mappings/get-missions.json index f679241e5c..3873e8b9c6 100644 --- a/frontend/cypress/mappings/get-missions.json +++ b/frontend/cypress/mappings/get-missions.json @@ -30,7 +30,7 @@ } ], "openBy": "Brittany Graham", - "closedBy": "Samantha Jones", + "completedBy": "Samantha Jones", "observationsCacem": "Maybe own each college away likely major. Former space technology million cell. Outside body my drop require.", "observationsCnsp": null, "facade": "MEMN", @@ -40,7 +40,6 @@ "endDateTimeUtc": "2024-01-23T02:49:25.923703Z", "envActions": [], "missionSource": "POSEIDON_CNSP", - "isClosed": false, "isUnderJdp": false }, { @@ -57,7 +56,7 @@ } ], "openBy": "Brian Gibbs", - "closedBy": "Mary Rogers", + "completedBy": "Mary Rogers", "observationsCacem": "Magazine more morning we career born. Language notice site next history.", "observationsCnsp": null, "facade": "MEMN", @@ -67,7 +66,6 @@ "endDateTimeUtc": null, "envActions": [], "missionSource": "MONITORFISH", - "isClosed": false, "isUnderJdp": false }, { @@ -89,7 +87,7 @@ } ], "openBy": "Kevin Torres", - "closedBy": "Cynthia Phillips", + "completedBy": "Cynthia Phillips", "observationsCacem": "Toward agency blue now hand. Meet answer someone stand.", "observationsCnsp": null, "facade": "MED", @@ -99,7 +97,6 @@ "endDateTimeUtc": "2023-02-14T17:45:28.923703Z", "envActions": [], "missionSource": "POSEIDON_CNSP", - "isClosed": true, "isUnderJdp": false }, { @@ -121,7 +118,7 @@ } ], "openBy": "Kara Heath", - "closedBy": "James Reed", + "completedBy": "James Reed", "observationsCacem": "Machine office recently answer dark such toward west. Around tree green management opportunity central then. Can time into magazine.", "observationsCnsp": null, "facade": "MEMN", @@ -131,7 +128,6 @@ "endDateTimeUtc": "2023-02-17T13:30:50.923703Z", "envActions": [], "missionSource": "MONITORENV", - "isClosed": false, "isUnderJdp": false }, { @@ -153,7 +149,7 @@ } ], "openBy": "Kevin Torres", - "closedBy": "Cynthia Phillips", + "completedBy": "Cynthia Phillips", "observationsCacem": "Toward agency blue now hand. Meet answer someone stand.", "observationsCnsp": null, "facade": "MED", @@ -163,7 +159,6 @@ "endDateTimeUtc": "2023-02-14T17:45:28.923703Z", "envActions": [], "missionSource": "POSEIDON_CNSP", - "isClosed": true, "isUnderJdp": false }, { @@ -196,7 +191,7 @@ } ], "openBy": "Steve Snyder", - "closedBy": "Jacob Martin", + "completedBy": "Jacob Martin", "observationsCacem": "Surface different shoulder interview. Job together area probably. Of alone class capital determine machine always.", "observationsCnsp": null, "facade": "MEMN", @@ -236,7 +231,7 @@ "coverMissionZone": true, "hasSomeGearsSeized": false, "hasSomeSpeciesSeized": false, - "closedBy": null + "completedBy": null }, { "actionType": "CONTROL", @@ -271,11 +266,10 @@ ], "hasSomeGearsSeized": false, "hasSomeSpeciesSeized": false, - "closedBy": null + "completedBy": null } ], "missionSource": "MONITORENV", - "isClosed": false, "isUnderJdp": false }, { @@ -292,7 +286,7 @@ } ], "openBy": "Brittany Graham", - "closedBy": "Samantha Jones", + "completedBy": "Samantha Jones", "observationsCacem": "Maybe own each college away likely major. Former space technology million cell. Outside body my drop require.", "observationsCnsp": null, "facade": "MEMN", @@ -302,7 +296,6 @@ "endDateTimeUtc": null, "envActions": [], "missionSource": "POSEIDON_CNSP", - "isClosed": false, "isUnderJdp": false }, { @@ -319,7 +312,7 @@ } ], "openBy": "Brittany Graham", - "closedBy": "Samantha Jones", + "completedBy": "Samantha Jones", "observationsCacem": "Maybe own each college away likely major. Former space technology million cell. Outside body my drop require.", "observationsCnsp": null, "facade": "Guadeloupe", @@ -329,7 +322,6 @@ "endDateTimeUtc": null, "envActions": [], "missionSource": "POSEIDON_CNSP", - "isClosed": false, "isUnderJdp": false }, { @@ -346,7 +338,7 @@ } ], "openBy": "Randy Woodward", - "closedBy": "Timothy Patrick", + "completedBy": "Timothy Patrick", "observationsCacem": "Black bit sell. House relate policy once. White member worker east even anyone detail professor.", "observationsCnsp": null, "facade": null, @@ -408,7 +400,6 @@ } ], "missionSource": "MONITORENV", - "isClosed": true, "isUnderJdp": false }, { @@ -425,7 +416,7 @@ } ], "openBy": "Darren Clark", - "closedBy": "Heidi Silva", + "completedBy": "Heidi Silva", "observationsCacem": "Anything box film quality. Lot series agent out rule end young pressure.", "observationsCnsp": null, "facade": "MED", @@ -449,7 +440,6 @@ "endDateTimeUtc": "2023-03-13T09:49:40.350661Z", "envActions": [], "missionSource": "MONITORENV", - "isClosed": false, "isUnderJdp": false }, { @@ -466,7 +456,7 @@ } ], "openBy": "Brittany Graham", - "closedBy": "Samantha Jones", + "completedBy": "Samantha Jones", "observationsCacem": "Maybe own each college away likely major. Former space technology million cell. Outside body my drop require.", "observationsCnsp": null, "facade": "MEMN", @@ -476,7 +466,6 @@ "endDateTimeUtc": "2023-01-23T02:49:25.923703Z", "envActions": [], "missionSource": "POSEIDON_CNSP", - "isClosed": false, "isUnderJdp": false }, { @@ -493,7 +482,7 @@ } ], "openBy": "Christina Thomas", - "closedBy": "Amanda Smith", + "completedBy": "Amanda Smith", "observationsCacem": "Decision about effect sport hour field. Care finally minute stop.", "observationsCnsp": null, "facade": "SA", @@ -503,7 +492,6 @@ "endDateTimeUtc": "2022-12-28T17:14:45.923703Z", "envActions": [], "missionSource": "POSEIDON_CNSP", - "isClosed": true, "isUnderJdp": false }, { @@ -520,7 +508,7 @@ } ], "openBy": "Chase Hernandez", - "closedBy": "Matthew Buckley", + "completedBy": "Matthew Buckley", "observationsCacem": "Fly chance record lawyer those. Once position indicate war medical through. Interest read possible.", "observationsCnsp": null, "facade": "SA", @@ -530,7 +518,6 @@ "endDateTimeUtc": null, "envActions": [], "missionSource": "MONITORENV", - "isClosed": false, "isUnderJdp": false }, { @@ -547,7 +534,7 @@ } ], "openBy": "Michael Wilson", - "closedBy": "Michael Brooks", + "completedBy": "Michael Brooks", "observationsCacem": "Check environment role actually whether majority blood. And action section bag middle. Somebody main stage sense.", "observationsCnsp": null, "facade": null, @@ -560,7 +547,6 @@ "endDateTimeUtc": "2023-03-20T11:14:02.923703Z", "envActions": [], "missionSource": "MONITORENV", - "isClosed": true, "isUnderJdp": false } ] diff --git a/frontend/cypress/mappings/post-mission.json b/frontend/cypress/mappings/post-mission.json index c68ed70011..eae5bdaab8 100644 --- a/frontend/cypress/mappings/post-mission.json +++ b/frontend/cypress/mappings/post-mission.json @@ -24,7 +24,7 @@ } ], "openBy": "Brittany Graham", - "closedBy": "Samantha Jones", + "completedBy": "Samantha Jones", "observationsCacem": "Maybe own each college away likely major. Former space technology million cell. Outside body my drop require.", "observationsCnsp": null, "facade": "MEMN", @@ -35,7 +35,6 @@ "updatedAtUtc": "2023-01-20T08:29:11.923703Z", "envActions": [], "missionSource": "POSEIDON_CNSP", - "isClosed": false, "isUnderJdp": false } } diff --git a/frontend/cypress/mappings/post-missions.json b/frontend/cypress/mappings/post-missions.json index 9e0d0bf441..72c490467b 100644 --- a/frontend/cypress/mappings/post-missions.json +++ b/frontend/cypress/mappings/post-missions.json @@ -24,7 +24,7 @@ } ], "openBy": "Brittany Graham", - "closedBy": "Samantha Jones", + "completedBy": "Samantha Jones", "observationsCacem": "Maybe own each college away likely major. Former space technology million cell. Outside body my drop require.", "observationsCnsp": null, "facade": "MEMN", @@ -35,7 +35,6 @@ "updatedAtUtc": "2023-01-20T08:29:11.923703Z", "envActions": [], "missionSource": "POSEIDON_CNSP", - "isClosed": false, "isUnderJdp": false, "isGeometryComputedFromControls": false } diff --git a/frontend/cypress/mappings/update-mission-38-scenario.json b/frontend/cypress/mappings/update-mission-38-scenario.json index e8d7f9d333..cb823494e5 100644 --- a/frontend/cypress/mappings/update-mission-38-scenario.json +++ b/frontend/cypress/mappings/update-mission-38-scenario.json @@ -28,7 +28,7 @@ } ], "openBy": "Randy Woodward", - "closedBy": "Timothy Patrick", + "completedBy": "Timothy Patrick", "observationsCacem": "Black bit sell. House relate policy once. White member worker east even anyone detail professor.", "observationsCnsp": null, "facade": null, @@ -89,11 +89,10 @@ "infractions": [], "hasSomeGearsSeized": false, "hasSomeSpeciesSeized": false, - "closedBy": null + "completedBy": null } ], "missionSource": "MONITORENV", - "isClosed": true, "isUnderJdp": false, "isGeometryComputedFromControls": false } @@ -128,7 +127,7 @@ } ], "openBy": "Randy Woodward", - "closedBy": "Timothy Patrick", + "completedBy": "Timothy Patrick", "observationsCacem": "Black bit sell. House relate policy once. White member worker east even anyone detail professor.", "observationsCnsp": null, "facade": null, @@ -189,11 +188,10 @@ "infractions": [], "hasSomeGearsSeized": false, "hasSomeSpeciesSeized": false, - "closedBy": null + "completedBy": null } ], "missionSource": "MONITORENV", - "isClosed": true, "isUnderJdp": false, "isGeometryComputedFromControls": false } @@ -227,7 +225,7 @@ } ], "openBy": "Randy Woodward", - "closedBy": "Timothy Patrick", + "completedBy": "Timothy Patrick", "observationsCacem": "Black bit sell. House relate policy once. White member worker east even anyone detail professor.", "observationsCnsp": null, "facade": null, @@ -288,11 +286,10 @@ "infractions": [], "hasSomeGearsSeized": false, "hasSomeSpeciesSeized": false, - "closedBy": null + "completedBy": null } ], "missionSource": "MONITORENV", - "isClosed": true, "isUnderJdp": false, "isGeometryComputedFromControls": false } diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 0ef4049b98..32bbdaee9c 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@dnd-kit/core": "6.1.0", "@dnd-kit/modifiers": "6.0.1", - "@mtes-mct/monitor-ui": "14.3.1", + "@mtes-mct/monitor-ui": "17.1.0", "@reduxjs/toolkit": "1.9.6", "@sentry/browser": "7.55.2", "@sentry/react": "7.52.1", @@ -722,9 +722,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.24.4", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.4.tgz", - "integrity": "sha512-dkxf7+hn8mFBwKjs9bvBlArzLVxVbS8usaPUDd5p2a9JCL9tB8OaOVN1isD4+Xyk4ns89/xeOmbQvgdK7IIVdA==", + "version": "7.24.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.5.tgz", + "integrity": "sha512-Nms86NXrsaeU9vbBJKni6gXiEXZ4CVpYVzEjDH9Sb8vmZ3UljyA1GSOJl/6LGPO8EHLuSF9H+IxNXHPX8QHJ4g==", "dependencies": { "regenerator-runtime": "^0.14.0" }, @@ -2504,11 +2504,11 @@ "integrity": "sha512-HPnRdYO0WjFjRTSwO3frz1wKaU649OBFPX3Zo/2WZvuRi6zMiRGui8SnPQiQABgqCf8YikDe5t3HViTVw1WUzA==" }, "node_modules/@mtes-mct/monitor-ui": { - "version": "14.3.1", - "resolved": "https://registry.npmjs.org/@mtes-mct/monitor-ui/-/monitor-ui-14.3.1.tgz", - "integrity": "sha512-B3/32REynPCvhfSaBSmiOAiHR7leNt57Ns62ooPQ3PrJRCn82LLYGrwo1UwazKHDjyrPpHzzpWqcP5EH+5DcJQ==", + "version": "17.1.0", + "resolved": "https://registry.npmjs.org/@mtes-mct/monitor-ui/-/monitor-ui-17.1.0.tgz", + "integrity": "sha512-rm8X978HX32skknWbI0Pw+zqaFvowADsbxYNnb59y9wvxvoz23CmNxvdq2t9bnDVHVZajKQEYvLjeKS00zOvnQ==", "dependencies": { - "@babel/runtime": "7.24.4", + "@babel/runtime": "7.24.5", "@tanstack/react-table": "8.9.7", "@tanstack/react-virtual": "beta", "prop-types": "15.8.1", diff --git a/frontend/package.json b/frontend/package.json index 70283e3552..758a38029b 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -35,7 +35,7 @@ "dependencies": { "@dnd-kit/core": "6.1.0", "@dnd-kit/modifiers": "6.0.1", - "@mtes-mct/monitor-ui": "14.3.1", + "@mtes-mct/monitor-ui": "17.1.0", "@reduxjs/toolkit": "1.9.6", "@sentry/browser": "7.55.2", "@sentry/react": "7.52.1", diff --git a/frontend/src/domain/shared_slices/Vessel.ts b/frontend/src/domain/shared_slices/Vessel.ts index 9cca184842..18cd4cc53e 100644 --- a/frontend/src/domain/shared_slices/Vessel.ts +++ b/frontend/src/domain/shared_slices/Vessel.ts @@ -1,7 +1,8 @@ +import { reportingIsAnInfractionSuspicion } from '@features/Reporting/utils' import { createSlice } from '@reduxjs/toolkit' import { transform } from 'ol/proj' -import { reportingIsAnInfractionSuspicion, ReportingTypeCharacteristics } from '../../features/Reporting/types' +import { ReportingTypeCharacteristics } from '../../features/Reporting/types' import { OPENLAYERS_PROJECTION, WSG84_PROJECTION } from '../entities/map/constants' import { atLeastOneVesselSelected, diff --git a/frontend/src/features/AdministrativeZone/components/AdministrativeZones/index.tsx b/frontend/src/features/AdministrativeZone/components/AdministrativeZones/index.tsx index 6c37f307da..d3fd4dcdd5 100644 --- a/frontend/src/features/AdministrativeZone/components/AdministrativeZones/index.tsx +++ b/frontend/src/features/AdministrativeZone/components/AdministrativeZones/index.tsx @@ -141,7 +141,7 @@ const SectionTitle = styled.div<{ border-bottom-left-radius: ${p => (p.isOpened ? '0' : '2px')}; border-bottom-right-radius: ${p => (p.isOpened ? '0' : '2px')}; - > div { + .Element-IconBox { float: right; margin-top: 4px; } diff --git a/frontend/src/features/BaseMap/components/BaseMaps/index.tsx b/frontend/src/features/BaseMap/components/BaseMaps/index.tsx index 3538ebe5c0..5189ef8ba0 100644 --- a/frontend/src/features/BaseMap/components/BaseMaps/index.tsx +++ b/frontend/src/features/BaseMap/components/BaseMaps/index.tsx @@ -84,7 +84,7 @@ const Title = styled.div<{ border-bottom-left-radius: ${p => (p.isShowed ? '0' : '2px')}; border-bottom-right-radius: ${p => (p.isShowed ? '0' : '2px')}; - > div { + .Element-IconBox { float: right; margin-top: 4px; } diff --git a/frontend/src/features/ControlUnit/components/ControlUnitDialog/ControlUnitContactList/constants.ts b/frontend/src/features/ControlUnit/components/ControlUnitDialog/ControlUnitContactList/constants.ts index 25700d37b0..b9689362da 100644 --- a/frontend/src/features/ControlUnit/components/ControlUnitDialog/ControlUnitContactList/constants.ts +++ b/frontend/src/features/ControlUnit/components/ControlUnitDialog/ControlUnitContactList/constants.ts @@ -7,12 +7,12 @@ export const CONTROL_UNIT_CONTACT_FORM_SCHEMA = object().shape( { email: string().when('phone', { is: phone => !phone, - then: shema => shema.required('Veuillez entrer un téléphone ou un email.') + then: schema => schema.required('Veuillez entrer un téléphone ou un email.') }), name: string().required('Veuillez choisir un nom.'), phone: string().when('email', { is: email => !email, - then: shema => shema.required('Veuillez entrer un téléphone ou un email.') + then: schema => schema.required('Veuillez entrer un téléphone ou un email.') }) }, [['email', 'phone']] @@ -21,6 +21,8 @@ export const CONTROL_UNIT_CONTACT_FORM_SCHEMA = object().shape( export const INITIAL_CONTROL_UNIT_CONTACT_FORM_VALUES: ControlUnitContactFormValues = { controlUnitId: undefined, email: undefined, + isEmailSubscriptionContact: undefined, + isSmsSubscriptionContact: undefined, name: undefined, phone: undefined } diff --git a/frontend/src/features/CustomZone/components/CustomZones/index.tsx b/frontend/src/features/CustomZone/components/CustomZones/index.tsx index 9532a71e9e..6e93f30df9 100644 --- a/frontend/src/features/CustomZone/components/CustomZones/index.tsx +++ b/frontend/src/features/CustomZone/components/CustomZones/index.tsx @@ -128,7 +128,7 @@ const Title = styled.div<{ border-bottom-left-radius: ${p => (p.isOpened ? '0' : '2px')}; border-bottom-right-radius: ${p => (p.isOpened ? '0' : '2px')}; - > div { + .Element-IconBox { float: right; margin-top: 4px; } diff --git a/frontend/src/features/Mission/components/MissionForm/ActionList/utils.tsx b/frontend/src/features/Mission/components/MissionForm/ActionList/utils.tsx index 8eac7043df..2588cc32ea 100644 --- a/frontend/src/features/Mission/components/MissionForm/ActionList/utils.tsx +++ b/frontend/src/features/Mission/components/MissionForm/ActionList/utils.tsx @@ -5,6 +5,8 @@ import styled from 'styled-components' import type { MissionActionFormValues } from '../types' import type { ReactNode } from 'react' +import CompletionStatus = MissionAction.CompletionStatus + export function formatDateLabel(dateLabel: string) { return dateLabel.replace( /([a-z])([a-zéû]+)\.?$/, @@ -65,6 +67,7 @@ export function getMissionActionFormInitialValues(type: MissionAction.MissionAct return { actionDatetimeUtc, actionType: type, + completion: CompletionStatus.TO_COMPLETE, isValid: false } } diff --git a/frontend/src/features/Mission/components/MissionForm/MainForm/index.tsx b/frontend/src/features/Mission/components/MissionForm/MainForm/index.tsx index 40bac007c5..77e7daa37c 100644 --- a/frontend/src/features/Mission/components/MissionForm/MainForm/index.tsx +++ b/frontend/src/features/Mission/components/MissionForm/MainForm/index.tsx @@ -118,7 +118,7 @@ function UnmemoizedMainForm({ initialValues, missionId, onChange }: MainFormProp - + diff --git a/frontend/src/features/Mission/components/MissionForm/index.tsx b/frontend/src/features/Mission/components/MissionForm/index.tsx index 3bb3e8bb6b..784159b94a 100644 --- a/frontend/src/features/Mission/components/MissionForm/index.tsx +++ b/frontend/src/features/Mission/components/MissionForm/index.tsx @@ -370,7 +370,7 @@ export function MissionForm() { <> {isMissionCreatedBannerDisplayed && ( - La mission a bien été créée - + )} {missionCompletion === MissionAction.FrontCompletionStatus.TO_COMPLETE_MISSION_ENDED && ( - Veuillez compléter ou corriger les éléments en rouge - + )}
@@ -507,6 +507,10 @@ export function MissionForm() { ) } +const StyledBanner = styled(Banner)` + left: unset; +` + const MissionCreatedText = styled.div` align-items: center; display: flex; diff --git a/frontend/src/features/Mission/index.ts b/frontend/src/features/Mission/features.ts similarity index 100% rename from frontend/src/features/Mission/index.ts rename to frontend/src/features/Mission/features.ts diff --git a/frontend/src/features/Mission/layers/HoveredMissionLayer.tsx b/frontend/src/features/Mission/layers/HoveredMissionLayer.tsx index e9ed0e5da7..c5e457a9db 100644 --- a/frontend/src/features/Mission/layers/HoveredMissionLayer.tsx +++ b/frontend/src/features/Mission/layers/HoveredMissionLayer.tsx @@ -7,7 +7,7 @@ import { LayerProperties } from '../../../domain/entities/layers/constants' import { MonitorFishLayer } from '../../../domain/entities/layers/types' import { monitorfishMap } from '../../map/monitorfishMap' import { useGetFilteredMissionsQuery } from '../components/MissionList/hooks/useGetFilteredMissionsQuery' -import { getMissionFeatureZone } from '../index' +import { getMissionFeatureZone } from '../features' import type { VectorLayerWithName } from '../../../domain/types/layer' diff --git a/frontend/src/features/Mission/layers/MissionLayer/index.tsx b/frontend/src/features/Mission/layers/MissionLayer/index.tsx index e6e8c8fee4..a670b3fbe6 100644 --- a/frontend/src/features/Mission/layers/MissionLayer/index.tsx +++ b/frontend/src/features/Mission/layers/MissionLayer/index.tsx @@ -8,7 +8,7 @@ import { LayerProperties } from '../../../../domain/entities/layers/constants' import { MonitorFishLayer } from '../../../../domain/entities/layers/types' import { monitorfishMap } from '../../../map/monitorfishMap' import { useGetFilteredMissionsQuery } from '../../components/MissionList/hooks/useGetFilteredMissionsQuery' -import { getMissionFeaturePoint } from '../../index' +import { getMissionFeaturePoint } from '../../features' import type { WebGLPointsLayerWithName } from '../../../../domain/types/layer' import type { Feature } from 'ol' diff --git a/frontend/src/features/Mission/layers/SelectedMissionActionsLayer/index.tsx b/frontend/src/features/Mission/layers/SelectedMissionActionsLayer/index.tsx index 88e88fbc8f..5965c210d8 100644 --- a/frontend/src/features/Mission/layers/SelectedMissionActionsLayer/index.tsx +++ b/frontend/src/features/Mission/layers/SelectedMissionActionsLayer/index.tsx @@ -8,7 +8,7 @@ import { LayerProperties } from '../../../../domain/entities/layers/constants' import { MonitorFishLayer } from '../../../../domain/entities/layers/types' import { monitorfishMap } from '../../../map/monitorfishMap' import { useGetFilteredMissionsQuery } from '../../components/MissionList/hooks/useGetFilteredMissionsQuery' -import { getMissionActionFeature, getMissionActionFeatureZone } from '../../index' +import { getMissionActionFeature, getMissionActionFeatureZone } from '../../features' import { NEW_MISSION_ID } from '../constants' import type { GeoJSON } from '../../../../domain/types/GeoJSON' diff --git a/frontend/src/features/Mission/layers/SelectedMissionLayer.tsx b/frontend/src/features/Mission/layers/SelectedMissionLayer.tsx index 852554d889..325be3b131 100644 --- a/frontend/src/features/Mission/layers/SelectedMissionLayer.tsx +++ b/frontend/src/features/Mission/layers/SelectedMissionLayer.tsx @@ -11,7 +11,7 @@ import { MonitorFishLayer } from '../../../domain/entities/layers/types' import { OPENLAYERS_PROJECTION } from '../../../domain/entities/map/constants' import { monitorfishMap } from '../../map/monitorfishMap' import { useGetFilteredMissionsQuery } from '../components/MissionList/hooks/useGetFilteredMissionsQuery' -import { getMissionFeatureZone } from '../index' +import { getMissionFeatureZone } from '../features' import type { VectorLayerWithName } from '../../../domain/types/layer' diff --git a/frontend/src/features/Mission/mission.types.ts b/frontend/src/features/Mission/mission.types.ts index 580e429fa9..81f94a4ca4 100644 --- a/frontend/src/features/Mission/mission.types.ts +++ b/frontend/src/features/Mission/mission.types.ts @@ -8,7 +8,7 @@ import type { Except } from 'type-fest' export namespace Mission { export interface Mission { - closedBy?: string + completedBy?: string controlUnits: LegacyControlUnit.LegacyControlUnit[] createdAtUtc?: string | undefined endDateTimeUtc?: string @@ -17,8 +17,6 @@ export namespace Mission { geom?: GeoJSON.MultiPolygon hasMissionOrder?: boolean | undefined id: number - // TODO To remove when `isClosed` is removed - isClosed?: boolean | undefined isGeometryComputedFromControls: boolean isUnderJdp?: boolean | undefined missionSource: MissionSource diff --git a/frontend/src/features/Mission/useCases/deleteMissionAction.ts b/frontend/src/features/Mission/useCases/deleteMissionAction.ts index bbb958be4d..ec6c130a62 100644 --- a/frontend/src/features/Mission/useCases/deleteMissionAction.ts +++ b/frontend/src/features/Mission/useCases/deleteMissionAction.ts @@ -2,6 +2,7 @@ import { missionActionApi } from '@api/missionAction' import { portApi } from '@api/port' import { formikUsecase } from '@features/Mission/components/MissionForm/formikUsecases' import { missionFormActions } from '@features/Mission/components/MissionForm/slice' +import { validateMissionForms } from '@features/Mission/components/MissionForm/utils/validateMissionForms' import { monitorfishMissionApi } from '@features/Mission/monitorfishMissionApi' import { MissionAction } from '../missionAction.types' @@ -17,6 +18,7 @@ export const deleteMissionAction = isGeometryComputedFromControls: boolean ): MainAppThunk> => async (dispatch, getState) => { + const mainFormValuesFromDraft = getState().missionForm.draft?.mainFormValues const deletedAction = actionsFormValues.find((_, index) => index === actionIndex) const nextActionsFormValues = actionsFormValues.filter((_, index) => index !== actionIndex) @@ -27,10 +29,13 @@ export const deleteMissionAction = } if (!deletedAction?.id) { + initIsDraftDirty() + return nextActionsFormValues } await dispatch(missionActionApi.endpoints.deleteMissionAction.initiate(deletedAction.id)).unwrap() + initIsDraftDirty() const nextControlActionsWithGeometry = nextActionsFormValues .filter( @@ -49,7 +54,7 @@ export const deleteMissionAction = } else { const { data: ports } = await dispatch(portApi.endpoints.getPorts.initiate()) const missionId = getState().missionForm.draft?.mainFormValues?.id - const envActions = await getEnvActions(dispatch, missionId) + const envActions = await getEnvActions(missionId) await formikUsecase.updateMissionLocation( dispatch, @@ -59,14 +64,25 @@ export const deleteMissionAction = } return nextActionsFormValues - } -async function getEnvActions(dispatch, missionId: number | undefined) { - if (!missionId) { - return [] - } + /** Functions */ + + function initIsDraftDirty() { + if (mainFormValuesFromDraft) { + const [areFormsValid] = validateMissionForms(mainFormValuesFromDraft, actionsFormValues, false) + if (areFormsValid) { + dispatch(missionFormActions.setIsDraftDirty(false)) + } + } + } + + async function getEnvActions(missionId: number | undefined) { + if (!missionId) { + return [] + } - const { data: mission } = await dispatch(monitorfishMissionApi.endpoints.getMission.initiate(missionId)) + const { data: mission } = await dispatch(monitorfishMissionApi.endpoints.getMission.initiate(missionId)) - return mission?.envActions ?? [] -} + return mission?.envActions ?? [] + } + } diff --git a/frontend/src/features/Regulation/components/RegulatoryZones/index.tsx b/frontend/src/features/Regulation/components/RegulatoryZones/index.tsx index 1f4b7acf1b..149fffc47d 100644 --- a/frontend/src/features/Regulation/components/RegulatoryZones/index.tsx +++ b/frontend/src/features/Regulation/components/RegulatoryZones/index.tsx @@ -171,7 +171,7 @@ const RegulatoryLayersTitle = styled.div<{ } } - > div { + .Element-IconBox { float: right; margin-top: 4px; } diff --git a/frontend/src/features/Reporting/__tests__/utils.test.ts b/frontend/src/features/Reporting/__tests__/utils.test.ts new file mode 100644 index 0000000000..1fb5008862 --- /dev/null +++ b/frontend/src/features/Reporting/__tests__/utils.test.ts @@ -0,0 +1,156 @@ +import { Seafront } from '@constants/seafront' +import { getYearsToReportings } from '@features/Reporting/utils' +import { expect } from '@jest/globals' + +import { PendingAlertValueType } from '../../../domain/entities/alerts/types' +import { VesselIdentifier } from '../../../domain/entities/vessel/types' +import { ReportingType } from '../../../domain/types/reporting' + +import type { PendingAlertReporting } from '../../../domain/types/reporting' + +describe('utils', () => { + it('getYearsToReportingList should return years to reportings', () => { + // Given + const fromDate = new Date(2018, 0, 1) + const firstReporting: PendingAlertReporting = { + creationDate: '2023-10-30T09:10:00Z', + externalReferenceNumber: '', + flagState: 'ES', + id: 12345, + infraction: { + infraction: + 'Pêche maritime non autorisée dans les eaux territoriales francaise par capitaine de navire communautaire', + infractionCategory: 'FISHING', + natinfCode: 2610, + regulation: 'ART.L.945-2 §I AL.1, ART.L.945-5 1°,2°,3°,4° C.RUR' + }, + internalReferenceNumber: 'FR04504564', + ircs: '', + isArchived: false, + isDeleted: false, + type: ReportingType.ALERT, + underCharter: null, + validationDate: '2023-10-30T15:08:05.845121Z', + value: { + dml: null, + natinfCode: 2610, + seaFront: Seafront.NAMO, + type: PendingAlertValueType.TWELVE_MILES_FISHING_ALERT + }, + vesselId: 1234568, + vesselIdentifier: VesselIdentifier.INTERNAL_REFERENCE_NUMBER, + vesselName: 'A VESSEL' + } + const secondReporting: PendingAlertReporting = { + ...firstReporting, + creationDate: '2023-12-30T15:08:05.845121Z', + validationDate: null + } + const thirdReporting: PendingAlertReporting = { + ...firstReporting, + validationDate: '2024-12-30T15:08:15.845121Z' + } + + // When + const result = getYearsToReportings(fromDate, [firstReporting, secondReporting, thirdReporting]) + + // Then + expect(result).toStrictEqual({ + '2019': [], + '2020': [], + '2021': [], + '2022': [], + '2023': [ + { + creationDate: '2023-10-30T09:10:00Z', + externalReferenceNumber: '', + flagState: 'ES', + id: 12345, + infraction: { + infraction: + 'Pêche maritime non autorisée dans les eaux territoriales francaise par capitaine de navire communautaire', + infractionCategory: 'FISHING', + natinfCode: 2610, + regulation: 'ART.L.945-2 §I AL.1, ART.L.945-5 1°,2°,3°,4° C.RUR' + }, + internalReferenceNumber: 'FR04504564', + ircs: '', + isArchived: false, + isDeleted: false, + type: 'ALERT', + underCharter: null, + validationDate: '2023-10-30T15:08:05.845121Z', + value: { + dml: null, + natinfCode: 2610, + seaFront: 'NAMO', + type: 'TWELVE_MILES_FISHING_ALERT' + }, + vesselId: 1234568, + vesselIdentifier: 'INTERNAL_REFERENCE_NUMBER', + vesselName: 'A VESSEL' + }, + { + creationDate: '2023-12-30T15:08:05.845121Z', + externalReferenceNumber: '', + flagState: 'ES', + id: 12345, + infraction: { + infraction: + 'Pêche maritime non autorisée dans les eaux territoriales francaise par capitaine de navire communautaire', + infractionCategory: 'FISHING', + natinfCode: 2610, + regulation: 'ART.L.945-2 §I AL.1, ART.L.945-5 1°,2°,3°,4° C.RUR' + }, + internalReferenceNumber: 'FR04504564', + ircs: '', + isArchived: false, + isDeleted: false, + type: 'ALERT', + underCharter: null, + validationDate: null, + value: { + dml: null, + natinfCode: 2610, + seaFront: 'NAMO', + type: 'TWELVE_MILES_FISHING_ALERT' + }, + vesselId: 1234568, + vesselIdentifier: 'INTERNAL_REFERENCE_NUMBER', + vesselName: 'A VESSEL' + } + ], + '2024': [ + { + creationDate: '2023-10-30T09:10:00Z', + externalReferenceNumber: '', + flagState: 'ES', + id: 12345, + infraction: { + infraction: + 'Pêche maritime non autorisée dans les eaux territoriales francaise par capitaine de navire communautaire', + infractionCategory: 'FISHING', + natinfCode: 2610, + regulation: 'ART.L.945-2 §I AL.1, ART.L.945-5 1°,2°,3°,4° C.RUR' + }, + internalReferenceNumber: 'FR04504564', + ircs: '', + isArchived: false, + isDeleted: false, + type: 'ALERT', + underCharter: null, + validationDate: '2024-12-30T15:08:15.845121Z', + value: { + dml: null, + natinfCode: 2610, + seaFront: 'NAMO', + type: 'TWELVE_MILES_FISHING_ALERT' + }, + vesselId: 1234568, + vesselIdentifier: 'INTERNAL_REFERENCE_NUMBER', + vesselName: 'A VESSEL' + } + ] + }) + }) +}) diff --git a/frontend/src/features/Reporting/components/VesselReportings/Archived/YearReportings.tsx b/frontend/src/features/Reporting/components/VesselReportings/Archived/YearReportings.tsx index 294816ee26..8d4443acc2 100644 --- a/frontend/src/features/Reporting/components/VesselReportings/Archived/YearReportings.tsx +++ b/frontend/src/features/Reporting/components/VesselReportings/Archived/YearReportings.tsx @@ -1,14 +1,14 @@ -import { useMemo, useState } from 'react' -import styled from 'styled-components' - -import { COLORS } from '../../../../../constants/constants' +import { reportingIsAnInfractionSuspicion } from '@features/Reporting/utils' import { YearListChevronIcon, YearListContent, YearListTitle, YearListTitleText -} from '../../../../VesselSidebar/common_styles/YearList.style' -import { reportingIsAnInfractionSuspicion } from '../../../types' +} from '@features/VesselSidebar/common_styles/YearList.style' +import { THEME } from '@mtes-mct/monitor-ui' +import { useMemo, useState } from 'react' +import styled from 'styled-components' + import { ReportingCard } from '../ReportingCard' import type { Reporting } from '../../../../../domain/types/reporting' @@ -105,18 +105,18 @@ const Opal = styled.span` height: 8px; width: 8px; margin-left: 5px; - background-color: ${COLORS.opal}; + background-color: ${THEME.color.opal}; border-radius: 50%; display: inline-block; ` const Year = styled.span` - color: ${COLORS.slateGray}; + color: ${THEME.color.slateGray}; font-size: 16px; ` const YearResume = styled.span` - color: ${COLORS.gunMetal}; + color: ${THEME.color.gunMetal}; font-size: 13px; margin-left: 15px; vertical-align: text-bottom; diff --git a/frontend/src/features/Reporting/components/VesselReportings/Archived/index.tsx b/frontend/src/features/Reporting/components/VesselReportings/Archived/index.tsx index 2fe79ec721..8ea08faee2 100644 --- a/frontend/src/features/Reporting/components/VesselReportings/Archived/index.tsx +++ b/frontend/src/features/Reporting/components/VesselReportings/Archived/index.tsx @@ -1,19 +1,22 @@ +import { getYearsToReportings } from '@features/Reporting/utils' +import { Header, Zone } from '@features/VesselSidebar/common_styles/common.style' +import { useMainAppDispatch } from '@hooks/useMainAppDispatch' +import { useMainAppSelector } from '@hooks/useMainAppSelector' +import { THEME } from '@mtes-mct/monitor-ui' import dayjs from 'dayjs' -import { useCallback, useMemo } from 'react' +import { useMemo } from 'react' import styled from 'styled-components' import { YearReportings } from './YearReportings' -import { COLORS } from '../../../../../constants/constants' -import { useMainAppDispatch } from '../../../../../hooks/useMainAppDispatch' -import { useMainAppSelector } from '../../../../../hooks/useMainAppSelector' -import { Header, Zone } from '../../../../VesselSidebar/common_styles/common.style' import { setArchivedReportingsFromDate } from '../../../slice' -import { getYearsToReportingList } from '../../../types' + +import type { Reporting } from '../../../../../domain/types/reporting' export function Archived() { const dispatch = useMainAppDispatch() - const { archivedReportingsFromDate, currentAndArchivedReportingsOfSelectedVessel } = useMainAppSelector( - state => state.reporting + const archivedReportingsFromDate = useMainAppSelector(state => state.reporting.archivedReportingsFromDate) + const currentAndArchivedReportingsOfSelectedVessel = useMainAppSelector( + state => state.reporting.currentAndArchivedReportingsOfSelectedVessel ) const yearsToReportings = useMemo(() => { @@ -21,14 +24,14 @@ export function Archived() { return {} } - return getYearsToReportingList(archivedReportingsFromDate, currentAndArchivedReportingsOfSelectedVessel.archived) + return getYearsToReportings(archivedReportingsFromDate, currentAndArchivedReportingsOfSelectedVessel.archived) }, [currentAndArchivedReportingsOfSelectedVessel, archivedReportingsFromDate]) - const seeMore = useCallback(() => { - const nextDate = dayjs(archivedReportingsFromDate).subtract(1, 'year') + function seeMore() { + const nextDate = dayjs(archivedReportingsFromDate).subtract(1, 'year').toDate() dispatch(setArchivedReportingsFromDate(nextDate)) - }, [dispatch, archivedReportingsFromDate]) + } return ( @@ -37,9 +40,16 @@ export function Archived() { {Object.keys(yearsToReportings) .sort((a, b) => Number(b) - Number(a)) - .map(year => ( - - ))} + .map( + year => + yearsToReportings[year] && ( + + ) + )} ) : ( @@ -48,7 +58,12 @@ export function Archived() { )} - Afficher plus de signalements + + Afficher plus de signalements + ) @@ -63,13 +78,13 @@ const List = styled.ul` const NoReporting = styled.div` text-align: center; padding: 10px 0 10px 0; - color: ${COLORS.gunMetal}; + color: ${THEME.color.gunMetal}; font-size: 13px; width: 100%; ` const SeeMoreBackground = styled.div` - background: ${COLORS.white}; + background: ${THEME.color.white}; margin: 0px 5px 5px 5px; padding: 10px 0 5px 0; text-align: center; @@ -77,8 +92,8 @@ const SeeMoreBackground = styled.div` ` const SeeMore = styled.div` - border: 1px solid ${COLORS.charcoal}; - color: ${COLORS.gunMetal}; + border: 1px solid ${THEME.color.charcoal}; + color: ${THEME.color.gunMetal}; padding: 5px 10px 5px 10px; width: max-content; font-size: 13px; @@ -86,5 +101,5 @@ const SeeMore = styled.div` margin-left: auto; margin-right: auto; user-select: none; - background: ${COLORS.white}; + background: ${THEME.color.white}; ` diff --git a/frontend/src/features/Reporting/components/VesselReportings/ReportingCard.tsx b/frontend/src/features/Reporting/components/VesselReportings/ReportingCard.tsx index 161febbe7a..7407a954ab 100644 --- a/frontend/src/features/Reporting/components/VesselReportings/ReportingCard.tsx +++ b/frontend/src/features/Reporting/components/VesselReportings/ReportingCard.tsx @@ -1,4 +1,5 @@ import { getReportingActor } from '@features/Reporting/components/VesselReportings/utils' +import { reportingIsAnInfractionSuspicion } from '@features/Reporting/utils' import { useMemo } from 'react' import styled from 'styled-components' @@ -13,7 +14,7 @@ import InfractionSuspicionIconSVG from '../../../icons/Icone_alerte_signalement_ import ObservationIconSVG from '../../../icons/Icone_observations.svg?react' import { getAlertNameFromType } from '../../../SideWindow/Alert/AlertListAndReportingList/utils' import { setEditedReporting } from '../../slice' -import { reportingIsAnInfractionSuspicion, ReportingTypeCharacteristics } from '../../types' +import { ReportingTypeCharacteristics } from '../../types' import archiveReporting from '../../useCases/archiveReporting' import type { Reporting } from '../../../../domain/types/reporting' diff --git a/frontend/src/features/Reporting/types.ts b/frontend/src/features/Reporting/types.ts index 5996ce5d03..41c9c9a3e4 100644 --- a/frontend/src/features/Reporting/types.ts +++ b/frontend/src/features/Reporting/types.ts @@ -1,7 +1,5 @@ import { ReportingType } from '../../domain/types/reporting' -import type { Reporting } from '../../domain/types/reporting' - type ReportingTypeCharacteristic = { // TODO It should be useless now that types are discriminated. code: ReportingType @@ -62,46 +60,4 @@ export const ReportingOriginActor = { name: 'Autre' } } - -// TODO This should be named differently to avoid confusion with `ReportingType.INFRACTION_SUSPICION` type. -export const infractionSuspicionReportingTypes = Object.values(ReportingTypeCharacteristics) - .filter(type => type.isInfractionSuspicion) - .map(type => type.code) - -// TODO This should be named differently to avoid confusion with `ReportingType.INFRACTION_SUSPICION` type. -export const reportingIsAnInfractionSuspicion = (reportingType: ReportingType): boolean => - infractionSuspicionReportingTypes.indexOf(reportingType) >= 0 - -/** - * Get reporting for each years : Years are keys and reporting are values - */ -// TODO Make that functional. -// TODO Use an object with string keys instead of number ones. -export const getYearsToReportingList = ( - archivedReportingsFromDate: Date, - reportings: Reporting[] -): Record => { - const nextYearsToReporting = {} - if (archivedReportingsFromDate) { - let fromYear = archivedReportingsFromDate.getUTCFullYear() + 1 - const toYear = new Date().getUTCFullYear() - while (fromYear <= toYear) { - nextYearsToReporting[fromYear] = [] - fromYear += 1 - } - } - - reportings.forEach(reporting => { - if (reporting?.creationDate) { - const year = new Date(reporting.validationDate || reporting.creationDate).getUTCFullYear() - - if (nextYearsToReporting[year] && nextYearsToReporting[year].length) { - nextYearsToReporting[year] = nextYearsToReporting[year].concat(reporting) - } else { - nextYearsToReporting[year] = [reporting] - } - } - }) - - return nextYearsToReporting -} +/* eslint-enable sort-keys-fix/sort-keys-fix */ diff --git a/frontend/src/features/Reporting/utils.ts b/frontend/src/features/Reporting/utils.ts new file mode 100644 index 0000000000..5499005598 --- /dev/null +++ b/frontend/src/features/Reporting/utils.ts @@ -0,0 +1,45 @@ +import { ReportingTypeCharacteristics } from '@features/Reporting/types' +import { range } from 'lodash' + +import type { Reporting, ReportingType } from '../../domain/types/reporting' + +// TODO This should be named differently to avoid confusion with `ReportingType.INFRACTION_SUSPICION` type. +export const infractionSuspicionReportingTypes = Object.values(ReportingTypeCharacteristics) + .filter(type => type.isInfractionSuspicion) + .map(type => type.code) + +// TODO This should be named differently to avoid confusion with `ReportingType.INFRACTION_SUSPICION` type. +export const reportingIsAnInfractionSuspicion = (reportingType: ReportingType): boolean => + infractionSuspicionReportingTypes.indexOf(reportingType) >= 0 + +/** + * Get reporting for each years : Years are keys and reporting are values + */ +export const getYearsToReportings = ( + archivedReportingsFromDate: Date, + reportings: Reporting[] +): Record => { + const years = yearsRange(archivedReportingsFromDate) + + return years.reduce( + (acc, year) => { + const yearReportings = reportings.filter(reporting => { + const reportingYear = new Date(reporting.validationDate || reporting.creationDate).getUTCFullYear() + + return reportingYear === year + }) + + acc[String(year)] = yearReportings + + return acc + }, + {} as Record + ) +} + +function yearsRange(fromDate: Date) { + const fromYear = fromDate.getUTCFullYear() + 1 + const toYear = new Date().getUTCFullYear() + + return range(fromYear, toYear + 1) +} diff --git a/frontend/src/features/VesselSidebar/actions/TrackRequest/DateRange.tsx b/frontend/src/features/VesselSidebar/actions/TrackRequest/DateRange.tsx index 9ced36de15..760255734f 100644 --- a/frontend/src/features/VesselSidebar/actions/TrackRequest/DateRange.tsx +++ b/frontend/src/features/VesselSidebar/actions/TrackRequest/DateRange.tsx @@ -42,7 +42,6 @@ export function DateRange({ placeholder, width }: DateRangeProps) { - /** @type {[Date, Date] | undefined} */ const normalizedDefaultValue = useMemo( () => defaultValue ? [getLocalizedDayjs(defaultValue[0]).toDate(), getLocalizedDayjs(defaultValue[1]).toDate()] : null, @@ -59,7 +58,7 @@ export function DateRange({ const handleChange = useCallback( ([localStartDate, localEndDate]) => { const utcizedStartDate = getUtcizedDayjs(localStartDate).startOf('day').toDate() - // TODO For some reason the API can't handle miliseconds in date. + // TODO For some reason the API can't handle milliseconds in date. const utcizedEndDate = getUtcizedDayjs(localEndDate).endOf('day').millisecond(0).toDate() onChange([utcizedStartDate, utcizedEndDate]) diff --git a/frontend/src/features/VesselSidebar/actions/TrackRequest/HighlightPositionCell.tsx b/frontend/src/features/VesselSidebar/actions/TrackRequest/HighlightPositionCell.tsx index fa00135952..7cb68a2cbe 100644 --- a/frontend/src/features/VesselSidebar/actions/TrackRequest/HighlightPositionCell.tsx +++ b/frontend/src/features/VesselSidebar/actions/TrackRequest/HighlightPositionCell.tsx @@ -33,7 +33,7 @@ export function HighlightPositionCell({ isManualPositionMarkerShowed, row, value style={{ cursor: 'pointer' }} title={row && coordinates ? `${coordinates[0]} ${coordinates[1]}` : ''} > - {value as string} + {(value ?? '') as string} {isManualPositionMarkerShowed && row.isManual ? : ''} ) diff --git a/frontend/src/features/VesselSidebar/actions/TrackRequest/constants.tsx b/frontend/src/features/VesselSidebar/actions/TrackRequest/constants.tsx index 4a063f6ae8..c6f8b54f2c 100644 --- a/frontend/src/features/VesselSidebar/actions/TrackRequest/constants.tsx +++ b/frontend/src/features/VesselSidebar/actions/TrackRequest/constants.tsx @@ -1,5 +1,6 @@ import { HighlightPositionCell } from '@features/VesselSidebar/actions/TrackRequest/HighlightPositionCell' import { getLocalizedDayjs } from '@mtes-mct/monitor-ui' +import { isNumeric } from '@utils/isNumeric' import { VesselTrackDepth } from '../../../../domain/entities/vesselTrackDepth' @@ -26,7 +27,7 @@ export const POSITION_TABLE_COLUMNS: Array `${row.speed} nds`, + accessorFn: row => (isNumeric(row.speed) ? `${row.speed} nds` : '-'), cell: info => , enableSorting: true, header: 'Vit.', @@ -34,7 +35,7 @@ export const POSITION_TABLE_COLUMNS: Array `${row.course} °`, + accessorFn: row => (isNumeric(row.course) ? `${row.course} °` : '-'), cell: info => , enableSorting: true, header: 'Cap', diff --git a/frontend/src/features/VesselSidebar/actions/TrackRequest/index.tsx b/frontend/src/features/VesselSidebar/actions/TrackRequest/index.tsx index 390a58b121..79b2836bc5 100644 --- a/frontend/src/features/VesselSidebar/actions/TrackRequest/index.tsx +++ b/frontend/src/features/VesselSidebar/actions/TrackRequest/index.tsx @@ -144,6 +144,10 @@ const Header = styled.div` const Field = styled.div` margin-bottom: 16px; + + .rs-picker-popup { + width: max-content; + } ` const TrackRequestBody = styled(MapComponent)<{ diff --git a/frontend/src/utils/__tests__/undefinedize.test.ts b/frontend/src/utils/__tests__/undefinedize.test.ts index f4937781a8..95e6473e4a 100644 --- a/frontend/src/utils/__tests__/undefinedize.test.ts +++ b/frontend/src/utils/__tests__/undefinedize.test.ts @@ -95,7 +95,7 @@ describe('utils/undefinedize()', () => { it('should return the expected result with a geometry object', () => { const value = { - closedBy: null, + completedBy: null, controlUnits: [ { administration: 'DIRM / DM', @@ -140,7 +140,7 @@ describe('utils/undefinedize()', () => { const result = undefinedize(value) expect(result).toStrictEqual({ - closedBy: undefined, + completedBy: undefined, controlUnits: [ { administration: 'DIRM / DM',