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): Implement school page #17384

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { buildSection } from '@island.is/application/core'
import { newPrimarySchoolMessages } from '../../../lib/messages'
import { newSchoolSubSection } from './newSchoolSubSection'
import { reasonForApplicationSubSection } from './reasonForApplicationSubSection'
import { schoolSubSection } from './schoolSubSection'
import { siblingsSubSection } from './siblingsSubSection'
import { startingSchoolSubSection } from './startingSchoolSubSection'

Expand All @@ -11,6 +12,7 @@ export const primarySchoolSection = buildSection({
children: [
reasonForApplicationSubSection,
siblingsSubSection,
schoolSubSection,
newSchoolSubSection,
startingSchoolSubSection,
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import {
buildMultiField,
buildRadioField,
buildSubSection,
NO,
YES,
} from '@island.is/application/core'
import { ReasonForApplicationOptions } from '../../../lib/constants'
import { newPrimarySchoolMessages } from '../../../lib/messages'
import {
getApplicationAnswers,
getCurrentSchoolName,
} from '../../../lib/newPrimarySchoolUtils'

export const schoolSubSection = buildSubSection({
id: 'schoolSubSection',
title: newPrimarySchoolMessages.primarySchool.schoolSubSectionTitle,
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: [
buildMultiField({
id: 'school',
title: newPrimarySchoolMessages.primarySchool.schoolSubSectionTitle,
description: newPrimarySchoolMessages.primarySchool.schoolDescription,
children: [
buildRadioField({
id: 'school.applyForNeighbourhoodSchool',
title: '',
required: true,
options: (application) => {
return [
{
label:
newPrimarySchoolMessages.primarySchool
.schoolApplyForNeighbourhoodSchoolLabel,
subLabel: {
id: 'newPrimarySchoolMessages.primarySchool.schoolApplyForNeighbourhoodSchoolSubLabel',
...newPrimarySchoolMessages.primarySchool
.schoolApplyForNeighbourhoodSchoolSubLabel,
values: {
currentSchoolName: getCurrentSchoolName(application),
},
},

value: YES,
},
{
label:
newPrimarySchoolMessages.primarySchool
.schoolApplyForOtherSchoolLabel,
subLabel:
newPrimarySchoolMessages.primarySchool
.schoolApplyForOtherSchoolSubLabel,
value: NO,
},
]
},
}),
],
}),
],
})
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ export const dataSchema = z.object({
path: ['transferOfLegalDomicile', 'postalCode'],
},
),
school: z.object({
applyForNeighbourhoodSchool: z.enum([YES, NO]),
}),
schools: z.object({
newSchool: z.object({
municipality: z.string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,42 @@ export const newPrimarySchoolMessages: MessageDir = {
description: 'Step sibling',
},

// School page
schoolSubSectionTitle: {
id: 'nps.application:primary.school.school.sub.section.title',
defaultMessage: 'Skóli',
description: 'School',
},
schoolDescription: {
id: 'nps.application:primary.school.school.sub.section.description',
defaultMessage:
'Börn eiga rétt á skólavist í því sveitarfélagi þar sem þau eru með skráð lögheimili. Einstaka sveitarfélög úthluta barni námsvist í hverfisskóla eða sem næst þeirra lögheimili. Í báðun tilfellum geta foreldrar sótt um annan skóla hvort sem er innan sveitarfélags eða utan. Ekki er þó víst að nýr skóli sjái sér fært að taka á móti barni. Er það ávalt háð aðstæðum hverju sinni.',
description:
'Children have the right to attend school in the municipality where they have their registered domicile. Some municipalities assign a child to a neighbourhood school or the school closest to their domicile. In both cases, parents can apply for another school, whether within the municipality or outside it. However, it is not certain that the new school will be able to accept the child. This is always subject to the circumstances at the time.',
},
schoolApplyForNeighbourhoodSchoolLabel: {
id: 'nps.application:primary.school.school.apply.for.neighbourhood.school.label',
defaultMessage: 'Staðfesta innritun í hverfisskóla',
description: 'Confirm enrolment in the neighbourhood school',
},
schoolApplyForNeighbourhoodSchoolSubLabel: {
id: 'nps.application:primary.school.school.apply.for.neighbourhood.school.sub.label',
defaultMessage: 'Hverfisskólinn ykkar er: {currentSchoolName}',
description: 'Your neighbourhood school is: {currentSchoolName}',
},
schoolApplyForOtherSchoolLabel: {
id: 'nps.application:primary.school.school.apply.for.other.school.label',
defaultMessage: 'Hafna innritun í hverfisskóla',
description: 'Decline enrolment in the neighbourhood school',
},
schoolApplyForOtherSchoolSubLabel: {
id: 'nps.application:primary.school.school.apply.for.other.school.sub.label',
defaultMessage:
'Þú getur sótt um fyrir barnið þitt í skóla utan þíns skólahverfis, en ekki er víst að skólinn geti tekið við barninu.',
description:
'You can apply for your child to attend a school outside your school district, but it is not certain that the school will be able to accept your child.',
},

// Apply to a new school
newSchoolSubSectionTitle: {
id: 'nps.application:primary.school.new.school.sub.section.title',
Expand Down
Loading