Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat-6019]: Update 'when' question for THOR and VTH subcategories #2928

Merged
merged 9 commits into from
Aug 26, 2024
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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,
Expand Down
40 changes: 34 additions & 6 deletions src/signals/incident/definitions/wizard-step-2-vulaan.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// 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'

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'
Expand All @@ -15,9 +16,11 @@ 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'
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'
Expand Down Expand Up @@ -107,6 +110,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)
}

Expand Down Expand Up @@ -141,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':
Expand All @@ -150,13 +168,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':
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright (C) 2024 Gemeente Amsterdam
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',
])
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright (C) 2024 Gemeente Amsterdam
import { 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?',
},
options: {
validators: [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
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
// SPDX-License-Identifier: MPL-2.0
// Copyright (C) 2018 - 2024 Gemeente Amsterdam
import afval from './afval'

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'])
})
})
49 changes: 1 addition & 48 deletions src/signals/incident/definitions/wizard-step-2-vulaan/afval.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -12,61 +12,14 @@ export const controls = {
locatie,
dateTime: {
meta: {
ifOneOf: {
subcategory: ['asbest-accu', 'handhaving-op-afval'],
},
label: 'Wanneer was het?',
ignoreVisibility: true,
canBeNull: true,
},
options: {
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: {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
19 changes: 0 additions & 19 deletions src/signals/incident/definitions/wizard-step-2-vulaan/dateTime.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,26 @@ import locatie from './locatie'

const overlastBedrijvenEnHoreca = {
locatie,

dateTime: {
meta: {
ifOneOf: {
subcategory: [
'geluidsoverlast-installaties',
'geluidsoverlast-muziek',
'overig-horecabedrijven',
'overlast-door-bezoekers-niet-op-terras',
'overlast-evenementen',
'overlast-terrassen',
'stankoverlast',
],
},
label: 'Wanneer heeft u de overlast?',
canBeNull: true,
label: 'Wanneer is of was de overlast?',
},
options: {
validators: [inPast, 'required'],
},
render: QuestionFieldType.DateTimeInput,
},

extra_bedrijven_horeca_frequentie: {
meta: {
ifOneOf: {
Expand Down
Loading
Loading