diff --git a/apps/judicial-system/backend/src/app/formatters/indictmentPdf.ts b/apps/judicial-system/backend/src/app/formatters/indictmentPdf.ts index f6ac73e56483..b181833db9ec 100644 --- a/apps/judicial-system/backend/src/app/formatters/indictmentPdf.ts +++ b/apps/judicial-system/backend/src/app/formatters/indictmentPdf.ts @@ -118,7 +118,7 @@ export const createIndictment = async ( lowercase(theCase.prosecutorsOffice?.name) .replace('lögreglustjórinn', 'lögreglustjórans') .replace('saksóknari', 'saksóknara') ?? '', - date: formatDate(nowFactory(), 'PPP'), + date: formatDate(confirmation?.date || nowFactory(), 'PPP'), }), ) diff --git a/libs/application/core/src/lib/fieldBuilders.ts b/libs/application/core/src/lib/fieldBuilders.ts index 3633acc6de57..87092d29dd1e 100644 --- a/libs/application/core/src/lib/fieldBuilders.ts +++ b/libs/application/core/src/lib/fieldBuilders.ts @@ -76,6 +76,7 @@ const extractCommonFields = ( nextButtonText, marginBottom, marginTop, + clearOnChange, } = data return { @@ -91,6 +92,7 @@ const extractCommonFields = ( nextButtonText, marginBottom, marginTop, + clearOnChange, } } 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 54ad8abdd655..9164d348ceb8 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,12 +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 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', })) : []), @@ -113,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 ? { @@ -126,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 6a643161b0e3..ac1f8ec97c8d 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 @@ -16,7 +16,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 033a8a664365..f737748e29de 100644 --- a/libs/application/templates/new-primary-school/src/lib/constants.ts +++ b/libs/application/templates/new-primary-school/src/lib/constants.ts @@ -26,23 +26,16 @@ 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 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 9dcce96ee1cd..3d0985055dfb 100644 --- a/libs/application/templates/new-primary-school/src/lib/dataSchema.ts +++ b/libs/application/templates/new-primary-school/src/lib/dataSchema.ts @@ -73,7 +73,7 @@ export const dataSchema = z.object({ }), reasonForApplication: z .object({ - reason: z.nativeEnum(ReasonForApplicationOptions), + reason: z.string(), movingAbroad: z .object({ country: z.string().optional(), @@ -97,7 +97,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, @@ -107,7 +107,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 255c0431327b..a6bbd987ed2d 100644 --- a/libs/application/templates/new-primary-school/src/lib/newPrimarySchoolUtils.ts +++ b/libs/application/templates/new-primary-school/src/lib/newPrimarySchoolUtils.ts @@ -18,7 +18,6 @@ import { SiblingsRow, } from '../types' import { ReasonForApplicationOptions } from './constants' -import { newPrimarySchoolMessages } from './messages' export const getApplicationAnswers = (answers: Application['answers']) => { const childNationalId = getValueViaPath(answers, 'childNationalId') as string @@ -233,60 +232,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 getSelectedOptionLabel = ( options: SelectOption[], key?: string, diff --git a/libs/application/templates/reference-template/src/forms/exampleForm/commonActionsSection/clearOnChangeSubsection.ts b/libs/application/templates/reference-template/src/forms/exampleForm/commonActionsSection/clearOnChangeSubsection.ts new file mode 100644 index 000000000000..3972bf1c6511 --- /dev/null +++ b/libs/application/templates/reference-template/src/forms/exampleForm/commonActionsSection/clearOnChangeSubsection.ts @@ -0,0 +1,124 @@ +import { + buildAsyncSelectField, + buildCheckboxField, + buildDateField, + buildDescriptionField, + buildDividerField, + buildMultiField, + buildNationalIdWithNameField, + buildPhoneField, + buildRadioField, + buildSelectField, + buildSubSection, + buildTextField, +} from '@island.is/application/core' +import { FriggSchoolsByMunicipality } from '../../../utils/types' +import { friggSchoolsByMunicipalityQuery } from '../../../graphql/sampleQuery' + +export const clearOnChangeSubsection = buildSubSection({ + id: 'clearOnChangeSubsection', + title: 'Clear on change', + children: [ + buildMultiField({ + id: 'clearOnChangeMultiField', + title: 'Clear on change', + children: [ + buildDescriptionField({ + id: 'descriptionField', + title: '', + description: `Clear on change allows a field to clear other fields when its value or selection changes. + Below are some examples of fields that will clear the bottom field when changed. + Note that the fields that are cleared can be anywhere in the application, not just on the same screen.`, + }), + buildDescriptionField({ + id: 'descriptionField2', + title: '', + description: `To try it out simply enter some text in the bottom text field + and change the selections in any of the other fields.`, + }), + buildAsyncSelectField({ + id: 'asyncSelectField', + title: 'Async Select', + loadingError: 'Loading error', + clearOnChange: ['clearableTextField'], + loadOptions: async ({ apolloClient }) => { + const { data } = + await apolloClient.query({ + query: friggSchoolsByMunicipalityQuery, + }) + + return ( + data?.friggSchoolsByMunicipality?.map((municipality) => ({ + value: municipality.name, + label: municipality.name, + })) ?? [] + ) + }, + }), + + buildSelectField({ + id: 'selectField', + title: 'Select', + clearOnChange: ['clearableTextField'], + options: [ + { value: 'option1', label: 'Option 1' }, + { value: 'option2', label: 'Option 2' }, + ], + }), + + buildPhoneField({ + id: 'phoneField', + title: 'Phone Field', + clearOnChange: ['clearableTextField'], + }), + + buildDateField({ + id: 'dateField', + title: 'Date Field', + clearOnChange: ['clearableTextField'], + }), + + buildTextField({ + id: 'textField', + title: 'Text Field', + clearOnChange: ['clearableTextField'], + }), + + buildRadioField({ + id: 'radioField', + title: 'Radio Field', + clearOnChange: ['clearableTextField'], + options: [ + { value: 'option1', label: 'Option 1' }, + { value: 'option2', label: 'Option 2' }, + ], + }), + + buildCheckboxField({ + id: 'checkboxField', + title: 'Checkbox Field', + marginTop: 2, + clearOnChange: ['clearableTextField'], + options: [ + { value: 'option1', label: 'Option 1' }, + { value: 'option2', label: 'Option 2' }, + ], + }), + + buildNationalIdWithNameField({ + id: 'nationalIdWithNameField', + title: 'NationalId With Name Field', + clearOnChange: ['clearableTextField'], + }), + + buildDividerField({}), + + buildTextField({ + id: 'clearableTextField', + title: 'Clearable TextField', + placeholder: 'Text entered here will be cleared', + }), + ], + }), + ], +}) diff --git a/libs/application/templates/reference-template/src/forms/exampleForm/commonActionsSection/index.ts b/libs/application/templates/reference-template/src/forms/exampleForm/commonActionsSection/index.ts index f58a19aa98d8..9b79b65dabe6 100644 --- a/libs/application/templates/reference-template/src/forms/exampleForm/commonActionsSection/index.ts +++ b/libs/application/templates/reference-template/src/forms/exampleForm/commonActionsSection/index.ts @@ -3,6 +3,7 @@ import { conditionsSubsection } from './conditionsSubsection' import { conditions2Subsection } from './conditions2Subsection' import { getDataFromExternalDataSubsection } from './getDataFromExternalDataSection' import { validationSubsection } from './validadionSubsection' +import { clearOnChangeSubsection } from './clearOnChangeSubsection' export const commonActionsSection = buildSection({ id: 'commonActions', @@ -10,6 +11,7 @@ export const commonActionsSection = buildSection({ children: [ getDataFromExternalDataSubsection, validationSubsection, + clearOnChangeSubsection, conditionsSubsection, conditions2Subsection, ], diff --git a/libs/application/types/src/lib/Fields.ts b/libs/application/types/src/lib/Fields.ts index 09a6ddd0d74e..5464a471ffa9 100644 --- a/libs/application/types/src/lib/Fields.ts +++ b/libs/application/types/src/lib/Fields.ts @@ -222,6 +222,7 @@ export interface BaseField extends FormItem { doesNotRequireAnswer?: boolean marginBottom?: BoxProps['marginBottom'] marginTop?: BoxProps['marginTop'] + clearOnChange?: string[] // TODO use something like this for non-schema validation? // validate?: (formValue: FormValue, context?: object) => boolean diff --git a/libs/application/types/src/lib/Form.ts b/libs/application/types/src/lib/Form.ts index b110eea336b7..05dce94539c8 100644 --- a/libs/application/types/src/lib/Form.ts +++ b/libs/application/types/src/lib/Form.ts @@ -186,6 +186,7 @@ export interface FieldBaseProps { field: Field application: Application showFieldName?: boolean + clearOnChange?: string[] goToScreen?: (id: string) => void answerQuestions?: (answers: FormValue) => void refetch?: () => void diff --git a/libs/application/ui-components/src/components/NationalIdWithName/NationalIdWithName.tsx b/libs/application/ui-components/src/components/NationalIdWithName/NationalIdWithName.tsx index f59189a2d813..8cb71b7a5276 100644 --- a/libs/application/ui-components/src/components/NationalIdWithName/NationalIdWithName.tsx +++ b/libs/application/ui-components/src/components/NationalIdWithName/NationalIdWithName.tsx @@ -43,6 +43,7 @@ interface NationalIdWithNameProps { showPhoneField?: boolean showEmailField?: boolean error?: string + clearOnChange?: string[] } export const NationalIdWithName: FC< @@ -72,6 +73,7 @@ export const NationalIdWithName: FC< showPhoneField = false, showEmailField = false, error, + clearOnChange, }) => { const fieldId = customId.length > 0 ? customId : id const nameField = `${fieldId}.name` @@ -233,6 +235,7 @@ export const NationalIdWithName: FC< loading={searchPersons ? queryLoading : companyQueryLoading} error={nationalIdFieldErrors} disabled={disabled} + clearOnChange={clearOnChange} /> diff --git a/libs/application/ui-fields/src/lib/AsyncSelectFormField/AsyncSelectFormField.tsx b/libs/application/ui-fields/src/lib/AsyncSelectFormField/AsyncSelectFormField.tsx index 60884de595a8..47a77c8ec37c 100644 --- a/libs/application/ui-fields/src/lib/AsyncSelectFormField/AsyncSelectFormField.tsx +++ b/libs/application/ui-fields/src/lib/AsyncSelectFormField/AsyncSelectFormField.tsx @@ -40,6 +40,7 @@ export const AsyncSelectFormField: FC> = ({ isSearchable, isMulti, required = false, + clearOnChange, } = field const { formatMessage, lang: locale } = useLocale() const apolloClient = useApolloClient() @@ -111,6 +112,7 @@ export const AsyncSelectFormField: FC> = ({ backgroundColor={backgroundColor} isSearchable={isSearchable} isMulti={isMulti} + clearOnChange={clearOnChange} /> diff --git a/libs/application/ui-fields/src/lib/BankAccountFormField/BankAccountFormField.tsx b/libs/application/ui-fields/src/lib/BankAccountFormField/BankAccountFormField.tsx index 22d9b062d4f7..3d71f552c4c1 100644 --- a/libs/application/ui-fields/src/lib/BankAccountFormField/BankAccountFormField.tsx +++ b/libs/application/ui-fields/src/lib/BankAccountFormField/BankAccountFormField.tsx @@ -13,7 +13,8 @@ interface Props extends FieldBaseProps { } export const BankAccountFormField = ({ field, application }: Props) => { const { formatMessage, lang: locale } = useLocale() - const { marginBottom, marginTop, title, titleVariant, id } = field + const { marginBottom, marginTop, title, titleVariant, id, clearOnChange } = + field const bankNumber = formatText( coreDefaultFieldMessages.defaultBankAccountBankNumber, application, @@ -49,6 +50,7 @@ export const BankAccountFormField = ({ field, application }: Props) => { format="####" backgroundColor="blue" autoFocus + clearOnChange={clearOnChange} /> @@ -61,6 +63,7 @@ export const BankAccountFormField = ({ field, application }: Props) => { placeholder="00" format="##" backgroundColor="blue" + clearOnChange={clearOnChange} /> @@ -73,6 +76,7 @@ export const BankAccountFormField = ({ field, application }: Props) => { placeholder="000000" format="######" backgroundColor="blue" + clearOnChange={clearOnChange} /> diff --git a/libs/application/ui-fields/src/lib/CheckboxFormField/CheckboxFormField.tsx b/libs/application/ui-fields/src/lib/CheckboxFormField/CheckboxFormField.tsx index 01c37e6dbe44..25bf118b5cbd 100644 --- a/libs/application/ui-fields/src/lib/CheckboxFormField/CheckboxFormField.tsx +++ b/libs/application/ui-fields/src/lib/CheckboxFormField/CheckboxFormField.tsx @@ -43,6 +43,7 @@ export const CheckboxFormField = ({ spacing, marginTop, marginBottom, + clearOnChange, } = field const { formatMessage, lang: locale } = useLocale() @@ -107,6 +108,7 @@ export const CheckboxFormField = ({ }), }), )} + clearOnChange={clearOnChange} /> diff --git a/libs/application/ui-fields/src/lib/DateFormField/DateFormField.tsx b/libs/application/ui-fields/src/lib/DateFormField/DateFormField.tsx index 90724ad6630a..4b1a45eda17b 100644 --- a/libs/application/ui-fields/src/lib/DateFormField/DateFormField.tsx +++ b/libs/application/ui-fields/src/lib/DateFormField/DateFormField.tsx @@ -47,6 +47,7 @@ export const DateFormField: FC> = ({ readOnly, marginTop, marginBottom, + clearOnChange, } = field const { formatMessage, lang } = useLocale() @@ -155,6 +156,7 @@ export const DateFormField: FC> = ({ } error={error} onChange={onChange} + clearOnChange={clearOnChange} /> diff --git a/libs/application/ui-fields/src/lib/DisplayFormField/DisplayFormField.tsx b/libs/application/ui-fields/src/lib/DisplayFormField/DisplayFormField.tsx index 85d4480880a2..87a31348c6b3 100644 --- a/libs/application/ui-fields/src/lib/DisplayFormField/DisplayFormField.tsx +++ b/libs/application/ui-fields/src/lib/DisplayFormField/DisplayFormField.tsx @@ -22,6 +22,7 @@ export const DisplayFormField = ({ field, application }: Props) => { suffix, rightAlign = false, halfWidthOwnline = false, + clearOnChange, } = field const { watch, setValue } = useFormContext() const allValues = watch() @@ -90,6 +91,7 @@ export const DisplayFormField = ({ field, application }: Props) => { ? undefined : variant } + clearOnChange={clearOnChange} /> diff --git a/libs/application/ui-fields/src/lib/FindVehicleFormField/FindVehicleFormField.tsx b/libs/application/ui-fields/src/lib/FindVehicleFormField/FindVehicleFormField.tsx index 8d1371d91093..d1a8402df506 100644 --- a/libs/application/ui-fields/src/lib/FindVehicleFormField/FindVehicleFormField.tsx +++ b/libs/application/ui-fields/src/lib/FindVehicleFormField/FindVehicleFormField.tsx @@ -161,6 +161,7 @@ export const FindVehicleFormField: FC> = ({ energyFundsMessages, marginTop, marginBottom, + clearOnChange, } = field const [plate, setPlate] = useState( @@ -388,6 +389,7 @@ export const FindVehicleFormField: FC> = ({ }, }} maxLength={isMachine ? 7 : 5} + clearOnChange={clearOnChange} />