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

Ehdottavan esiopetuksen hakemuksen sovittu yhdessä tiedon poisto #6273

Merged
merged 2 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

import React from 'react'

import { ContactInfoFormData } from 'lib-common/api-types/application/ApplicationFormData'
import { UpdateStateFn } from 'lib-common/form-state'
import {
ApplicationType,
OtherGuardianAgreementStatus
} from 'lib-common/generated/api-types/application'
ContactInfoFormData,
SelectableOtherGuardianAgreementStatus
} from 'lib-common/api-types/application/ApplicationFormData'
import { UpdateStateFn } from 'lib-common/form-state'
import { ApplicationType } from 'lib-common/generated/api-types/application'
import InputField from 'lib-components/atoms/form/InputField'
import Radio from 'lib-components/atoms/form/Radio'
import AdaptiveFlex from 'lib-components/layout/AdaptiveFlex'
Expand Down Expand Up @@ -41,7 +41,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 @@ -9,6 +9,7 @@ import { Link } from 'react-router'
import styled from 'styled-components'

import { Result } from 'lib-common/api'
import { SelectableOtherGuardianAgreementStatus } from 'lib-common/api-types/application/ApplicationFormData'
import { swapElements } from 'lib-common/array'
import DateRange from 'lib-common/date-range'
import {
Expand Down Expand Up @@ -90,6 +91,9 @@ const PreferredUnitGridContainer = styled.div`
grid-template-columns: 1fr auto auto auto auto;
`

const selectableOtherGuardianAgreementStatuses: (SelectableOtherGuardianAgreementStatus | null)[] =
['AGREED', 'NOT_AGREED', 'RIGHT_TO_GET_NOTIFIED', null]

export default React.memo(function ApplicationEditView({
application,
setApplication,
Expand Down Expand Up @@ -1072,35 +1076,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
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ export type UnitPreferenceFormData = {
preferredUnits: { id: DaycareId; name: string }[]
}

export type SelectableOtherGuardianAgreementStatus = Exclude<
OtherGuardianAgreementStatus,
'AUTOMATED'
>

export type ContactInfoFormData = {
childFirstName: string
childLastName: string
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
Loading