From 70851bc9c59c06ea09ead3d64bfaa8e54f5c4c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jarkko=20P=C3=A4t=C3=A4ri?= Date: Tue, 21 Jan 2025 11:22:46 +0200 Subject: [PATCH] Add new other guardian agreement status for placement tool --- .../contact-info/SecondGuardianSubSection.tsx | 7 +- .../application-page/ApplicationEditView.tsx | 64 ++++++++++--------- .../generated/api-types/application.ts | 1 + .../defaults/employee/i18n/fi.tsx | 1 + .../evaka/application/ApplicationForm.kt | 1 + .../evaka/application/PlacementToolService.kt | 2 +- 6 files changed, 45 insertions(+), 31 deletions(-) diff --git a/frontend/src/citizen-frontend/applications/editor/contact-info/SecondGuardianSubSection.tsx b/frontend/src/citizen-frontend/applications/editor/contact-info/SecondGuardianSubSection.tsx index b1d5657fdfd..93218963c14 100644 --- a/frontend/src/citizen-frontend/applications/editor/contact-info/SecondGuardianSubSection.tsx +++ b/frontend/src/citizen-frontend/applications/editor/contact-info/SecondGuardianSubSection.tsx @@ -31,6 +31,11 @@ type SecondGuardianSubSectionProps = { otherGuardianStatus: 'NO' | 'SAME_ADDRESS' | 'DIFFERENT_ADDRESS' } +export type SelectableOtherGuardianAgreementStatus = Exclude< + OtherGuardianAgreementStatus, + 'AUTOMATED' +> + export default React.memo(function SecondGuardianSubSection({ type, formData, @@ -41,7 +46,7 @@ export default React.memo(function SecondGuardianSubSection({ }: SecondGuardianSubSectionProps) { const t = useTranslation() - const agreementStatuses: OtherGuardianAgreementStatus[] = [ + const agreementStatuses: SelectableOtherGuardianAgreementStatus[] = [ 'AGREED', 'NOT_AGREED', 'RIGHT_TO_GET_NOTIFIED' diff --git a/frontend/src/employee-frontend/components/application-page/ApplicationEditView.tsx b/frontend/src/employee-frontend/components/application-page/ApplicationEditView.tsx index 98ba4a3cd30..bb70d8e9395 100644 --- a/frontend/src/employee-frontend/components/application-page/ApplicationEditView.tsx +++ b/frontend/src/employee-frontend/components/application-page/ApplicationEditView.tsx @@ -15,6 +15,7 @@ import { Address, ApplicationDetails, FutureAddress, + OtherGuardianAgreementStatus, PersonBasics } from 'lib-common/generated/api-types/application' import { AttachmentType } from 'lib-common/generated/api-types/attachment' @@ -93,6 +94,14 @@ const PreferredUnitGridContainer = styled.div` grid-template-columns: 1fr auto auto auto auto; ` +export type SelectableOtherGuardianAgreementStatus = Exclude< + OtherGuardianAgreementStatus, + 'AUTOMATED' +> | null + +const selectableOtherGuardianAgreementStatuses: SelectableOtherGuardianAgreementStatus[] = + ['AGREED', 'NOT_AGREED', 'RIGHT_TO_GET_NOTIFIED', null] + export default React.memo(function ApplicationEditView({ application, setApplication, @@ -1083,35 +1092,32 @@ export default React.memo(function ApplicationEditView({ {i18n.application.person.agreementStatus}
- {( - [ - 'AGREED', - 'NOT_AGREED', - 'RIGHT_TO_GET_NOTIFIED', - null - ] as const - ).map((id, index) => ( - - {index !== 0 ? : null} - { - setApplication( - set('form.secondGuardian.agreementStatus', id) - ) - }} - data-qa={`radio-other-guardian-agreement-status-${ - id ?? 'null' - }`} - /> - - ))} + {selectableOtherGuardianAgreementStatuses.map( + (id, index) => ( + + {index !== 0 ? : null} + { + setApplication( + set('form.secondGuardian.agreementStatus', id) + ) + }} + data-qa={`radio-other-guardian-agreement-status-${ + id ?? 'null' + }`} + /> + + ) + )}
diff --git a/frontend/src/lib-common/generated/api-types/application.ts b/frontend/src/lib-common/generated/api-types/application.ts index 6f80cfdbbff..1820087a9ea 100644 --- a/frontend/src/lib-common/generated/api-types/application.ts +++ b/frontend/src/lib-common/generated/api-types/application.ts @@ -598,6 +598,7 @@ export type OtherGuardianAgreementStatus = | 'AGREED' | 'NOT_AGREED' | 'RIGHT_TO_GET_NOTIFIED' + | 'AUTOMATED' /** * Generated from fi.espoo.evaka.application.PagedApplicationSummaries diff --git a/frontend/src/lib-customizations/defaults/employee/i18n/fi.tsx b/frontend/src/lib-customizations/defaults/employee/i18n/fi.tsx index f8389ba429c..cf614367890 100755 --- a/frontend/src/lib-customizations/defaults/employee/i18n/fi.tsx +++ b/frontend/src/lib-customizations/defaults/employee/i18n/fi.tsx @@ -440,6 +440,7 @@ export const fi = { AGREED: 'Sovittu yhdessä', NOT_AGREED: 'Ei ole sovittu yhdessä', RIGHT_TO_GET_NOTIFIED: 'Vain tiedonsaantioikeus', + AUTOMATED: 'Automaattinen päätös', NOT_SET: 'Huoltajat asuvat samassa osoitteessa' }, noOtherChildren: 'Ei muita lapsia', diff --git a/service/src/main/kotlin/fi/espoo/evaka/application/ApplicationForm.kt b/service/src/main/kotlin/fi/espoo/evaka/application/ApplicationForm.kt index cfbfeefc3ae..981ad41331c 100755 --- a/service/src/main/kotlin/fi/espoo/evaka/application/ApplicationForm.kt +++ b/service/src/main/kotlin/fi/espoo/evaka/application/ApplicationForm.kt @@ -477,6 +477,7 @@ enum class OtherGuardianAgreementStatus { AGREED, NOT_AGREED, RIGHT_TO_GET_NOTIFIED, + AUTOMATED, } data class PersonBasics( diff --git a/service/src/main/kotlin/fi/espoo/evaka/application/PlacementToolService.kt b/service/src/main/kotlin/fi/espoo/evaka/application/PlacementToolService.kt index 9f965ef250d..c27cff8ea87 100644 --- a/service/src/main/kotlin/fi/espoo/evaka/application/PlacementToolService.kt +++ b/service/src/main/kotlin/fi/espoo/evaka/application/PlacementToolService.kt @@ -312,7 +312,7 @@ class PlacementToolService( SecondGuardian( phoneNumber = guardian2.phone, email = guardian2.email ?: "", - agreementStatus = OtherGuardianAgreementStatus.AGREED, + agreementStatus = OtherGuardianAgreementStatus.AUTOMATED, ) }, ),