Skip to content

Commit

Permalink
Add new other guardian agreement status for placement tool
Browse files Browse the repository at this point in the history
  • Loading branch information
patari committed Jan 21, 2025
1 parent b9e052c commit 70851bc
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -1083,35 +1092,32 @@ export default React.memo(function ApplicationEditView({
{i18n.application.person.agreementStatus}
</Label>
<div>
{(
[
'AGREED',
'NOT_AGREED',
'RIGHT_TO_GET_NOTIFIED',
null
] as const
).map((id, index) => (
<React.Fragment key={id ?? 'NOT_SET'}>
{index !== 0 ? <Gap size="xxs" /> : null}
<Radio
label={
i18n.application.person
.otherGuardianAgreementStatuses[id ?? 'NOT_SET']
}
checked={
id === (secondGuardian?.agreementStatus ?? null)
}
onChange={() => {
setApplication(
set('form.secondGuardian.agreementStatus', id)
)
}}
data-qa={`radio-other-guardian-agreement-status-${
id ?? 'null'
}`}
/>
</React.Fragment>
))}
{selectableOtherGuardianAgreementStatuses.map(
(id, index) => (
<React.Fragment key={id ?? 'NOT_SET'}>
{index !== 0 ? <Gap size="xxs" /> : null}
<Radio
label={
i18n.application.person
.otherGuardianAgreementStatuses[
id ?? 'NOT_SET'
]
}
checked={
id === (secondGuardian?.agreementStatus ?? null)
}
onChange={() => {
setApplication(
set('form.secondGuardian.agreementStatus', id)
)
}}
data-qa={`radio-other-guardian-agreement-status-${
id ?? 'null'
}`}
/>
</React.Fragment>
)
)}
</div>
</ListGrid>
</>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib-common/generated/api-types/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ export type OtherGuardianAgreementStatus =
| 'AGREED'
| 'NOT_AGREED'
| 'RIGHT_TO_GET_NOTIFIED'
| 'AUTOMATED'

/**
* Generated from fi.espoo.evaka.application.PagedApplicationSummaries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ enum class OtherGuardianAgreementStatus {
AGREED,
NOT_AGREED,
RIGHT_TO_GET_NOTIFIED,
AUTOMATED,
}

data class PersonBasics(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ class PlacementToolService(
SecondGuardian(
phoneNumber = guardian2.phone,
email = guardian2.email ?: "",
agreementStatus = OtherGuardianAgreementStatus.AGREED,
agreementStatus = OtherGuardianAgreementStatus.AUTOMATED,
)
},
),
Expand Down

0 comments on commit 70851bc

Please sign in to comment.