From 367c60653d69ff04f8a764a590d9fb983aa16435 Mon Sep 17 00:00:00 2001 From: alimpens Date: Tue, 20 Aug 2024 14:52:35 +0200 Subject: [PATCH 1/9] Update 'when' question for THOR, VTH and THOR Nautisch --- .../definitions/wizard-step-2-vulaan/afval.ts | 4 +-- .../wizard-step-2-vulaan/boom-illegale-kap.ts | 16 ++++++++-- .../bouw-sloop-overlast.ts | 16 ++++++++-- .../overlast-bedrijven-en-horeca.ts | 3 +- .../overlast-in-de-openbare-ruimte.ts | 12 ++++++-- .../overlast-op-het-water.ts | 29 +++++++++++++++++-- ...verlast-van-en-door-personen-of-groepen.ts | 5 ++-- .../wegen-verkeer-straatmeubilair.ts | 4 +-- 8 files changed, 74 insertions(+), 15 deletions(-) diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/afval.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/afval.ts index 5d89cc87d2..5c0110547c 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/afval.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/afval.ts @@ -15,12 +15,12 @@ export const controls = { ifOneOf: { subcategory: ['asbest-accu', 'handhaving-op-afval'], }, - label: 'Wanneer was het?', + label: 'Wanneer is of was de overlast?', ignoreVisibility: true, canBeNull: true, }, options: { - validators: [falsyOrNumberOrNow, inPast], + validators: [falsyOrNumberOrNow, inPast, 'required'], }, render: QuestionFieldType.DateTimeInput, }, diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/boom-illegale-kap.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/boom-illegale-kap.ts index a3015d1ae6..41455bda7c 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/boom-illegale-kap.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/boom-illegale-kap.ts @@ -1,9 +1,21 @@ -import dateTime from './dateTime' +// SPDX-License-Identifier: MPL-2.0 +// Copyright (C) 2018 - 2024 Gemeente Amsterdam +import { inPast } from 'signals/incident/services/custom-validators' +import { QuestionFieldType } from 'types/question' + import locatie from './locatie' const boomIllegaleKap = { locatie, - dateTime, + dateTime: { + meta: { + label: 'Wanneer is of was de overlast?', + }, + options: { + validators: [inPast, 'required'], + }, + render: QuestionFieldType.DateTimeInput, + }, } export default boomIllegaleKap diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/bouw-sloop-overlast.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/bouw-sloop-overlast.ts index cb91ed54ad..c5d9844aa1 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/bouw-sloop-overlast.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/bouw-sloop-overlast.ts @@ -1,9 +1,21 @@ -import dateTime from './dateTime' +// SPDX-License-Identifier: MPL-2.0 +// Copyright (C) 2018 - 2024 Gemeente Amsterdam +import { inPast } from 'signals/incident/services/custom-validators' +import { QuestionFieldType } from 'types/question' + import locatie from './locatie' const bouwSloopOverlast = { locatie, - dateTime, + dateTime: { + meta: { + label: 'Wanneer is of was de overlast?', + }, + options: { + validators: [inPast, 'required'], + }, + render: QuestionFieldType.DateTimeInput, + }, } export default bouwSloopOverlast diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-bedrijven-en-horeca.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-bedrijven-en-horeca.ts index 6e1dbc9f48..36ad4dee7b 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-bedrijven-en-horeca.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-bedrijven-en-horeca.ts @@ -15,12 +15,13 @@ const overlastBedrijvenEnHoreca = { 'geluidsoverlast-installaties', 'geluidsoverlast-muziek', 'overig-horecabedrijven', + 'overlast-door-bezoekers-niet-op-terras', 'overlast-evenementen', 'overlast-terrassen', 'stankoverlast', ], }, - label: 'Wanneer heeft u de overlast?', + label: 'Wanneer is of was de overlast?', canBeNull: true, }, options: { diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-in-de-openbare-ruimte.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-in-de-openbare-ruimte.ts index f132e9a895..9deeddf33f 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-in-de-openbare-ruimte.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-in-de-openbare-ruimte.ts @@ -1,13 +1,21 @@ // SPDX-License-Identifier: MPL-2.0 // Copyright (C) 2018 - 2023 Gemeente Amsterdam +import { inPast } from 'signals/incident/services/custom-validators' import { QuestionFieldType } from 'types/question' -import dateTime from './dateTime' import locatie from './locatie' export const overlastInDeOpenbareRuimte = { locatie, - dateTime, + dateTime: { + meta: { + label: 'Wanneer is of was de overlast?', + }, + options: { + validators: [inPast, 'required'], + }, + render: QuestionFieldType.DateTimeInput, + }, extra_auto_scooter_bromfietswrak: { meta: { ifAllOf: { diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts index 2f57f578db..7226c2afb6 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts @@ -12,9 +12,35 @@ export const overlastOpHetWater = { locatie, dateTime: { meta: { - ignoreVisibility: true, label: 'Wanneer heeft u de overlast?', canBeNull: true, + ifOneOf: { + subcategory: [ + 'olie-op-het-water', + 'overig-boten', + 'overlast-op-het-water-vaargedrag', + 'overlast-vanaf-het-water', + 'scheepvaart-nautisch-toezicht', + ], + }, + }, + options: { + validators: [falsyOrNumberOrNow, inPast, 'required'], + }, + render: QuestionFieldType.DateTimeInput, + }, + + dateTime_Thor: { + meta: { + label: 'Wanneer is of was de overlast?', + canBeNull: true, + ifOneOf: { + subcategory: [ + 'blokkade-van-de-vaarweg', + 'overlast-op-het-water-geluid', + 'overlast-op-het-water-snel-varen', + ], + }, }, options: { validators: [falsyOrNumberOrNow, inPast, 'required'], @@ -29,7 +55,6 @@ export const overlastOpHetWater = { 'blokkade-van-de-vaarweg', 'overig-boten', 'overlast-op-het-water-geluid', - 'overlast-op-het-water-gezonken-boot', 'overlast-op-het-water-snel-varen', 'overlast-op-het-water-vaargedrag', ], diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts index 114052804f..42e1e8cbc6 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts @@ -16,6 +16,7 @@ export const overlastPersonenEnGroepen = { subcategory: [ 'daklozen-bedelen', 'drank-en-drugsoverlast', + 'geluidsoverlast-door-personen', 'jongerenoverlast', 'overige-overlast-door-personen', 'overlast-door-afsteken-vuurwerk', @@ -23,12 +24,12 @@ export const overlastPersonenEnGroepen = { 'wildplassen-poepen-overgeven', ], }, - label: 'Wanneer was het?', + label: 'Wanneer is of was de overlast?', ignoreVisibility: true, canBeNull: true, }, options: { - validators: [falsyOrNumberOrNow, inPast], + validators: [falsyOrNumberOrNow, inPast, 'required'], }, render: QuestionFieldType.DateTimeInput, }, diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/wegen-verkeer-straatmeubilair.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/wegen-verkeer-straatmeubilair.ts index c2287e1775..7c330954f4 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/wegen-verkeer-straatmeubilair.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/wegen-verkeer-straatmeubilair.ts @@ -21,12 +21,12 @@ export const wegenVerkeerStraatmeubilair = { ifOneOf: { subcategory: ['verkeersoverlast'], }, - label: 'Wanneer was het?', + label: 'Wanneer is of was de overlast?', ignoreVisibility: true, canBeNull: true, }, options: { - validators: [falsyOrNumberOrNow, inPast], + validators: [falsyOrNumberOrNow, inPast, 'required'], }, render: QuestionFieldType.DateTimeInput, }, From dc56640d18a86843580c824108071b219b87e38b Mon Sep 17 00:00:00 2001 From: alimpens Date: Tue, 20 Aug 2024 17:37:17 +0200 Subject: [PATCH 2/9] Update additional questions, fix tests --- .../__tests__/wizard-step-4-summary.test.js | 19 ------ .../definitions/wizard-step-2-vulaan.js | 25 ++++++-- .../wizard-step-2-vulaan/afval-thor.test.ts | 15 +++++ .../wizard-step-2-vulaan/afval-thor.ts | 61 +++++++++++++++++++ .../wizard-step-2-vulaan/afval.test.ts | 9 +-- .../definitions/wizard-step-2-vulaan/afval.ts | 51 +--------------- .../wizard-step-2-vulaan/dateTime.ts | 19 ------ .../overlast-op-het-water.test.ts | 1 + .../overlast-op-het-water.ts | 1 - ...st-van-en-door-personen-of-groepen.test.ts | 1 + ...verlast-van-en-door-personen-of-groepen.ts | 14 ++++- .../verkeersoverlast.test.ts | 9 +++ .../wizard-step-2-vulaan/verkeersoverlast.ts | 25 ++++++++ .../wegen-verkeer-straatmeubilair.ts | 8 +-- 14 files changed, 150 insertions(+), 108 deletions(-) create mode 100644 src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.test.ts create mode 100644 src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.ts delete mode 100644 src/signals/incident/definitions/wizard-step-2-vulaan/dateTime.ts create mode 100644 src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.test.ts create mode 100644 src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.ts diff --git a/src/signals/incident/definitions/__tests__/wizard-step-4-summary.test.js b/src/signals/incident/definitions/__tests__/wizard-step-4-summary.test.js index 397d472cc2..02a2f3f70f 100644 --- a/src/signals/incident/definitions/__tests__/wizard-step-4-summary.test.js +++ b/src/signals/incident/definitions/__tests__/wizard-step-4-summary.test.js @@ -149,25 +149,6 @@ describe('Wizard summary', () => { optional: true, render: PreviewComponents.DateTime, }, - extra_afval_handhaving: { - label: 'Welk afval is verkeerd neergezet?', - optional: true, - render: Label, - canBeNull: false, - }, - extra_afval_handhaving_owner: { - label: - 'Weet u wie de eigenaar is van het verkeerd geplaatste afval? Bijvoorbeeld omdat u dat ziet aan een adressticker of iets anders?', - optional: true, - render: ObjectLabel, - canBeNull: false, - }, - extra_afval_handhaving_owner_confirmation: { - canBeNull: false, - label: undefined, - optional: true, - render: Null, - }, extra_afval: { label: 'Waar komt het afval vandaan, denkt u?', optional: true, diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan.js b/src/signals/incident/definitions/wizard-step-2-vulaan.js index 8ec63c684e..9bd55e6cbc 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan.js +++ b/src/signals/incident/definitions/wizard-step-2-vulaan.js @@ -6,6 +6,7 @@ import configuration from 'shared/services/configuration/configuration' import afval from './wizard-step-2-vulaan/afval' import afvalContainer from './wizard-step-2-vulaan/afval-container' +import afvalThor from './wizard-step-2-vulaan/afval-thor' import boomIllegaleKap from './wizard-step-2-vulaan/boom-illegale-kap' import bouwSloopOverlast from './wizard-step-2-vulaan/bouw-sloop-overlast' import civieleConstructies from './wizard-step-2-vulaan/civieleConstructies' @@ -18,6 +19,7 @@ import overlastOpHetWater from './wizard-step-2-vulaan/overlast-op-het-water' import overlastVanDieren from './wizard-step-2-vulaan/overlast-van-dieren' import overlastPersonenEnGroepen from './wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen' import straatverlichtingKlokken from './wizard-step-2-vulaan/straatverlichting-klokken' +import verkeersoverlast from './wizard-step-2-vulaan/verkeersoverlast' import wegenVerkeerStraatmeubilair from './wizard-step-2-vulaan/wegen-verkeer-straatmeubilair' import wonen from './wizard-step-2-vulaan/wonen' import FormComponents from '../components/form' @@ -107,6 +109,9 @@ export default { if (subcategory.startsWith('container')) { return expandQuestions(afvalContainer, category, subcategory) } + if (['asbest-accu', 'handhaving-op-afval'].includes(subcategory)) { + return expandQuestions(afvalThor, category, subcategory) + } return expandQuestions(afval, category, subcategory) } @@ -150,13 +155,23 @@ export default { return expandQuestions(overlastPersonenEnGroepen, category, subcategory) case 'wegen-verkeer-straatmeubilair': { - const config = ['klok', 'lantaarnpaal-straatverlichting'].includes( + if (['klok', 'lantaarnpaal-straatverlichting'].includes(subcategory)) { + return expandQuestions( + straatverlichtingKlokken, + category, + subcategory + ) + } + + if (subcategory === 'verkeersoverlast') { + return expandQuestions(verkeersoverlast, category, subcategory) + } + + return expandQuestions( + wegenVerkeerStraatmeubilair, + category, subcategory ) - ? straatverlichtingKlokken - : wegenVerkeerStraatmeubilair - - return expandQuestions(config, category, subcategory) } case 'wonen': diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.test.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.test.ts new file mode 100644 index 0000000000..2312216ecf --- /dev/null +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.test.ts @@ -0,0 +1,15 @@ +import afvalThor from './afval-thor' + +describe('definition afvalThor', () => { + it('has a defined set of controls', () => { + const keys = Object.keys(afvalThor) + + expect(keys).toStrictEqual([ + 'locatie', + 'dateTime', + 'extra_afval_handhaving', + 'extra_afval_handhaving_owner', + 'extra_afval_handhaving_owner_confirmation', + ]) + }) +}) diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.ts new file mode 100644 index 0000000000..7b2e0ff9d2 --- /dev/null +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.ts @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright (C) 2018 - 2023 Gemeente Amsterdam +import { + falsyOrNumberOrNow, + inPast, +} from 'signals/incident/services/custom-validators' +import { QuestionFieldType } from 'types/question' + +import locatie from './locatie' + +export const controls = { + locatie, + dateTime: { + meta: { + label: 'Wanneer is of was de overlast?', + canBeNull: true, + }, + options: { + validators: [falsyOrNumberOrNow, inPast, 'required'], + }, + render: QuestionFieldType.DateTimeInput, + }, + extra_afval_handhaving: { + meta: { + label: 'Welk afval is verkeerd neergezet?', + subtitle: + 'U helpt ons door zoveel mogelijk informatie te geven over het soort afval: huisafval, bedrijfsafval, grofvuil of dozen en papier.', + shortLabel: 'Welk afval', + pathMerge: 'extra_properties', + }, + render: QuestionFieldType.TextareaInput, + }, + extra_afval_handhaving_owner: { + meta: { + label: + 'Weet u wie de eigenaar is van het verkeerd geplaatste afval? Bijvoorbeeld omdat u dat ziet aan een adressticker of iets anders?', + shortLabel: 'Welke eigenaar', + pathMerge: 'extra_properties', + values: { + ja: 'Ja', + nee: 'Nee', + }, + }, + options: { + validators: ['required'], + }, + render: QuestionFieldType.RadioInput, + }, + extra_afval_handhaving_owner_confirmation: { + meta: { + ifOneOf: { + extra_afval_handhaving_owner: 'ja', + }, + value: + 'Wij willen graag telefonisch contact met u hierover. Als u dat goed vindt, vul dan uw telefoonnummer in op de volgende pagina.', + type: 'info', + }, + render: QuestionFieldType.PlainText, + }, +} +export default controls diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/afval.test.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/afval.test.ts index 1e99eb6f7d..5b1990e5b4 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/afval.test.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/afval.test.ts @@ -4,13 +4,6 @@ describe('definition afval', () => { it('has a defined set of controls', () => { const keys = Object.keys(afval) - expect(keys).toStrictEqual([ - 'locatie', - 'dateTime', - 'extra_afval_handhaving', - 'extra_afval_handhaving_owner', - 'extra_afval_handhaving_owner_confirmation', - 'extra_afval', - ]) + expect(keys).toStrictEqual(['locatie', 'dateTime', 'extra_afval']) }) }) diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/afval.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/afval.ts index 5c0110547c..b10d241883 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/afval.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/afval.ts @@ -12,61 +12,14 @@ export const controls = { locatie, dateTime: { meta: { - ifOneOf: { - subcategory: ['asbest-accu', 'handhaving-op-afval'], - }, - label: 'Wanneer is of was de overlast?', - ignoreVisibility: true, + label: 'Wanneer was het?', canBeNull: true, }, options: { - validators: [falsyOrNumberOrNow, inPast, 'required'], + validators: [falsyOrNumberOrNow, inPast], }, render: QuestionFieldType.DateTimeInput, }, - extra_afval_handhaving: { - meta: { - ifOneOf: { - subcategory: ['asbest-accu', 'handhaving-op-afval'], - }, - label: 'Welk afval is verkeerd neergezet?', - subtitle: - 'U helpt ons door zoveel mogelijk informatie te geven over het soort afval: huisafval, bedrijfsafval, grofvuil of dozen en papier.', - shortLabel: 'Welk afval', - pathMerge: 'extra_properties', - }, - render: QuestionFieldType.TextareaInput, - }, - extra_afval_handhaving_owner: { - meta: { - ifOneOf: { - subcategory: ['asbest-accu', 'handhaving-op-afval'], - }, - label: - 'Weet u wie de eigenaar is van het verkeerd geplaatste afval? Bijvoorbeeld omdat u dat ziet aan een adressticker of iets anders?', - shortLabel: 'Welke eigenaar', - pathMerge: 'extra_properties', - values: { - ja: 'Ja', - nee: 'Nee', - }, - }, - options: { - validators: ['required'], - }, - render: QuestionFieldType.RadioInput, - }, - extra_afval_handhaving_owner_confirmation: { - meta: { - ifOneOf: { - extra_afval_handhaving_owner: 'ja', - }, - value: - 'Wij willen graag telefonisch contact met u hierover. Als u dat goed vindt, vul dan uw telefoonnummer in op de volgende pagina.', - type: 'info', - }, - render: QuestionFieldType.PlainText, - }, extra_afval: { meta: { ifOneOf: { diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/dateTime.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/dateTime.ts deleted file mode 100644 index 3f8116812d..0000000000 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/dateTime.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { - falsyOrNumberOrNow, - inPast, -} from 'signals/incident/services/custom-validators' -import { QuestionFieldType } from 'types/question' - -const dateTime = { - meta: { - ignoreVisibility: true, - label: 'Wanneer was het?', - canBeNull: true, - }, - options: { - validators: [falsyOrNumberOrNow, inPast], - }, - render: QuestionFieldType.DateTimeInput, -} - -export default dateTime diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.test.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.test.ts index ec63e4006a..6d0c867505 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.test.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.test.ts @@ -7,6 +7,7 @@ describe('definition overlast-op-het-water', () => { expect(keys).toStrictEqual([ 'locatie', 'dateTime', + 'dateTime_Thor', 'extra_boten_frequentie', 'extra_boten_moment', 'extra_boten_beweging', diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts index 7226c2afb6..fc09282fb8 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts @@ -29,7 +29,6 @@ export const overlastOpHetWater = { }, render: QuestionFieldType.DateTimeInput, }, - dateTime_Thor: { meta: { label: 'Wanneer is of was de overlast?', diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.test.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.test.ts index a2ccc051a1..e088c5d269 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.test.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.test.ts @@ -7,6 +7,7 @@ describe('definition overlast-van-en-door-personen-of-groepen', () => { expect(keys).toStrictEqual([ 'locatie', 'dateTime', + 'dateTime_Thor', 'extra_drugs_verkoop', 'extra_drugs_verkoop_ja', 'extra_jongeren_text', diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts index 42e1e8cbc6..25b5d0a58e 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts @@ -11,6 +11,19 @@ import locatie from './locatie' export const overlastPersonenEnGroepen = { locatie, dateTime: { + meta: { + ifOneOf: { + subcategory: ['loslopende-agressieve-honden'], + }, + label: 'Wanneer was het?', + canBeNull: true, + }, + options: { + validators: [falsyOrNumberOrNow, inPast], + }, + render: QuestionFieldType.DateTimeInput, + }, + dateTime_Thor: { meta: { ifOneOf: { subcategory: [ @@ -25,7 +38,6 @@ export const overlastPersonenEnGroepen = { ], }, label: 'Wanneer is of was de overlast?', - ignoreVisibility: true, canBeNull: true, }, options: { diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.test.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.test.ts new file mode 100644 index 0000000000..aac50fdf5b --- /dev/null +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.test.ts @@ -0,0 +1,9 @@ +import verkeersoverlast from './verkeersoverlast' + +describe('definition verkeersoverlast', () => { + it('has a defined set of controls', () => { + const keys = Object.keys(verkeersoverlast) + + expect(keys).toStrictEqual(['locatie', 'dateTime']) + }) +}) diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.ts new file mode 100644 index 0000000000..9c7e5537ae --- /dev/null +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.ts @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright (C) 2018 - 2023 Gemeente Amsterdam +import { + falsyOrNumberOrNow, + inPast, +} from 'signals/incident/services/custom-validators' +import { QuestionFieldType } from 'types/question' + +import locatie from './locatie' + +export const verkeersoverlast = { + locatie, + dateTime: { + meta: { + label: 'Wanneer is of was de overlast?', + canBeNull: true, + }, + options: { + validators: [falsyOrNumberOrNow, inPast, 'required'], + }, + render: QuestionFieldType.DateTimeInput, + }, +} + +export default verkeersoverlast diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/wegen-verkeer-straatmeubilair.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/wegen-verkeer-straatmeubilair.ts index 7c330954f4..542dcbc164 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/wegen-verkeer-straatmeubilair.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/wegen-verkeer-straatmeubilair.ts @@ -18,15 +18,11 @@ export const wegenVerkeerStraatmeubilair = { locatie, dateTime: { meta: { - ifOneOf: { - subcategory: ['verkeersoverlast'], - }, - label: 'Wanneer is of was de overlast?', - ignoreVisibility: true, + label: 'Wanneer was het?', canBeNull: true, }, options: { - validators: [falsyOrNumberOrNow, inPast, 'required'], + validators: [falsyOrNumberOrNow, inPast], }, render: QuestionFieldType.DateTimeInput, }, From 18233499be2312794acb54346b3534aac4172e11 Mon Sep 17 00:00:00 2001 From: alimpens Date: Thu, 22 Aug 2024 13:57:44 +0200 Subject: [PATCH 3/9] Move 2 subcategories to THOR datetime question --- .../definitions/wizard-step-2-vulaan/overlast-op-het-water.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts index fc09282fb8..f58e6ec110 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts @@ -17,10 +17,8 @@ export const overlastOpHetWater = { ifOneOf: { subcategory: [ 'olie-op-het-water', - 'overig-boten', 'overlast-op-het-water-vaargedrag', 'overlast-vanaf-het-water', - 'scheepvaart-nautisch-toezicht', ], }, }, @@ -36,8 +34,10 @@ export const overlastOpHetWater = { ifOneOf: { subcategory: [ 'blokkade-van-de-vaarweg', + 'overig-boten', 'overlast-op-het-water-geluid', 'overlast-op-het-water-snel-varen', + 'scheepvaart-nautisch-toezicht', ], }, }, From 5aeb9ff5f82a862819f21665fedebe56a62c5f01 Mon Sep 17 00:00:00 2001 From: alimpens Date: Thu, 22 Aug 2024 14:25:44 +0200 Subject: [PATCH 4/9] Change question for all Overlast van en door personen of groepen subcategories --- ...verlast-van-en-door-personen-of-groepen.test.ts | 1 - .../overlast-van-en-door-personen-of-groepen.ts | 14 +------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.test.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.test.ts index e088c5d269..a2ccc051a1 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.test.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.test.ts @@ -7,7 +7,6 @@ describe('definition overlast-van-en-door-personen-of-groepen', () => { expect(keys).toStrictEqual([ 'locatie', 'dateTime', - 'dateTime_Thor', 'extra_drugs_verkoop', 'extra_drugs_verkoop_ja', 'extra_jongeren_text', diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts index 25b5d0a58e..5de3e7543f 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts @@ -11,19 +11,6 @@ import locatie from './locatie' export const overlastPersonenEnGroepen = { locatie, dateTime: { - meta: { - ifOneOf: { - subcategory: ['loslopende-agressieve-honden'], - }, - label: 'Wanneer was het?', - canBeNull: true, - }, - options: { - validators: [falsyOrNumberOrNow, inPast], - }, - render: QuestionFieldType.DateTimeInput, - }, - dateTime_Thor: { meta: { ifOneOf: { subcategory: [ @@ -31,6 +18,7 @@ export const overlastPersonenEnGroepen = { 'drank-en-drugsoverlast', 'geluidsoverlast-door-personen', 'jongerenoverlast', + 'loslopende-agressieve-honden', 'overige-overlast-door-personen', 'overlast-door-afsteken-vuurwerk', 'overlast-van-taxis-bussen-en-fietstaxis', From aa5be45520d0d31740fcaf4366a18a1b4fc937e7 Mon Sep 17 00:00:00 2001 From: alimpens Date: Thu, 22 Aug 2024 14:34:14 +0200 Subject: [PATCH 5/9] Update copyright notice --- .../definitions/__tests__/wizard-step-4-summary.test.js | 2 +- src/signals/incident/definitions/wizard-step-2-vulaan.js | 2 +- .../definitions/wizard-step-2-vulaan/afval-thor.test.ts | 2 ++ .../incident/definitions/wizard-step-2-vulaan/afval-thor.ts | 2 +- .../incident/definitions/wizard-step-2-vulaan/afval.test.ts | 2 ++ src/signals/incident/definitions/wizard-step-2-vulaan/afval.ts | 2 +- .../wizard-step-2-vulaan/overlast-in-de-openbare-ruimte.ts | 2 +- .../wizard-step-2-vulaan/overlast-op-het-water.test.ts | 2 ++ .../definitions/wizard-step-2-vulaan/overlast-op-het-water.ts | 2 +- .../overlast-van-en-door-personen-of-groepen.ts | 2 +- .../definitions/wizard-step-2-vulaan/verkeersoverlast.test.ts | 2 ++ .../definitions/wizard-step-2-vulaan/verkeersoverlast.ts | 2 +- .../wizard-step-2-vulaan/wegen-verkeer-straatmeubilair.ts | 2 +- 13 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/signals/incident/definitions/__tests__/wizard-step-4-summary.test.js b/src/signals/incident/definitions/__tests__/wizard-step-4-summary.test.js index 02a2f3f70f..efaf05f254 100644 --- a/src/signals/incident/definitions/__tests__/wizard-step-4-summary.test.js +++ b/src/signals/incident/definitions/__tests__/wizard-step-4-summary.test.js @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MPL-2.0 -// Copyright (C) 2020 - 2023 Gemeente Amsterdam +// Copyright (C) 2020 - 2024 Gemeente Amsterdam import configuration from 'shared/services/configuration/configuration' import PreviewComponents from '../../components/IncidentPreview/components' diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan.js b/src/signals/incident/definitions/wizard-step-2-vulaan.js index 9bd55e6cbc..4dd8ce210c 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan.js +++ b/src/signals/incident/definitions/wizard-step-2-vulaan.js @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MPL-2.0 -// Copyright (C) 2018 - 2023 Gemeente Amsterdam +// Copyright (C) 2018 - 2024 Gemeente Amsterdam import memoize from 'lodash/memoize' import configuration from 'shared/services/configuration/configuration' diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.test.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.test.ts index 2312216ecf..d15ec6d71b 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.test.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.test.ts @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright (C) 2024 Gemeente Amsterdam import afvalThor from './afval-thor' describe('definition afvalThor', () => { diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.ts index 7b2e0ff9d2..7e148f62b7 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.ts @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MPL-2.0 -// Copyright (C) 2018 - 2023 Gemeente Amsterdam +// Copyright (C) 2024 Gemeente Amsterdam import { falsyOrNumberOrNow, inPast, diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/afval.test.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/afval.test.ts index 5b1990e5b4..ca1d73535f 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/afval.test.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/afval.test.ts @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright (C) 2018 - 2024 Gemeente Amsterdam import afval from './afval' describe('definition afval', () => { diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/afval.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/afval.ts index b10d241883..cb6dadae1e 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/afval.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/afval.ts @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MPL-2.0 -// Copyright (C) 2018 - 2023 Gemeente Amsterdam +// Copyright (C) 2018 - 2024 Gemeente Amsterdam import { falsyOrNumberOrNow, inPast, diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-in-de-openbare-ruimte.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-in-de-openbare-ruimte.ts index 9deeddf33f..c0171964c9 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-in-de-openbare-ruimte.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-in-de-openbare-ruimte.ts @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MPL-2.0 -// Copyright (C) 2018 - 2023 Gemeente Amsterdam +// Copyright (C) 2018 - 2024 Gemeente Amsterdam import { inPast } from 'signals/incident/services/custom-validators' import { QuestionFieldType } from 'types/question' diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.test.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.test.ts index 6d0c867505..2f9d180a20 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.test.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.test.ts @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright (C) 2018 - 2024 Gemeente Amsterdam import overlastOpHetWater from './overlast-op-het-water' describe('definition overlast-op-het-water', () => { diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts index f58e6ec110..e049aadaf6 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MPL-2.0 -// Copyright (C) 2021 - 2023 Gemeente Amsterdam +// Copyright (C) 2021 - 2024 Gemeente Amsterdam import { falsyOrNumberOrNow, inPast, diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts index 5de3e7543f..2b6cece36f 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MPL-2.0 -// Copyright (C) 2018 - 2023 Gemeente Amsterdam +// Copyright (C) 2018 - 2024 Gemeente Amsterdam import { falsyOrNumberOrNow, inPast, diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.test.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.test.ts index aac50fdf5b..b5032a45d4 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.test.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.test.ts @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright (C) 2018 - 2024 Gemeente Amsterdam import verkeersoverlast from './verkeersoverlast' describe('definition verkeersoverlast', () => { diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.ts index 9c7e5537ae..c3c4cc4dc3 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.ts @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MPL-2.0 -// Copyright (C) 2018 - 2023 Gemeente Amsterdam +// Copyright (C) 2018 - 2024 Gemeente Amsterdam import { falsyOrNumberOrNow, inPast, diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/wegen-verkeer-straatmeubilair.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/wegen-verkeer-straatmeubilair.ts index 542dcbc164..2ad432f463 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/wegen-verkeer-straatmeubilair.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/wegen-verkeer-straatmeubilair.ts @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MPL-2.0 -// Copyright (C) 2018 - 2023 Gemeente Amsterdam +// Copyright (C) 2018 - 2024 Gemeente Amsterdam import appConfiguration from 'shared/services/configuration/configuration' import { falsyOrNumberOrNow, From 8419df12545d3ca11b4892a1cb5042a0698f0a42 Mon Sep 17 00:00:00 2001 From: alimpens Date: Thu, 22 Aug 2024 14:46:41 +0200 Subject: [PATCH 6/9] Simplify validation --- .../definitions/wizard-step-2-vulaan/afval-thor.ts | 7 ++----- .../wizard-step-2-vulaan/overlast-op-het-water.ts | 9 +++------ .../overlast-van-en-door-personen-of-groepen.ts | 7 ++----- .../definitions/wizard-step-2-vulaan/verkeersoverlast.ts | 7 ++----- 4 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.ts index 7e148f62b7..89206605fa 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.ts @@ -1,9 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 // Copyright (C) 2024 Gemeente Amsterdam -import { - falsyOrNumberOrNow, - inPast, -} from 'signals/incident/services/custom-validators' +import { inPast } from 'signals/incident/services/custom-validators' import { QuestionFieldType } from 'types/question' import locatie from './locatie' @@ -16,7 +13,7 @@ export const controls = { canBeNull: true, }, options: { - validators: [falsyOrNumberOrNow, inPast, 'required'], + validators: [inPast, 'required'], }, render: QuestionFieldType.DateTimeInput, }, diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts index e049aadaf6..e449ab5219 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts @@ -1,9 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 // Copyright (C) 2021 - 2024 Gemeente Amsterdam -import { - falsyOrNumberOrNow, - inPast, -} from 'signals/incident/services/custom-validators' +import { inPast } from 'signals/incident/services/custom-validators' import { QuestionFieldType } from 'types/question' import locatie from './locatie' @@ -23,7 +20,7 @@ export const overlastOpHetWater = { }, }, options: { - validators: [falsyOrNumberOrNow, inPast, 'required'], + validators: [inPast, 'required'], }, render: QuestionFieldType.DateTimeInput, }, @@ -42,7 +39,7 @@ export const overlastOpHetWater = { }, }, options: { - validators: [falsyOrNumberOrNow, inPast, 'required'], + validators: [inPast, 'required'], }, render: QuestionFieldType.DateTimeInput, }, diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts index 2b6cece36f..b2becaab67 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts @@ -1,9 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 // Copyright (C) 2018 - 2024 Gemeente Amsterdam -import { - falsyOrNumberOrNow, - inPast, -} from 'signals/incident/services/custom-validators' +import { inPast } from 'signals/incident/services/custom-validators' import { QuestionFieldType } from 'types/question' import locatie from './locatie' @@ -29,7 +26,7 @@ export const overlastPersonenEnGroepen = { canBeNull: true, }, options: { - validators: [falsyOrNumberOrNow, inPast, 'required'], + validators: [inPast, 'required'], }, render: QuestionFieldType.DateTimeInput, }, diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.ts index c3c4cc4dc3..a029005278 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.ts @@ -1,9 +1,6 @@ // SPDX-License-Identifier: MPL-2.0 // Copyright (C) 2018 - 2024 Gemeente Amsterdam -import { - falsyOrNumberOrNow, - inPast, -} from 'signals/incident/services/custom-validators' +import { inPast } from 'signals/incident/services/custom-validators' import { QuestionFieldType } from 'types/question' import locatie from './locatie' @@ -16,7 +13,7 @@ export const verkeersoverlast = { canBeNull: true, }, options: { - validators: [falsyOrNumberOrNow, inPast, 'required'], + validators: [inPast, 'required'], }, render: QuestionFieldType.DateTimeInput, }, From 37aa8e024198c4e244db881770f889ef1aec0427 Mon Sep 17 00:00:00 2001 From: alimpens Date: Thu, 22 Aug 2024 15:17:05 +0200 Subject: [PATCH 7/9] Remove unnecessary check --- .../incident/definitions/wizard-step-2-vulaan/afval-thor.ts | 1 - .../wizard-step-2-vulaan/overlast-bedrijven-en-horeca.ts | 3 --- .../definitions/wizard-step-2-vulaan/overlast-op-het-water.ts | 2 -- .../overlast-van-en-door-personen-of-groepen.ts | 1 - .../definitions/wizard-step-2-vulaan/verkeersoverlast.ts | 1 - 5 files changed, 8 deletions(-) diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.ts index 89206605fa..e3db404382 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/afval-thor.ts @@ -10,7 +10,6 @@ export const controls = { dateTime: { meta: { label: 'Wanneer is of was de overlast?', - canBeNull: true, }, options: { validators: [inPast, 'required'], diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-bedrijven-en-horeca.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-bedrijven-en-horeca.ts index 36ad4dee7b..11f1506d23 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-bedrijven-en-horeca.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-bedrijven-en-horeca.ts @@ -7,7 +7,6 @@ import locatie from './locatie' const overlastBedrijvenEnHoreca = { locatie, - dateTime: { meta: { ifOneOf: { @@ -22,14 +21,12 @@ const overlastBedrijvenEnHoreca = { ], }, label: 'Wanneer is of was de overlast?', - canBeNull: true, }, options: { validators: [inPast, 'required'], }, render: QuestionFieldType.DateTimeInput, }, - extra_bedrijven_horeca_frequentie: { meta: { ifOneOf: { diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts index e449ab5219..712617f1e0 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts @@ -10,7 +10,6 @@ export const overlastOpHetWater = { dateTime: { meta: { label: 'Wanneer heeft u de overlast?', - canBeNull: true, ifOneOf: { subcategory: [ 'olie-op-het-water', @@ -27,7 +26,6 @@ export const overlastOpHetWater = { dateTime_Thor: { meta: { label: 'Wanneer is of was de overlast?', - canBeNull: true, ifOneOf: { subcategory: [ 'blokkade-van-de-vaarweg', diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts index b2becaab67..4dae6ec4ca 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen.ts @@ -23,7 +23,6 @@ export const overlastPersonenEnGroepen = { ], }, label: 'Wanneer is of was de overlast?', - canBeNull: true, }, options: { validators: [inPast, 'required'], diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.ts index a029005278..a1c9757d4a 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/verkeersoverlast.ts @@ -10,7 +10,6 @@ export const verkeersoverlast = { dateTime: { meta: { label: 'Wanneer is of was de overlast?', - canBeNull: true, }, options: { validators: [inPast, 'required'], From 15054525c8d460b8501fb135bf7612d9297893f0 Mon Sep 17 00:00:00 2001 From: alimpens Date: Mon, 26 Aug 2024 11:19:42 +0200 Subject: [PATCH 8/9] Separate Overlast op het water THOR questions --- .../definitions/wizard-step-2-vulaan.js | 13 ++ .../overlast-op-het-water-thor.test.ts | 20 +++ .../overlast-op-het-water-thor.ts | 114 +++++++++++++ .../overlast-op-het-water.test.ts | 7 - .../overlast-op-het-water.ts | 154 ------------------ 5 files changed, 147 insertions(+), 161 deletions(-) create mode 100644 src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water-thor.test.ts create mode 100644 src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water-thor.ts diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan.js b/src/signals/incident/definitions/wizard-step-2-vulaan.js index 4dd8ce210c..135d19bd2e 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan.js +++ b/src/signals/incident/definitions/wizard-step-2-vulaan.js @@ -16,6 +16,7 @@ import locatie from './wizard-step-2-vulaan/locatie' import overlastBedrijvenEnHoreca from './wizard-step-2-vulaan/overlast-bedrijven-en-horeca' import overlastInDeOpenbareRuimte from './wizard-step-2-vulaan/overlast-in-de-openbare-ruimte' import overlastOpHetWater from './wizard-step-2-vulaan/overlast-op-het-water' +import overlastOpHetWaterThor from './wizard-step-2-vulaan/overlast-op-het-water-thor' import overlastVanDieren from './wizard-step-2-vulaan/overlast-van-dieren' import overlastPersonenEnGroepen from './wizard-step-2-vulaan/overlast-van-en-door-personen-of-groepen' import straatverlichtingKlokken from './wizard-step-2-vulaan/straatverlichting-klokken' @@ -146,6 +147,18 @@ export default { } case 'overlast-op-het-water': + if ( + [ + 'blokkade-van-de-vaarweg', + 'overig-boten', + 'overlast-op-het-water-geluid', + 'overlast-op-het-water-snel-varen', + 'scheepvaart-nautisch-toezicht', + ].includes(subcategory) + ) { + return expandQuestions(overlastOpHetWaterThor, category, subcategory) + } + return expandQuestions(overlastOpHetWater, category, subcategory) case 'overlast-van-dieren': diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water-thor.test.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water-thor.test.ts new file mode 100644 index 0000000000..e8e66d6279 --- /dev/null +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water-thor.test.ts @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright (C) 2018 - 2024 Gemeente Amsterdam +import overlastOpHetWater from './overlast-op-het-water' + +describe('definition overlast-op-het-water', () => { + it('has a defined set of controls', () => { + const keys = Object.keys(overlastOpHetWater) + + expect(keys).toStrictEqual([ + 'locatie', + 'dateTime', + 'extra_boten_frequentie', + 'extra_boten_moment', + 'extra_boten_beweging', + 'extra_boten_soort', + 'extra_boten_open_gesloten', + 'extra_boten_meer', + ]) + }) +}) diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water-thor.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water-thor.ts new file mode 100644 index 0000000000..a6d1e8f15b --- /dev/null +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water-thor.ts @@ -0,0 +1,114 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright (C) 2021 - 2024 Gemeente Amsterdam +import { inPast } from 'signals/incident/services/custom-validators' +import { QuestionFieldType } from 'types/question' + +import locatie from './locatie' + +export const overlastOpHetWaterThor = { + locatie, + dateTime: { + meta: { + label: 'Wanneer is of was de overlast?', + }, + options: { + validators: [inPast, 'required'], + }, + render: QuestionFieldType.DateTimeInput, + }, + extra_boten_frequentie: { + meta: { + values: { + ja: 'Ja, het gebeurt vaker', + nee: 'Nee, het is de eerste keer', + }, + label: 'Heeft u deze overlast al eerder gehad?', + shortLabel: 'Eerder overlast', + pathMerge: 'extra_properties', + }, + render: QuestionFieldType.RadioInput, + }, + extra_boten_moment: { + meta: { + ifAllOf: { + extra_boten_frequentie: 'ja', + }, + label: 'Op welke momenten van de dag hebt u de overlast?', + shortLabel: 'Overlast momenten', + pathMerge: 'extra_properties', + }, + options: { validators: ['required'] }, + render: QuestionFieldType.TextInput, + }, + extra_boten_beweging: { + meta: { + values: { + ja: 'Ja, de boot ligt stil', + nee: 'Nee, de boot vaart', + }, + label: 'Ligt de boot stil?', + shortLabel: 'Beweging boot', + pathMerge: 'extra_properties', + }, + render: QuestionFieldType.RadioInput, + }, + extra_boten_soort: { + meta: { + ifOneOf: { + subcategory: [ + 'overig-boten', + 'overlast-op-het-water-geluid', + 'overlast-op-het-water-snel-varen', + 'overlast-op-het-water-vaargedrag', + ], + }, + values: { + plezier: '(Plezier)boot in privé-eigendom', + rondvaart: 'Rondvaartboot of salonboot van rederij', + vracht: 'Vrachtschip of binnenvaartschip', + huur: 'Huurboot', + overig: 'Overig', + weetniet: 'Weet ik niet', + }, + label: 'Wat voor soort boot is het?', + shortLabel: 'Soort boot', + pathMerge: 'extra_properties', + }, + options: { validators: ['required'] }, + render: QuestionFieldType.RadioInput, + }, + extra_boten_open_gesloten: { + meta: { + ifOneOf: { + subcategory: [ + 'overig-boten', + 'overlast-op-het-water-geluid', + 'overlast-op-het-water-snel-varen', + 'overlast-op-het-water-vaargedrag', + ], + }, + values: { + ja: 'Ja, het is een open boot (bijvoorbeeld een sloep, roeiboot, rondvaartboot met dak open)', + nee: 'Nee, het is een gesloten boot (bijvoorbeeld een rondvaartboot, salonboot, kajuitboot)', + onduidelijk: 'Ik kan het niet zien', + }, + label: 'Is het een open of een gesloten boot?', + shortLabel: 'Open boot', + pathMerge: 'extra_properties', + }, + options: { validators: ['required'] }, + render: QuestionFieldType.RadioInput, + }, + extra_boten_meer: { + meta: { + label: 'Wat weet u nog meer over deze situatie?', + shortLabel: 'Extra informatie', + subtitle: + 'Bijvoorbeeld: waar de boot naar toe vaart, naam boot, kleur van de boot, lengte en andere dingen die u opvallen, aantal passagiers', + pathMerge: 'extra_properties', + }, + render: QuestionFieldType.TextareaInput, + }, +} + +export default overlastOpHetWaterThor diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.test.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.test.ts index 2f9d180a20..f9a910988e 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.test.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.test.ts @@ -9,16 +9,9 @@ describe('definition overlast-op-het-water', () => { expect(keys).toStrictEqual([ 'locatie', 'dateTime', - 'dateTime_Thor', - 'extra_boten_frequentie', - 'extra_boten_moment', - 'extra_boten_beweging', - 'extra_boten_soort', - 'extra_boten_open_gesloten', 'extra_boten_drijfkracht', 'extra_boten_vast', 'extra_boten_lekken', - 'extra_boten_meer', ]) }) }) diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts index 712617f1e0..3dcee2bc86 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water.ts @@ -10,144 +10,12 @@ export const overlastOpHetWater = { dateTime: { meta: { label: 'Wanneer heeft u de overlast?', - ifOneOf: { - subcategory: [ - 'olie-op-het-water', - 'overlast-op-het-water-vaargedrag', - 'overlast-vanaf-het-water', - ], - }, }, options: { validators: [inPast, 'required'], }, render: QuestionFieldType.DateTimeInput, }, - dateTime_Thor: { - meta: { - label: 'Wanneer is of was de overlast?', - ifOneOf: { - subcategory: [ - 'blokkade-van-de-vaarweg', - 'overig-boten', - 'overlast-op-het-water-geluid', - 'overlast-op-het-water-snel-varen', - 'scheepvaart-nautisch-toezicht', - ], - }, - }, - options: { - validators: [inPast, 'required'], - }, - render: QuestionFieldType.DateTimeInput, - }, - - extra_boten_frequentie: { - meta: { - ifOneOf: { - subcategory: [ - 'blokkade-van-de-vaarweg', - 'overig-boten', - 'overlast-op-het-water-geluid', - 'overlast-op-het-water-snel-varen', - 'overlast-op-het-water-vaargedrag', - ], - }, - values: { - ja: 'Ja, het gebeurt vaker', - nee: 'Nee, het is de eerste keer', - }, - label: 'Heeft u deze overlast al eerder gehad?', - shortLabel: 'Eerder overlast', - pathMerge: 'extra_properties', - }, - render: QuestionFieldType.RadioInput, - }, - - extra_boten_moment: { - meta: { - ifAllOf: { - extra_boten_frequentie: 'ja', - }, - label: 'Op welke momenten van de dag hebt u de overlast?', - shortLabel: 'Overlast momenten', - pathMerge: 'extra_properties', - }, - options: { validators: ['required'] }, - render: QuestionFieldType.TextInput, - }, - - extra_boten_beweging: { - meta: { - ifOneOf: { - subcategory: [ - 'blokkade-van-de-vaarweg', - 'overig-boten', - 'overlast-op-het-water-geluid', - 'overlast-op-het-water-snel-varen', - 'overlast-op-het-water-vaargedrag', - ], - }, - values: { - ja: 'Ja, de boot ligt stil', - nee: 'Nee, de boot vaart', - }, - label: 'Ligt de boot stil?', - shortLabel: 'Beweging boot', - pathMerge: 'extra_properties', - }, - render: QuestionFieldType.RadioInput, - }, - - extra_boten_soort: { - meta: { - ifOneOf: { - subcategory: [ - 'overig-boten', - 'overlast-op-het-water-geluid', - 'overlast-op-het-water-snel-varen', - 'overlast-op-het-water-vaargedrag', - ], - }, - values: { - plezier: '(Plezier)boot in privé-eigendom', - rondvaart: 'Rondvaartboot of salonboot van rederij', - vracht: 'Vrachtschip of binnenvaartschip', - huur: 'Huurboot', - overig: 'Overig', - weetniet: 'Weet ik niet', - }, - label: 'Wat voor soort boot is het?', - shortLabel: 'Soort boot', - pathMerge: 'extra_properties', - }, - options: { validators: ['required'] }, - render: QuestionFieldType.RadioInput, - }, - - extra_boten_open_gesloten: { - meta: { - ifOneOf: { - subcategory: [ - 'overig-boten', - 'overlast-op-het-water-geluid', - 'overlast-op-het-water-snel-varen', - 'overlast-op-het-water-vaargedrag', - ], - }, - values: { - ja: 'Ja, het is een open boot (bijvoorbeeld een sloep, roeiboot, rondvaartboot met dak open)', - nee: 'Nee, het is een gesloten boot (bijvoorbeeld een rondvaartboot, salonboot, kajuitboot)', - onduidelijk: 'Ik kan het niet zien', - }, - label: 'Is het een open of een gesloten boot?', - shortLabel: 'Open boot', - pathMerge: 'extra_properties', - }, - options: { validators: ['required'] }, - render: QuestionFieldType.RadioInput, - }, - extra_boten_drijfkracht: { meta: { ifOneOf: { @@ -163,7 +31,6 @@ export const overlastOpHetWater = { }, render: QuestionFieldType.RadioInput, }, - extra_boten_vast: { meta: { ifOneOf: { @@ -180,7 +47,6 @@ export const overlastOpHetWater = { }, render: QuestionFieldType.RadioInput, }, - extra_boten_lekken: { meta: { ifOneOf: { @@ -197,26 +63,6 @@ export const overlastOpHetWater = { }, render: QuestionFieldType.RadioInput, }, - - extra_boten_meer: { - meta: { - ifOneOf: { - subcategory: [ - 'blokkade-van-de-vaarweg', - 'overig-boten', - 'overlast-op-het-water-geluid', - 'overlast-op-het-water-snel-varen', - 'overlast-op-het-water-vaargedrag', - ], - }, - label: 'Wat weet u nog meer over deze situatie?', - shortLabel: 'Extra informatie', - subtitle: - 'Bijvoorbeeld: waar de boot naar toe vaart, naam boot, kleur van de boot, lengte en andere dingen die u opvallen, aantal passagiers', - pathMerge: 'extra_properties', - }, - render: QuestionFieldType.TextareaInput, - }, } export default overlastOpHetWater From 201a01ef086e402969ed2c2092300cbce82399ac Mon Sep 17 00:00:00 2001 From: alimpens Date: Mon, 26 Aug 2024 11:32:26 +0200 Subject: [PATCH 9/9] Fix tests --- .../wizard-step-2-vulaan/overlast-op-het-water-thor.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water-thor.test.ts b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water-thor.test.ts index e8e66d6279..3241c1bc29 100644 --- a/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water-thor.test.ts +++ b/src/signals/incident/definitions/wizard-step-2-vulaan/overlast-op-het-water-thor.test.ts @@ -1,10 +1,10 @@ // SPDX-License-Identifier: MPL-2.0 // Copyright (C) 2018 - 2024 Gemeente Amsterdam -import overlastOpHetWater from './overlast-op-het-water' +import overlastOpHetWaterThor from './overlast-op-het-water-thor' describe('definition overlast-op-het-water', () => { it('has a defined set of controls', () => { - const keys = Object.keys(overlastOpHetWater) + const keys = Object.keys(overlastOpHetWaterThor) expect(keys).toStrictEqual([ 'locatie',