-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
chore(financial-aid): refactor student and employment screens (#17553)
Showing
11 changed files
with
253 additions
and
328 deletions.
There are no files selected for viewing
96 changes: 0 additions & 96 deletions
96
libs/application/templates/financial-aid/src/fields/EmploymentForm/EmploymentForm.tsx
This file was deleted.
Oops, something went wrong.
72 changes: 0 additions & 72 deletions
72
libs/application/templates/financial-aid/src/fields/StudentForm/StudentForm.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...inancial-aid/src/forms/ApplicationForm/personalInterestSection/childrenFilesSubsection.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { buildCustomField } from '@island.is/application/core' | ||
import { buildSubSection } from '@island.is/application/core' | ||
import { Routes } from '../../../lib/constants' | ||
import { hasChildren } from '../../../utils/conditions' | ||
import * as m from '../../../lib/messages' | ||
|
||
export const childrenFilesSubsection = buildSubSection({ | ||
condition: hasChildren, | ||
id: Routes.CHILDRENFILES, | ||
title: m.childrenFilesForm.general.sectionTitle, | ||
children: [ | ||
buildCustomField({ | ||
id: Routes.CHILDRENFILES, | ||
title: m.childrenFilesForm.general.pageTitle, | ||
component: 'ChildrenFilesForm', | ||
}), | ||
], | ||
}) |
18 changes: 18 additions & 0 deletions
18
...ial-aid/src/forms/ApplicationForm/personalInterestSection/childrenSchoolInfoSubsection.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { buildCustomField } from '@island.is/application/core' | ||
import { buildSubSection } from '@island.is/application/core' | ||
import { Routes } from '../../../lib/constants' | ||
import { hasChildren } from '../../../utils/conditions' | ||
import * as m from '../../../lib/messages' | ||
|
||
export const childrenSchoolInfoSubsection = buildSubSection({ | ||
condition: hasChildren, | ||
id: Routes.CHILDRENSCHOOLINFO, | ||
title: m.childrenForm.general.sectionTitle, | ||
children: [ | ||
buildCustomField({ | ||
id: Routes.CHILDRENSCHOOLINFO, | ||
title: m.childrenForm.general.pageTitle, | ||
component: 'ChildrenForm', | ||
}), | ||
], | ||
}) |
37 changes: 37 additions & 0 deletions
37
...s/financial-aid/src/forms/ApplicationForm/personalInterestSection/employmentSubsection.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { | ||
buildMultiField, | ||
buildRadioField, | ||
buildSubSection, | ||
buildTextField, | ||
} from '@island.is/application/core' | ||
import { Routes } from '../../../lib/constants' | ||
import * as m from '../../../lib/messages' | ||
import { employmentOptions } from '../../../utils/options' | ||
import { otherEmployment } from '../../../utils/conditions' | ||
|
||
export const employmentSubsection = buildSubSection({ | ||
id: Routes.EMPLOYMENT, | ||
title: m.employmentForm.general.sectionTitle, | ||
children: [ | ||
buildMultiField({ | ||
id: 'employmentMultiField', | ||
title: m.employmentForm.general.pageTitle, | ||
children: [ | ||
buildRadioField({ | ||
id: 'employment.type', | ||
title: '', | ||
options: employmentOptions, | ||
marginBottom: 2, | ||
}), | ||
buildTextField({ | ||
condition: otherEmployment, | ||
id: 'employment.custom', | ||
title: m.input.label, | ||
required: true, | ||
variant: 'textarea', | ||
rows: 8, | ||
}), | ||
], | ||
}), | ||
], | ||
}) |
81 changes: 10 additions & 71 deletions
81
...cation/templates/financial-aid/src/forms/ApplicationForm/personalInterestSection/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,23 @@ | ||
import { | ||
buildCustomField, | ||
buildSection, | ||
buildSubSection, | ||
getValueViaPath, | ||
} from '@island.is/application/core' | ||
import * as m from '../../../lib/messages' | ||
import { Routes } from '../../../lib/constants' | ||
import { ApplicantChildCustodyInformation } from '@island.is/application/types' | ||
import { buildSection } from '@island.is/application/core' | ||
import { inRelationshipSubsection } from './inRelationshipSubsection' | ||
import { unknownRelationshipSubsection } from './unknownRelationshipSubsection' | ||
import { homeCircumstancesSubsection } from './homeCircumstancesSubsection' | ||
import { employmentSubsection } from './employmentSubsection' | ||
import { studentSubsection } from './studentSubsection' | ||
import { childrenSchoolInfoSubsection } from './childrenSchoolInfoSubsection' | ||
import { childrenFilesSubsection } from './childrenFilesSubsection' | ||
import * as m from '../../../lib/messages' | ||
|
||
export const personalInterestSection = buildSection({ | ||
id: 'personalInterest', | ||
title: m.section.personalInterest, | ||
children: [ | ||
inRelationshipSubsection, | ||
unknownRelationshipSubsection, | ||
buildSubSection({ | ||
condition: (_, externalData) => { | ||
const childWithInfo = getValueViaPath( | ||
externalData, | ||
'childrenCustodyInformation.data', | ||
[], | ||
) as ApplicantChildCustodyInformation[] | ||
|
||
return Boolean(childWithInfo?.length) | ||
}, | ||
id: Routes.CHILDRENSCHOOLINFO, | ||
title: m.childrenForm.general.sectionTitle, | ||
children: [ | ||
buildCustomField({ | ||
id: Routes.CHILDRENSCHOOLINFO, | ||
title: m.childrenForm.general.pageTitle, | ||
component: 'ChildrenForm', | ||
}), | ||
], | ||
}), | ||
buildSubSection({ | ||
condition: (_, externalData) => { | ||
const childWithInfo = getValueViaPath( | ||
externalData, | ||
'childrenCustodyInformation.data', | ||
[], | ||
) as ApplicantChildCustodyInformation[] | ||
|
||
return Boolean(childWithInfo?.length) | ||
}, | ||
id: Routes.CHILDRENFILES, | ||
title: m.childrenFilesForm.general.sectionTitle, | ||
children: [ | ||
buildCustomField({ | ||
id: Routes.CHILDRENFILES, | ||
title: m.childrenFilesForm.general.pageTitle, | ||
component: 'ChildrenFilesForm', | ||
}), | ||
], | ||
}), | ||
childrenSchoolInfoSubsection, | ||
childrenFilesSubsection, | ||
homeCircumstancesSubsection, | ||
buildSubSection({ | ||
id: Routes.STUDENT, | ||
title: m.studentForm.general.sectionTitle, | ||
children: [ | ||
buildCustomField({ | ||
id: Routes.STUDENT, | ||
title: m.studentForm.general.pageTitle, | ||
component: 'StudentForm', | ||
}), | ||
], | ||
}), | ||
buildSubSection({ | ||
id: Routes.EMPLOYMENT, | ||
title: m.employmentForm.general.sectionTitle, | ||
children: [ | ||
buildCustomField({ | ||
id: Routes.EMPLOYMENT, | ||
title: m.employmentForm.general.pageTitle, | ||
component: 'EmploymentForm', | ||
}), | ||
], | ||
}), | ||
studentSubsection, | ||
employmentSubsection, | ||
], | ||
}) |
36 changes: 36 additions & 0 deletions
36
...ates/financial-aid/src/forms/ApplicationForm/personalInterestSection/studentSubsection.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { | ||
buildMultiField, | ||
buildRadioField, | ||
buildSubSection, | ||
buildTextField, | ||
} from '@island.is/application/core' | ||
import { Routes } from '../../../lib/constants' | ||
import * as m from '../../../lib/messages' | ||
import { studentOptions } from '../../../utils/options' | ||
import { isStudent } from '../../../utils/conditions' | ||
|
||
export const studentSubsection = buildSubSection({ | ||
id: Routes.STUDENT, | ||
title: m.studentForm.general.sectionTitle, | ||
children: [ | ||
buildMultiField({ | ||
id: 'studentMultiField', | ||
title: m.studentForm.general.pageTitle, | ||
children: [ | ||
buildRadioField({ | ||
id: 'student.isStudent', | ||
title: '', | ||
options: studentOptions, | ||
marginBottom: 2, | ||
}), | ||
buildTextField({ | ||
condition: isStudent, | ||
id: 'student.custom', | ||
title: m.studentForm.input.label, | ||
placeholder: m.studentForm.input.example, | ||
required: true, | ||
}), | ||
], | ||
}), | ||
], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters