diff --git a/libs/application/template-api-modules/src/lib/modules/templates/new-primary-school/new-primary-school.utils.ts b/libs/application/template-api-modules/src/lib/modules/templates/new-primary-school/new-primary-school.utils.ts index f816098a2283..ba563d9ca9d3 100644 --- a/libs/application/template-api-modules/src/lib/modules/templates/new-primary-school/new-primary-school.utils.ts +++ b/libs/application/template-api-modules/src/lib/modules/templates/new-primary-school/new-primary-school.utils.ts @@ -69,13 +69,13 @@ export const transformApplicationToNewPrimarySchoolDTO = ( phone: relative.phoneNumber, role: relative.relation, })), - // TODO: Skoða hvernig ég veit hvaða ástæða var valin (ég er ekki með lista yfir ástæður) ...(reasonForApplication === - ReasonForApplicationOptions.SIBLINGS_IN_THE_SAME_PRIMARY_SCHOOL + ReasonForApplicationOptions.SIBLINGS_IN_SAME_SCHOOL ? siblings.map((sibling) => ({ name: sibling.fullName, nationalId: sibling.nationalId, - // TODO: Siblings relation valmöguleikar eru ekki í key-options endapunktinum => Júní ætlar að bæta því við (Þurfum að passa að þeir valmöguleikar komi ekki upp í dropdown á aðstandenda síðunni) + // TODO: Siblings relation options are not in the key-options endpoint => Júní has added "sibling" (We need to make sure that those options do not appear in the dropdown on the relatives page) + // TODO: We are waiting for a reply from MMS if this is important information or if we should remove it role: sibling.relation, })) : []), @@ -114,7 +114,6 @@ export const transformApplicationToNewPrimarySchoolDTO = ( }, agents, registration: { - // TODO: Skoða hvernig ég veit hvaða ástæða var valin (ég er ekki með lista yfir ástæður) defaultOrg: primaryOrgId, ...(reasonForApplication !== ReasonForApplicationOptions.MOVING_ABROAD ? { @@ -127,7 +126,7 @@ export const transformApplicationToNewPrimarySchoolDTO = ( }), reason: reasonForApplication, ...(reasonForApplication === - ReasonForApplicationOptions.TRANSFER_OF_LEGAL_DOMICILE + ReasonForApplicationOptions.MOVING_MUNICIPALITY ? { newDomicile: { address: reasonForApplicationStreetAddress, diff --git a/libs/application/templates/new-primary-school/src/fields/FriggOptionsAsyncSelectField/index.tsx b/libs/application/templates/new-primary-school/src/fields/FriggOptionsAsyncSelectField/index.tsx index eae477a04fa9..816c9b28ccbf 100644 --- a/libs/application/templates/new-primary-school/src/fields/FriggOptionsAsyncSelectField/index.tsx +++ b/libs/application/templates/new-primary-school/src/fields/FriggOptionsAsyncSelectField/index.tsx @@ -30,7 +30,7 @@ const FriggOptionsAsyncSelectField: FC< > = ({ error, field, application }) => { const { lang } = useLocale() const { title, props, defaultValue, id } = field - const { isMulti = true, optionsType, placeholder } = props + const { isMulti = false, optionsType, placeholder } = props return ( options.flatMap(({ value, key }) => { let content = value.find( @@ -72,7 +72,16 @@ const FriggOptionsAsyncSelectField: FC< return { value: key ?? '', label: content ?? '' } }), ) ?? [] + + const otherIndex = options.findIndex( + (option) => option.value === 'other', ) + + if (otherIndex >= 0) { + options.push(options.splice(otherIndex, 1)[0]) + } + + return options }, isMulti, backgroundColor: 'blue', diff --git a/libs/application/templates/new-primary-school/src/fields/RelativesTableRepeater/index.tsx b/libs/application/templates/new-primary-school/src/fields/RelativesTableRepeater/index.tsx index 875ebe4ae322..b8eeaaca84ab 100644 --- a/libs/application/templates/new-primary-school/src/fields/RelativesTableRepeater/index.tsx +++ b/libs/application/templates/new-primary-school/src/fields/RelativesTableRepeater/index.tsx @@ -22,7 +22,9 @@ const RelativesTableRepeater: FC> = ({ }) => { const { id, title } = field - const relationFriggOptions = useFriggOptions(OptionsType.RELATION) + const { options: relationFriggOptions } = useFriggOptions( + OptionsType.RELATION, + ) return ( = ({ {reasonForApplication !== ReasonForApplicationOptions.MOVING_ABROAD && ( <> {reasonForApplication === - ReasonForApplicationOptions.SIBLINGS_IN_THE_SAME_PRIMARY_SCHOOL && ( + ReasonForApplicationOptions.SIBLINGS_IN_SAME_SCHOOL && ( )} diff --git a/libs/application/templates/new-primary-school/src/fields/Review/review-groups/Child.tsx b/libs/application/templates/new-primary-school/src/fields/Review/review-groups/Child.tsx index df7ed000027e..fc3f0539cec4 100644 --- a/libs/application/templates/new-primary-school/src/fields/Review/review-groups/Child.tsx +++ b/libs/application/templates/new-primary-school/src/fields/Review/review-groups/Child.tsx @@ -1,16 +1,23 @@ +import { coreErrorMessages } from '@island.is/application/core' import { YES } from '@island.is/application/types' import { DataValue, ReviewGroup } from '@island.is/application/ui-components' -import { GridColumn, GridRow, Stack, Text } from '@island.is/island-ui/core' +import { + GridColumn, + GridRow, + SkeletonLoader, + Stack, + Text, +} from '@island.is/island-ui/core' import { useLocale } from '@island.is/localization' import { format as formatKennitala } from 'kennitala' +import { useFriggOptions } from '../../../hooks/useFriggOptions' +import { OptionsType } from '../../../lib/constants' import { newPrimarySchoolMessages } from '../../../lib/messages' import { getApplicationAnswers, getSelectedOptionLabel, } from '../../../lib/newPrimarySchoolUtils' import { ReviewGroupProps } from './props' -import { useFriggOptions } from '../../../hooks/useFriggOptions' -import { OptionsType } from '../../../lib/constants' export const Child = ({ application, @@ -22,7 +29,11 @@ export const Child = ({ application.answers, ) - const pronounOptions = useFriggOptions(OptionsType.PRONOUN) + const { + options: pronounOptions, + loading, + error, + } = useFriggOptions(OptionsType.PRONOUN) return ( - - - - - - - - - - - - - - - - - {(childInfo.preferredName || - childInfo.pronouns?.length > 0 || - differentPlaceOfResidence === YES) && ( - - {childInfo.preferredName && ( + {childInfo.pronouns?.length > 0 && loading ? ( + + ) : ( + <> + - )} - {childInfo.pronouns?.length > 0 && ( - + - getSelectedOptionLabel(pronounOptions, pronoun), - ) - .join(', ')} + value={formatKennitala(childInfo.nationalId)} + /> + + + + + - )} - {differentPlaceOfResidence === YES && ( + + {(childInfo.preferredName?.trim().length > 0 || + childInfo.pronouns?.length > 0 || + differentPlaceOfResidence === YES) && ( + + {childInfo.preferredName?.trim().length > 0 && ( + + + + )} + {childInfo.pronouns?.length > 0 && ( + + + getSelectedOptionLabel(pronounOptions, pronoun), + ) + .join(', ')} + error={ + error + ? formatMessage(coreErrorMessages.failedDataProvider) + : undefined + } + /> + + )} + {differentPlaceOfResidence === YES && ( + + + + )} + )} - + )} diff --git a/libs/application/templates/new-primary-school/src/fields/Review/review-groups/ReasonForApplication.tsx b/libs/application/templates/new-primary-school/src/fields/Review/review-groups/ReasonForApplication.tsx index 97434e05efd5..23bb95fc7f7e 100644 --- a/libs/application/templates/new-primary-school/src/fields/Review/review-groups/ReasonForApplication.tsx +++ b/libs/application/templates/new-primary-school/src/fields/Review/review-groups/ReasonForApplication.tsx @@ -1,12 +1,22 @@ +import { coreErrorMessages } from '@island.is/application/core' import { DataValue, ReviewGroup } from '@island.is/application/ui-components' -import { GridColumn, GridRow, Stack } from '@island.is/island-ui/core' +import { + GridColumn, + GridRow, + SkeletonLoader, + Stack, +} from '@island.is/island-ui/core' import { useLocale } from '@island.is/localization' import { getCountryByCode } from '@island.is/shared/utils' -import { ReasonForApplicationOptions } from '../../../lib/constants' +import { useFriggOptions } from '../../../hooks/useFriggOptions' +import { + OptionsType, + ReasonForApplicationOptions, +} from '../../../lib/constants' import { newPrimarySchoolMessages } from '../../../lib/messages' import { getApplicationAnswers, - getReasonForApplicationOptionLabel, + getSelectedOptionLabel, } from '../../../lib/newPrimarySchoolUtils' import { ReviewGroupProps } from './props' @@ -23,62 +33,81 @@ export const ReasonForApplication = ({ reasonForApplicationPostalCode, } = getApplicationAnswers(application.answers) + const { + options: relationFriggOptions, + loading, + error, + } = useFriggOptions(OptionsType.REASON) + return ( goToScreen?.('reasonForApplication')} isLast > - - - - - - - {reasonForApplication === ReasonForApplicationOptions.MOVING_ABROAD && ( + {loading ? ( + + ) : ( + - )} - {reasonForApplication === - ReasonForApplicationOptions.TRANSFER_OF_LEGAL_DOMICILE && ( - - - - - - - - - )} - + {reasonForApplication === + ReasonForApplicationOptions.MOVING_ABROAD && ( + + + + + + )} + {reasonForApplication === + ReasonForApplicationOptions.MOVING_MUNICIPALITY && ( + + + + + + + + + )} + + )} ) } diff --git a/libs/application/templates/new-primary-school/src/fields/Review/review-groups/Relatives.tsx b/libs/application/templates/new-primary-school/src/fields/Review/review-groups/Relatives.tsx index 9377bdd34b49..a5dbb54958e9 100644 --- a/libs/application/templates/new-primary-school/src/fields/Review/review-groups/Relatives.tsx +++ b/libs/application/templates/new-primary-school/src/fields/Review/review-groups/Relatives.tsx @@ -1,3 +1,4 @@ +import { coreErrorMessages } from '@island.is/application/core' import { FieldComponents, FieldTypes } from '@island.is/application/types' import { Label, @@ -6,7 +7,13 @@ import { removeCountryCode, } from '@island.is/application/ui-components' import { StaticTableFormField } from '@island.is/application/ui-fields' -import { Box, GridColumn, GridRow } from '@island.is/island-ui/core' +import { + Box, + GridColumn, + GridRow, + SkeletonLoader, + Text, +} from '@island.is/island-ui/core' import { useLocale } from '@island.is/localization' import { format as formatKennitala } from 'kennitala' import { useFriggOptions } from '../../../hooks/useFriggOptions' @@ -26,7 +33,11 @@ export const Relatives = ({ const { formatMessage } = useLocale() const { relatives } = getApplicationAnswers(application.answers) - const relationFriggOptions = useFriggOptions(OptionsType.RELATION) + const { + options: relationFriggOptions, + loading, + error, + } = useFriggOptions(OptionsType.RELATION) const rows = relatives.map((r) => { return [ @@ -42,37 +53,46 @@ export const Relatives = ({ isEditable={editable} editAction={() => goToScreen?.('relatives')} > - - - - {relatives?.length > 0 && ( - - - - )} - - + + + )} ) } diff --git a/libs/application/templates/new-primary-school/src/fields/Review/review-groups/School.tsx b/libs/application/templates/new-primary-school/src/fields/Review/review-groups/School.tsx index 5367e841215b..8169d3d0fa38 100644 --- a/libs/application/templates/new-primary-school/src/fields/Review/review-groups/School.tsx +++ b/libs/application/templates/new-primary-school/src/fields/Review/review-groups/School.tsx @@ -1,4 +1,5 @@ import { useQuery } from '@apollo/client' +import { coreErrorMessages } from '@island.is/application/core' import { DataValue, ReviewGroup } from '@island.is/application/ui-components' import { GridColumn, @@ -8,6 +9,7 @@ import { Text, } from '@island.is/island-ui/core' import { useLocale } from '@island.is/localization' +import { useMemo } from 'react' import { friggSchoolsByMunicipalityQuery } from '../../../graphql/queries' import { newPrimarySchoolMessages } from '../../../lib/messages' import { @@ -18,7 +20,6 @@ import { } from '../../../lib/newPrimarySchoolUtils' import { FriggSchoolsByMunicipalityQuery } from '../../../types/schema' import { ReviewGroupProps } from './props' -import { useMemo } from 'react' export const School = ({ application, @@ -33,7 +34,7 @@ export const School = ({ application.externalData, ) - const { data, loading } = useQuery( + const { data, loading, error } = useQuery( friggSchoolsByMunicipalityQuery, ) const selectedSchoolName = useMemo(() => { @@ -75,6 +76,11 @@ export const School = ({ newPrimarySchoolMessages.overview.selectedSchool, )} value={selectedSchoolName || ''} + error={ + error + ? formatMessage(coreErrorMessages.failedDataProvider) + : undefined + } /> diff --git a/libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/childrenNParentsSection/childInfoSubSection.ts b/libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/childrenNParentsSection/childInfoSubSection.ts index b0d90f5a600c..9fc21890ea8f 100644 --- a/libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/childrenNParentsSection/childInfoSubSection.ts +++ b/libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/childrenNParentsSection/childInfoSubSection.ts @@ -93,6 +93,7 @@ export const childInfoSubSection = buildSubSection({ placeholder: newPrimarySchoolMessages.childrenNParents .childInfoPronounsPlaceholder, + isMulti: true, }, ), buildRadioField({ diff --git a/libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/differentNeedsSection/supportSubSection.ts b/libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/differentNeedsSection/supportSubSection.ts index c901fe26f70f..af94622b42f6 100644 --- a/libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/differentNeedsSection/supportSubSection.ts +++ b/libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/differentNeedsSection/supportSubSection.ts @@ -13,7 +13,7 @@ export const supportSubSection = buildSubSection({ children: [ buildMultiField({ id: 'support', - title: newPrimarySchoolMessages.differentNeeds.support, + title: newPrimarySchoolMessages.differentNeeds.supportSubSectionTitle, description: newPrimarySchoolMessages.differentNeeds.supportDescription, children: [ buildRadioField({ diff --git a/libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/primarySchoolSection/reasonForApplicationSubSection.ts b/libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/primarySchoolSection/reasonForApplicationSubSection.ts index d6c13912418e..635286f7710a 100644 --- a/libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/primarySchoolSection/reasonForApplicationSubSection.ts +++ b/libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/primarySchoolSection/reasonForApplicationSubSection.ts @@ -1,17 +1,18 @@ import { buildAlertMessageField, + buildCustomField, buildMultiField, buildSelectField, buildSubSection, buildTextField, } from '@island.is/application/core' import { getAllCountryCodes } from '@island.is/shared/utils' -import { ReasonForApplicationOptions } from '../../../lib/constants' -import { newPrimarySchoolMessages } from '../../../lib/messages' import { - getApplicationAnswers, - getReasonForApplicationOptions, -} from '../../../lib/newPrimarySchoolUtils' + OptionsType, + ReasonForApplicationOptions, +} from '../../../lib/constants' +import { newPrimarySchoolMessages } from '../../../lib/messages' +import { getApplicationAnswers } from '../../../lib/newPrimarySchoolUtils' export const reasonForApplicationSubSection = buildSubSection({ id: 'reasonForApplicationSubSection', @@ -26,17 +27,22 @@ export const reasonForApplicationSubSection = buildSubSection({ description: newPrimarySchoolMessages.primarySchool.reasonForApplicationDescription, children: [ - buildSelectField({ - id: 'reasonForApplication.reason', - dataTestId: 'reason-for-application', - title: - newPrimarySchoolMessages.primarySchool - .reasonForApplicationSubSectionTitle, - placeholder: - newPrimarySchoolMessages.primarySchool - .reasonForApplicationPlaceholder, - options: getReasonForApplicationOptions(), - }), + buildCustomField( + { + id: 'reasonForApplication.reason', + title: + newPrimarySchoolMessages.primarySchool + .reasonForApplicationSubSectionTitle, + component: 'FriggOptionsAsyncSelectField', + dataTestId: 'reason-for-application', + }, + { + optionsType: OptionsType.REASON, + placeholder: + newPrimarySchoolMessages.primarySchool + .reasonForApplicationPlaceholder, + }, + ), buildSelectField({ id: 'reasonForApplication.movingAbroad.country', dataTestId: 'reason-for-application-country', @@ -70,7 +76,7 @@ export const reasonForApplicationSubSection = buildSubSection({ return ( reasonForApplication === - ReasonForApplicationOptions.TRANSFER_OF_LEGAL_DOMICILE + ReasonForApplicationOptions.MOVING_MUNICIPALITY ) }, }), @@ -85,7 +91,7 @@ export const reasonForApplicationSubSection = buildSubSection({ return ( reasonForApplication === - ReasonForApplicationOptions.TRANSFER_OF_LEGAL_DOMICILE + ReasonForApplicationOptions.MOVING_MUNICIPALITY ) }, }), @@ -103,7 +109,7 @@ export const reasonForApplicationSubSection = buildSubSection({ return ( reasonForApplication === - ReasonForApplicationOptions.TRANSFER_OF_LEGAL_DOMICILE || + ReasonForApplicationOptions.MOVING_MUNICIPALITY || (reasonForApplication === ReasonForApplicationOptions.MOVING_ABROAD && reasonForApplicationCountry !== undefined) diff --git a/libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/primarySchoolSection/siblingsSubSection.ts b/libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/primarySchoolSection/siblingsSubSection.ts index e03a8d321d78..ba7dcd913a56 100644 --- a/libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/primarySchoolSection/siblingsSubSection.ts +++ b/libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/primarySchoolSection/siblingsSubSection.ts @@ -23,7 +23,7 @@ export const siblingsSubSection = buildSubSection({ const { reasonForApplication } = getApplicationAnswers(answers) return ( reasonForApplication === - ReasonForApplicationOptions.SIBLINGS_IN_THE_SAME_PRIMARY_SCHOOL + ReasonForApplicationOptions.SIBLINGS_IN_SAME_SCHOOL ) }, children: [ diff --git a/libs/application/templates/new-primary-school/src/forms/Prerequisites/externalDataSubSection.ts b/libs/application/templates/new-primary-school/src/forms/Prerequisites/externalDataSubSection.ts index ff0152236a11..5ee75771a64b 100644 --- a/libs/application/templates/new-primary-school/src/forms/Prerequisites/externalDataSubSection.ts +++ b/libs/application/templates/new-primary-school/src/forms/Prerequisites/externalDataSubSection.ts @@ -36,6 +36,10 @@ export const externalDataSubSection = buildSubSection({ title: newPrimarySchoolMessages.pre.userProfileInformationTitle, subTitle: newPrimarySchoolMessages.pre.userProfileInformationSubTitle, }), + buildDataProviderItem({ + title: newPrimarySchoolMessages.pre.childInformationTitle, + subTitle: newPrimarySchoolMessages.pre.childInformationSubTitle, + }), ], }), ], diff --git a/libs/application/templates/new-primary-school/src/hooks/useFriggOptions.ts b/libs/application/templates/new-primary-school/src/hooks/useFriggOptions.ts index 0b277a9054f2..57431a89babd 100644 --- a/libs/application/templates/new-primary-school/src/hooks/useFriggOptions.ts +++ b/libs/application/templates/new-primary-school/src/hooks/useFriggOptions.ts @@ -6,15 +6,18 @@ import { FriggOptionsQuery } from '../types/schema' export const useFriggOptions = (type?: OptionsType) => { const { lang } = useLocale() - const { data } = useQuery(friggOptionsQuery, { - variables: { - type: { - type, + const { data, loading, error } = useQuery( + friggOptionsQuery, + { + variables: { + type: { + type, + }, }, }, - }) + ) - return ( + const options = data?.friggOptions?.flatMap(({ options }) => options.flatMap(({ value, key }) => { let content = value.find(({ language }) => language === lang)?.content @@ -24,5 +27,12 @@ export const useFriggOptions = (type?: OptionsType) => { return { value: key ?? '', label: content ?? '' } }), ) ?? [] - ) + + const otherIndex = options.findIndex((option) => option.value === 'other') + + if (otherIndex >= 0) { + options.push(options.splice(otherIndex, 1)[0]) + } + + return { options, loading, error } } diff --git a/libs/application/templates/new-primary-school/src/lib/NewPrimarySchoolTemplate.ts b/libs/application/templates/new-primary-school/src/lib/NewPrimarySchoolTemplate.ts index 8dbf12e5d375..2020ded50ffb 100644 --- a/libs/application/templates/new-primary-school/src/lib/NewPrimarySchoolTemplate.ts +++ b/libs/application/templates/new-primary-school/src/lib/NewPrimarySchoolTemplate.ts @@ -182,10 +182,10 @@ const NewPrimarySchoolTemplate: ApplicationTemplate< unset(application.answers, 'reasonForApplication.movingAbroad') } - // Clear transferOfLegalDomicile if "Transfer of legal domicile" is not selected as reason for application + // Clear transferOfLegalDomicile if "Moving legal domicile" is not selected as reason for application if ( reasonForApplication !== - ReasonForApplicationOptions.TRANSFER_OF_LEGAL_DOMICILE + ReasonForApplicationOptions.MOVING_MUNICIPALITY ) { unset( application.answers, @@ -193,10 +193,10 @@ const NewPrimarySchoolTemplate: ApplicationTemplate< ) } - // Clear siblings if "Siblings in the same primary school" is not selected as reason for application + // Clear siblings if "Siblings in the same school" is not selected as reason for application if ( reasonForApplication !== - ReasonForApplicationOptions.SIBLINGS_IN_THE_SAME_PRIMARY_SCHOOL + ReasonForApplicationOptions.SIBLINGS_IN_SAME_SCHOOL ) { unset(application.answers, 'siblings') } diff --git a/libs/application/templates/new-primary-school/src/lib/constants.ts b/libs/application/templates/new-primary-school/src/lib/constants.ts index c4c150539b88..11bcb7d32cc5 100644 --- a/libs/application/templates/new-primary-school/src/lib/constants.ts +++ b/libs/application/templates/new-primary-school/src/lib/constants.ts @@ -26,16 +26,9 @@ export enum Roles { } export enum ReasonForApplicationOptions { - TRANSFER_OF_LEGAL_DOMICILE = 'transferOfLegalDomicile', - STUDY_STAY_FOR_PARENTS = 'studyStayForParents', - PARENTS_PARLIAMENTARY_MEMBERSHIP = 'parentsParliamentaryMembership', - TEMPORARY_FROSTER = 'temporaryFoster', - EXPERT_SERVICE = 'expertService', - SICKLY = 'sickly', - LIVES_IN_TWO_HOMES = 'livesInTwoHomes', - SIBLINGS_IN_THE_SAME_PRIMARY_SCHOOL = 'siblingsInTheSamePrimarySchool', + MOVING_MUNICIPALITY = 'movingMuniciplaity', MOVING_ABROAD = 'movingAbroad', - OTHER_REASONS = 'otherReasons', + SIBLINGS_IN_SAME_SCHOOL = 'SiblingsInSameSchool', } export enum SiblingRelationOptions { @@ -48,7 +41,7 @@ export enum OptionsType { PRONOUN = 'pronoun', GENDER = 'gender', INTOLERANCE = 'intolerence', - REASON = 'rejectionReason', + REASON = 'registrationReason', RELATION = 'relation', ALLERGY = 'allergy', } diff --git a/libs/application/templates/new-primary-school/src/lib/dataSchema.ts b/libs/application/templates/new-primary-school/src/lib/dataSchema.ts index 54f61828ba0e..a8f9cdbef65f 100644 --- a/libs/application/templates/new-primary-school/src/lib/dataSchema.ts +++ b/libs/application/templates/new-primary-school/src/lib/dataSchema.ts @@ -76,7 +76,7 @@ export const dataSchema = z.object({ }), reasonForApplication: z .object({ - reason: z.nativeEnum(ReasonForApplicationOptions), + reason: z.string(), movingAbroad: z .object({ country: z.string().optional(), @@ -100,7 +100,7 @@ export const dataSchema = z.object({ ) .refine( ({ reason, transferOfLegalDomicile }) => - reason === ReasonForApplicationOptions.TRANSFER_OF_LEGAL_DOMICILE + reason === ReasonForApplicationOptions.MOVING_MUNICIPALITY ? transferOfLegalDomicile && transferOfLegalDomicile.streetAddress.length > 0 : true, @@ -110,7 +110,7 @@ export const dataSchema = z.object({ ) .refine( ({ reason, transferOfLegalDomicile }) => - reason === ReasonForApplicationOptions.TRANSFER_OF_LEGAL_DOMICILE + reason === ReasonForApplicationOptions.MOVING_MUNICIPALITY ? transferOfLegalDomicile && transferOfLegalDomicile.postalCode.length > 0 : true, diff --git a/libs/application/templates/new-primary-school/src/lib/messages.ts b/libs/application/templates/new-primary-school/src/lib/messages.ts index 4f8ebf3ef61c..e442633c9071 100644 --- a/libs/application/templates/new-primary-school/src/lib/messages.ts +++ b/libs/application/templates/new-primary-school/src/lib/messages.ts @@ -145,6 +145,19 @@ export const newPrimarySchoolMessages: MessageDir = { description: 'Information about email address and phone number will be retrieved from My Pages at Ísland.is.', }, + childInformationTitle: { + id: 'nps.application:prerequisites.child.information.title', + defaultMessage: 'Upplýsingar frá Miðstöð menntunar og skólaþjónustu', + description: + 'Information from the Directorate of Education and School Services', + }, + childInformationSubTitle: { + id: 'nps.application:prerequisites.child.information.subtitle', + defaultMessage: + 'Upplýsingar frá núverandi skóla barns. Upplýsingar um barn og ólíkar þarfir þess.', + description: + "Information from the child's current school. Information about the child and their different needs.", + }, checkboxProvider: { id: 'nps.application:prerequisites.checkbox.provider', defaultMessage: @@ -167,7 +180,7 @@ export const newPrimarySchoolMessages: MessageDir = { childrenDescription: { id: 'nps.application:prerequisites.childrenDescription#markdown', defaultMessage: `Samkvæmt uppflettingu í Þjóðskrá hefur þú forsjá með eftirfarandi barni/börnum. Ef þú sérð ekki barnið þitt hér, þá bendum við þér að hafa samband við Þjóðskrá. \n\nAthugaðu að einungis er hægt að sækja um fyrir eitt barn í einu. Ef skrá á tvö börn svo sem tvíbura er hægt að fara beint í að skrá annað barn þegar búið er að skrá það fyrra.`, - description: `According to the Registers Iceland database you have the following children. If you do not see your child in this process, please contact the Registers Iceland. \n\nPlease note that you can only apply for one child at a time. If you have two children, such as twins, you can proceed to register the second child directly after completing the registration for the first one.`, + description: `According to Registers Iceland, you have custody of the following child/children. If you do not see your child here, please contact Registers Iceland. \n\nPlease note that you can only apply for one child at a time. If you want to register two children, such as twins, you can proceed to register the second child directly after completing the registration for the first one.`, }, childrenRadioTitle: { id: 'nps.application:prerequisites.childrenRadioTitle', @@ -241,9 +254,9 @@ export const newPrimarySchoolMessages: MessageDir = { parentsDescription: { id: 'nps.application:childrenNParents.parents.description', defaultMessage: - 'Upplýsingar um foreldra og forsjáraðila eru sóttar í Þjóðskrá. Athugaðu hvort símanúmer og netföng séu rétt skráð áður en þú heldur áfram.', + 'Upplýsingar um foreldra/forsjáraðila eru sóttar úr Þjóðskrá og af Mínum síðum á Island.is. Athugaðu hvort símanúmer og netföng séu rétt skráð áður en þú heldur áfram.', description: - 'Information about parents and guardians is retrieved from the National Register. Check that phone numbers and email addresses are entered correctly before proceeding.', + 'Information about parents/guardians is retrieved from Registers Iceland and from My Pages on Ísland.is. Check that phone numbers and email addresses are entered correctly before proceeding.', }, // Relatives @@ -304,63 +317,18 @@ export const newPrimarySchoolMessages: MessageDir = { defaultMessage: 'Barn á alltaf rétt á skólavist í sínum hverfisskóla. Séu ástæður umsóknar aðrar en flutningur lögheimilis getur verið að skólinn sjái sér ekki fært að taka á móti barninu. Það fer eftir aðstæðum í skólanum hverju sinni, svo sem rými.', description: - 'A child always has the right to attend school in his neighborhood school. If the reasons for the application are other than a change of legal residence, the school may not be able to accept the child. It depends on the situation in the school each time, such as space.', + 'A child always has the right to attend school in his district school. If the reasons for the application are other than a change of legal residence, the school may not be able to accept the child. It depends on the situation in the school each time, such as space.', }, reasonForApplicationPlaceholder: { id: 'nps.application:primary.school.reason.for.application.placeholder', defaultMessage: 'Veldu ástæðu', description: 'Select reason', }, - transferOfLegalDomicile: { - id: 'nps.application:primary.school.transfer.of.legal.domicile', - defaultMessage: 'Flutningur lögheimilis', - description: 'Transfer of legal domicile', - }, - studyStayForParents: { - id: 'nps.application:primary.school.study.stay.for.parents', - defaultMessage: 'Námsdvöl foreldra', - description: 'Study stay for parents', - }, - parentsParliamentaryMembership: { - id: 'nps.application:primary.school.parents.parliamentary.membership', - defaultMessage: 'Þingmennska foreldris', - description: "Parent's parliamentary membership", - }, - temporaryFoster: { - id: 'nps.application:primary.school.temporary.foster', - defaultMessage: 'Tímabundið fóstur', - description: 'Temporary foster', - }, - expertService: { - id: 'nps.application:primary.school.expert.service', - defaultMessage: 'Sérfræðiþjónusta', - description: 'Expert service', - }, - sickly: { - id: 'nps.application:primary.school.sickly', - defaultMessage: 'Sjúkralega', - description: 'Sickly', - }, - livesInTwoHomes: { - id: 'nps.application:primary.school.lives.in.two.homes', - defaultMessage: 'Býr á tveimur heimilum', - description: 'Lives in two homes', - }, - movingAbroad: { - id: 'nps.application:primary.school.moving.abroad', - defaultMessage: 'Flutningur erlendis', - description: 'Moving abroad', - }, - otherReasons: { - id: 'nps.application:primary.school.other.reasons', - defaultMessage: 'Aðrar ástæður', - description: 'Other reasons', - }, registerNewDomicileAlertMessage: { id: 'nps.application:primary.school.register.new.domicile.alert.message', defaultMessage: 'Minnum þig á að skrá nýtt lögheimili í Þjóðskrá.', description: - 'We remind you to register your new domicile in the National Registry.', + 'We remind you to register your new domicile in Registers Iceland.', }, country: { id: 'nps.application:primary.school.country', @@ -443,7 +411,7 @@ export const newPrimarySchoolMessages: MessageDir = { defaultMessage: 'Við viljum taka vel á móti skólabarninu. Til þess að getað undirbúið komu þess þá biðjum við þig að velja dagsetningu fyrir fyrsta skóladaginn.', description: - 'We want to welcome the schoolchild properly. To be able to prepare for its arrival, please select a date for the first school day.', + 'We want to properly welcome your child to the school. To prepare for their arrival, please select a date for the first school day.', }, }), @@ -468,7 +436,7 @@ export const newPrimarySchoolMessages: MessageDir = { languageDescription: { id: 'nps.application:different.needs.language.description', defaultMessage: - 'Til að hægt sé að koma til móts við þarfir barnsins þarf skólinn að vita hvaða tungumál eru töluð í nærumhverfi þess. Veldu þau tungumál, eitt eða flerir sem töluð eru dagsdaglega á heimilinu í samskiptum við eða í kringum barn.', + 'Til að hægt sé að koma til móts við þarfir barnsins þarf skólinn að vita hvaða tungumál eru töluð í nærumhverfi þess. Veldu þau tungumál, eitt eða fleiri sem töluð eru dagsdaglega á heimilinu í samskiptum við eða í kringum barn.', description: "In order to meet the child's needs, the school needs to know which languages ​​are spoken in their immediate environment. Choose the languages, one or more, that are spoken daily at home in communication with or around a child.", }, @@ -502,11 +470,6 @@ export const newPrimarySchoolMessages: MessageDir = { defaultMessage: 'Stuðningur', description: 'Support', }, - support: { - id: 'nps.application:different.needs.support', - defaultMessage: 'Stuðningur', - description: 'Support', - }, supportDescription: { id: 'nps.application:different.needs.support.description', defaultMessage: @@ -533,7 +496,7 @@ export const newPrimarySchoolMessages: MessageDir = { defaultMessage: 'Ef þú telur að grunnskólinn þurfi nánari upplýsingar um þarfir barnsins getur þú óskað eftir samtali. Skólinn mun setja sig í samband við þig, þegar nær dregur fyrsta skóladegi', description: - "If you believe that the elementary school needs more information about the child's needs, you can request a meeting. The school will contact you when the first day of school approaches.", + "If you believe that the primary school needs more information about the child's needs, you can request a meeting. The school will contact you when the first day of school approaches.", }, requestMeetingDescription: { id: 'nps.application:different.needs.request.meeting.info', @@ -572,7 +535,7 @@ export const newPrimarySchoolMessages: MessageDir = { parents: { id: 'nps.application:overview.parents', defaultMessage: 'Foreldri/forsjáraðili', - description: 'Parent / guardian', + description: 'Parent/guardian', }, nativeLanguage: { id: 'nps.application:overview.native.language', @@ -662,7 +625,7 @@ export const errorMessages = defineMessages({ nationalId: { id: 'nps.application:error.national.id', defaultMessage: 'Kennitala þarf að vera gild.', - description: 'Error message when the kennitala is invalid.', + description: 'National id must be valid', }, relativesRequired: { id: 'nps.application:error.relatives.required', diff --git a/libs/application/templates/new-primary-school/src/lib/newPrimarySchoolUtils.ts b/libs/application/templates/new-primary-school/src/lib/newPrimarySchoolUtils.ts index 540c61cf8198..b826696b299a 100644 --- a/libs/application/templates/new-primary-school/src/lib/newPrimarySchoolUtils.ts +++ b/libs/application/templates/new-primary-school/src/lib/newPrimarySchoolUtils.ts @@ -236,60 +236,6 @@ export const hasOtherParent = ( return !!otherParent } -export const getReasonForApplicationOptions = () => [ - { - value: ReasonForApplicationOptions.TRANSFER_OF_LEGAL_DOMICILE, - label: newPrimarySchoolMessages.primarySchool.transferOfLegalDomicile, - }, - { - value: ReasonForApplicationOptions.STUDY_STAY_FOR_PARENTS, - label: newPrimarySchoolMessages.primarySchool.studyStayForParents, - }, - { - value: ReasonForApplicationOptions.PARENTS_PARLIAMENTARY_MEMBERSHIP, - label: - newPrimarySchoolMessages.primarySchool.parentsParliamentaryMembership, - }, - { - value: ReasonForApplicationOptions.TEMPORARY_FROSTER, - label: newPrimarySchoolMessages.primarySchool.temporaryFoster, - }, - { - value: ReasonForApplicationOptions.EXPERT_SERVICE, - label: newPrimarySchoolMessages.primarySchool.expertService, - }, - { - value: ReasonForApplicationOptions.SICKLY, - label: newPrimarySchoolMessages.primarySchool.sickly, - }, - { - value: ReasonForApplicationOptions.LIVES_IN_TWO_HOMES, - label: newPrimarySchoolMessages.primarySchool.livesInTwoHomes, - }, - { - value: ReasonForApplicationOptions.SIBLINGS_IN_THE_SAME_PRIMARY_SCHOOL, - label: newPrimarySchoolMessages.primarySchool.siblingsTitle, - }, - { - value: ReasonForApplicationOptions.MOVING_ABROAD, - label: newPrimarySchoolMessages.primarySchool.movingAbroad, - }, - { - value: ReasonForApplicationOptions.OTHER_REASONS, - label: newPrimarySchoolMessages.primarySchool.otherReasons, - }, -] - -export const getReasonForApplicationOptionLabel = ( - value: ReasonForApplicationOptions, -) => { - const reasonForApplicationOptions = getReasonForApplicationOptions() - return ( - reasonForApplicationOptions.find((option) => option.value === value) - ?.label ?? '' - ) -} - export const getSiblingRelationOptions = () => [ { value: SiblingRelationOptions.SIBLING,