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

feat(new-primary-school): Add temporary application type and remove "Moving abroad" #17556

Merged
merged 18 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
b4f3937
[TS-953] Update Reason page - Removed 'Moving Abroad'
veronikasif Jan 17, 2025
ed8e16d
[TS-967] Add mock application type
veronikasif Jan 17, 2025
8f92807
Merge branch 'main' into feat/new-primary-school-mock-application-type
veronikasif Jan 20, 2025
647d5f0
Hide application type page on prod
veronikasif Jan 20, 2025
c20a2c4
Move applicationType condition
veronikasif Jan 21, 2025
99efa7c
Merge branch 'main' into feat/new-primary-school-mock-application-type
veronikasif Jan 21, 2025
e1429b2
Merge branch 'main' into feat/new-primary-school-mock-application-type
veronikasif Jan 21, 2025
630cb7b
Merge branch 'main' into feat/new-primary-school-mock-application-type
veronikasif Jan 22, 2025
99b69d8
Merge branch 'main' into feat/new-primary-school-mock-application-type
veronikasif Jan 22, 2025
2c8123c
Merge branch 'main' into feat/new-primary-school-mock-application-type
veronikasif Jan 22, 2025
3520121
chore: nx run-many --target lint --fix --parallel 3 --projects=api,ap…
andes-it Jan 22, 2025
da6997e
Merge branch 'main' into feat/new-primary-school-mock-application-type
veronikasif Jan 22, 2025
74b6c73
Merge branch 'main' into feat/new-primary-school-mock-application-type
birkirkristmunds Jan 23, 2025
33a853f
Merge branch 'main' into feat/new-primary-school-mock-application-type
veronikasif Jan 23, 2025
e53d84a
Merge branch 'main' into feat/new-primary-school-mock-application-type
veronikasif Jan 23, 2025
0fedb0a
Merge branch 'main' into feat/new-primary-school-mock-application-type
veronikasif Jan 23, 2025
a258b4b
Merge branch 'main' into feat/new-primary-school-mock-application-type
veronikasif Jan 23, 2025
edba9a3
Merge branch 'main' into feat/new-primary-school-mock-application-type
veronikasif Jan 23, 2025
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 @@ -20,7 +20,6 @@ export const transformApplicationToNewPrimarySchoolDTO = (
siblings,
contacts,
reasonForApplication,
reasonForApplicationCountry,
reasonForApplicationStreetAddress,
reasonForApplicationPostalCode,
selectedSchool,
Expand Down Expand Up @@ -113,15 +112,9 @@ export const transformApplicationToNewPrimarySchoolDTO = (
agents,
registration: {
defaultOrg: primaryOrgId,
...(reasonForApplication !== ReasonForApplicationOptions.MOVING_ABROAD
? {
selectedOrg: selectedSchool,
requestingMeeting: requestMeeting === YES,
expectedStartDate: new Date(startDate),
}
: {
movingAbroadCountry: reasonForApplicationCountry,
}),
selectedOrg: selectedSchool,
requestingMeeting: requestMeeting === YES,
expectedStartDate: new Date(startDate),
veronikasif marked this conversation as resolved.
Show resolved Hide resolved
reason: reasonForApplication,
...(reasonForApplication ===
ReasonForApplicationOptions.MOVING_MUNICIPALITY
Expand All @@ -133,20 +126,16 @@ export const transformApplicationToNewPrimarySchoolDTO = (
}
: {}),
},
...(reasonForApplication !== ReasonForApplicationOptions.MOVING_ABROAD
? {
social: {
hasHadSupport: specialSupport === YES,
hasDiagnoses: developmentalAssessment === YES,
},
language: {
nativeLanguage: nativeLanguage,
noIcelandic,
otherLanguages:
otherLanguagesSpokenDaily === YES ? otherLanguages : undefined,
},
}
: {}),
social: {
hasHadSupport: specialSupport === YES,
hasDiagnoses: developmentalAssessment === YES,
},
language: {
nativeLanguage: nativeLanguage,
noIcelandic,
otherLanguages:
otherLanguagesSpokenDaily === YES ? otherLanguages : undefined,
},
}

return newPrimarySchoolDTO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,23 @@ import { useLocale } from '@island.is/localization'
import get from 'lodash/get'
import has from 'lodash/has'
import { FC } from 'react'
import { ReasonForApplicationOptions, States } from '../../lib/constants'
import {
ApplicationType,
ReasonForApplicationOptions,
States,
} from '../../lib/constants'
import { newPrimarySchoolMessages } from '../../lib/messages'
import { getApplicationAnswers } from '../../lib/newPrimarySchoolUtils'

import { AllergiesAndIntolerances } from './review-groups/AllergiesAndIntolerances'
import { Child } from './review-groups/Child'
import { Contacts } from './review-groups/Contacts'
import { CurrentSchool } from './review-groups/CurrentSchool'
import { FreeSchoolMeal } from './review-groups/FreeSchoolMeal'
import { Languages } from './review-groups/Languages'
import { Parents } from './review-groups/Parents'
import { ReasonForApplication } from './review-groups/ReasonForApplication'
import { Contacts } from './review-groups/Contacts'
import { School } from './review-groups/School'
import { CurrentSchool } from './review-groups/CurrentSchool'
import { Siblings } from './review-groups/Siblings'
import { Support } from './review-groups/Support'

Expand All @@ -48,7 +52,9 @@ export const Review: FC<ReviewScreenProps> = ({
const editable = field.props?.editable ?? false
const hasError = (id: string) => get(errors, id) as string

const { reasonForApplication } = getApplicationAnswers(application.answers)
const { applicationType, reasonForApplication } = getApplicationAnswers(
application.answers,
)

const groupHasNoErrors = (ids: string[]) =>
ids.every((id) => !has(errors, id))
Expand Down Expand Up @@ -159,21 +165,21 @@ export const Review: FC<ReviewScreenProps> = ({
<Child {...childProps} />
<Parents {...childProps} />
<Contacts {...childProps} />
<CurrentSchool {...childProps} />
{applicationType === ApplicationType.NEW_PRIMARY_SCHOOL && (
<CurrentSchool {...childProps} />
)}
<School {...childProps} />
<ReasonForApplication {...childProps} />
{reasonForApplication !== ReasonForApplicationOptions.MOVING_ABROAD && (
<>
{reasonForApplication ===
ReasonForApplicationOptions.SIBLINGS_IN_SAME_SCHOOL && (
<Siblings {...childProps} />
)}
<School {...childProps} />
<Languages {...childProps} />
<FreeSchoolMeal {...childProps} />
<AllergiesAndIntolerances {...childProps} />
<Support {...childProps} />
</>
{reasonForApplication ===
ReasonForApplicationOptions.SIBLINGS_IN_SAME_SCHOOL && (
<Siblings {...childProps} />
)}
<Languages {...childProps} />
<FreeSchoolMeal {...childProps} />
{applicationType === ApplicationType.ENROLLMENT_IN_PRIMARY_SCHOOL && (
<AllergiesAndIntolerances {...childProps} />
)}
<Support {...childProps} />
</>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const Child = ({
>
<Stack space={2}>
<GridRow>
<GridColumn span={['12/12', '12/12', '12/12', '12/12']}>
<GridColumn span="12/12">
veronikasif marked this conversation as resolved.
Show resolved Hide resolved
<Text variant="h3" as="h3">
{formatMessage(newPrimarySchoolMessages.overview.child)}
</Text>
Expand Down Expand Up @@ -102,7 +102,7 @@ export const Child = ({
</GridColumn>
)}
{childInfo.pronouns?.length > 0 && (
<GridColumn span={['12/12', '12/12', '12/12', '12/12']}>
<GridColumn span="12/12">
<DataValue
label={formatMessage(
newPrimarySchoolMessages.childrenNParents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const Contacts = ({
<SkeletonLoader height={40} width="80%" borderRadius="large" />
) : (
<GridRow>
<GridColumn span={['12/12', '12/12', '12/12', '12/12']}>
<GridColumn span="12/12">
<Label>
{formatMessage(
newPrimarySchoolMessages.childrenNParents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const CurrentSchool = ({
>
<Stack space={2}>
<GridRow>
<GridColumn span={['12/12', '12/12', '12/12', '12/12']}>
<GridColumn span="10/12">
veronikasif marked this conversation as resolved.
Show resolved Hide resolved
<Text variant="h3" as="h3">
{formatMessage(
newPrimarySchoolMessages.primarySchool
Expand All @@ -32,7 +32,7 @@ export const CurrentSchool = ({
<GridColumn span={['12/12', '12/12', '12/12', '5/12']}>
<DataValue
label={formatMessage(
newPrimarySchoolMessages.primarySchool.currentSchoolInfo,
newPrimarySchoolMessages.primarySchool.currentSchool,
)}
value={getCurrentSchoolName(application)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const Languages = ({
>
<Stack space={2}>
<GridRow>
<GridColumn span={['12/12', '12/12', '12/12', '12/12']}>
<GridColumn span="12/12">
<DataValue
label={formatMessage(
newPrimarySchoolMessages.overview.nativeLanguage,
Expand All @@ -44,7 +44,7 @@ export const Languages = ({
</GridColumn>
</GridRow>
<GridRow>
<GridColumn span={['12/12', '12/12', '12/12', '12/12']}>
<GridColumn span="12/12">
<RadioValue
label={formatMessage(
newPrimarySchoolMessages.differentNeeds
Expand All @@ -57,7 +57,7 @@ export const Languages = ({
{otherLanguagesSpokenDaily === YES && (
<>
<GridRow>
<GridColumn span={['12/12', '12/12', '12/12', '12/12']}>
<GridColumn span="12/12">
<DataValue
label={formatMessage(
newPrimarySchoolMessages.differentNeeds.languageTitle,
Expand All @@ -73,7 +73,7 @@ export const Languages = ({
{!icelandicSelected &&
icelandicNotSpokenAroundChild?.includes(YES) && (
<GridRow>
<GridColumn span={['12/12', '12/12', '12/12', '12/12']}>
<GridColumn span="12/12">
<DataValue
label={formatMessage(
newPrimarySchoolMessages.overview
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const Parents = ({
>
<Stack space={2}>
<GridRow>
<GridColumn span={['12/12', '12/12', '12/12', '12/12']}>
<GridColumn span="12/12">
<Text variant="h3" as="h3">
{formatMessage(newPrimarySchoolMessages.overview.parents)}{' '}
{index + 1}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
Stack,
} from '@island.is/island-ui/core'
import { useLocale } from '@island.is/localization'
import { getCountryByCode } from '@island.is/shared/utils'
import { useFriggOptions } from '../../../hooks/useFriggOptions'
import {
OptionsType,
Expand All @@ -25,10 +24,9 @@ export const ReasonForApplication = ({
editable,
goToScreen,
}: ReviewGroupProps) => {
const { formatMessage, lang } = useLocale()
const { formatMessage } = useLocale()
const {
reasonForApplication,
reasonForApplicationCountry,
reasonForApplicationStreetAddress,
reasonForApplicationPostalCode,
} = getApplicationAnswers(application.answers)
Expand All @@ -50,7 +48,7 @@ export const ReasonForApplication = ({
) : (
<Stack space={2}>
<GridRow>
<GridColumn span={['12/12', '12/12', '12/12', '12/12']}>
<GridColumn span="12/12">
<DataValue
label={formatMessage(
newPrimarySchoolMessages.primarySchool
Expand All @@ -70,23 +68,6 @@ export const ReasonForApplication = ({
/>
</GridColumn>
</GridRow>
{reasonForApplication ===
ReasonForApplicationOptions.MOVING_ABROAD && (
<GridRow>
<GridColumn span={['12/12', '12/12', '12/12', '12/12']}>
<DataValue
label={formatMessage(
newPrimarySchoolMessages.primarySchool.country,
)}
value={
lang === 'is'
? getCountryByCode(reasonForApplicationCountry)?.name_is
: getCountryByCode(reasonForApplicationCountry)?.name
}
/>
</GridColumn>
</GridRow>
)}
{reasonForApplication ===
ReasonForApplicationOptions.MOVING_MUNICIPALITY && (
<GridRow rowGap={2}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ import {
} from '../../../lib/newPrimarySchoolUtils'
import { FriggSchoolsByMunicipalityQuery } from '../../../types/schema'
import { ReviewGroupProps } from './props'
import { ApplicationType } from '../../../lib/constants'

export const School = ({
application,
editable,
goToScreen,
}: ReviewGroupProps) => {
const { formatMessage, formatDate, lang } = useLocale()
const { startDate, selectedSchool } = getApplicationAnswers(
const { applicationType, startDate, selectedSchool } = getApplicationAnswers(
application.answers,
)
const { childGradeLevel } = getApplicationExternalData(
Expand All @@ -49,7 +50,7 @@ export const School = ({
>
<Stack space={2}>
<GridRow>
<GridColumn span={['12/12', '12/12', '12/12', '12/12']}>
<GridColumn span="12/12">
<Text variant="h3" as="h3">
{formatMessage(newPrimarySchoolMessages.overview.schoolTitle)}
</Text>
Expand Down Expand Up @@ -88,14 +89,16 @@ export const School = ({
/>
</GridColumn>
</GridRow>
<GridRow rowGap={2}>
<GridColumn span={['12/12', '12/12', '12/12', '5/12']}>
<DataValue
label={formatMessage(newPrimarySchoolMessages.shared.date)}
value={formatDate(startDate)}
/>
</GridColumn>
</GridRow>
{applicationType === ApplicationType.NEW_PRIMARY_SCHOOL && (
<GridRow>
<GridColumn span={['12/12', '12/12', '12/12', '5/12']}>
<DataValue
label={formatMessage(newPrimarySchoolMessages.shared.date)}
value={formatDate(startDate)}
/>
</GridColumn>
</GridRow>
)}
</>
)}
</Stack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const Siblings = ({
editAction={() => goToScreen?.('siblings')}
>
<GridRow>
<GridColumn span={['12/12', '12/12', '12/12', '12/12']}>
<GridColumn span="12/12">
<Label>
{formatMessage(
newPrimarySchoolMessages.primarySchool.siblingsTitle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
buildSubSection,
} from '@island.is/application/core'
import { NO, YES } from '@island.is/application/types'
import { OptionsType } from '../../../lib/constants'
import { ApplicationType, OptionsType } from '../../../lib/constants'
import { newPrimarySchoolMessages } from '../../../lib/messages'
import { getApplicationAnswers } from '../../../lib/newPrimarySchoolUtils'

Expand All @@ -16,6 +16,11 @@ export const allergiesAndIntolerancesSubSection = buildSubSection({
title:
newPrimarySchoolMessages.differentNeeds
.allergiesAndIntolerancesSubSectionTitle,
condition: (answers) => {
// Only display section if application type is "Enrollment in primary school"
const { applicationType } = getApplicationAnswers(answers)
return applicationType === ApplicationType.ENROLLMENT_IN_PRIMARY_SCHOOL
},
children: [
buildMultiField({
id: 'allergiesAndIntolerances',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { buildSection } from '@island.is/application/core'
import { ReasonForApplicationOptions } from '../../../lib/constants'
import { newPrimarySchoolMessages } from '../../../lib/messages'
import { getApplicationAnswers } from '../../../lib/newPrimarySchoolUtils'
import { allergiesAndIntolerancesSubSection } from './allergiesAndIntolerancesSubSection'
import { freeSchoolMealSubSection } from './freeSchoolMealSubSection'
import { languageSubSection } from './languageSubSection'
Expand All @@ -10,11 +8,6 @@ import { supportSubSection } from './supportSubSection'
export const differentNeedsSection = buildSection({
id: 'differentNeedsSection',
title: newPrimarySchoolMessages.differentNeeds.sectionTitle,
condition: (answers) => {
// Only display section if "Moving abroad" is not selected as reason for application
const { reasonForApplication } = getApplicationAnswers(answers)
return reasonForApplication !== ReasonForApplicationOptions.MOVING_ABROAD
},
children: [
languageSubSection,
freeSchoolMealSubSection,
Expand Down
Loading
Loading