Skip to content

Commit

Permalink
Add income receipt waivers (#33331)
Browse files Browse the repository at this point in the history
* Add income receipt waivers

* Add recipient name page(s)

* Replace page helpers with depends

* Update cypress test

* Update payment resume date

* Remove show recipient name helper

* Reorder chapters

* Remove whitespace
  • Loading branch information
ToddWebDev authored Dec 6, 2024
1 parent 2823713 commit a2ed1b2
Show file tree
Hide file tree
Showing 12 changed files with 601 additions and 177 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
otherRecipientRelationshipExplanationRequired,
otherIncomeTypeExplanationRequired,
recipientNameRequired,
showRecipientName,
} from '../../../helpers';
import { relationshipLabels, incomeTypeLabels } from '../../../labels';

Expand Down Expand Up @@ -136,29 +135,37 @@ const incomeRecipientPage = {
'unassociatedIncomes',
),
},
recipientName: {
'ui:title': 'Tell us the income recipient’s name',
'ui:webComponentField': VaTextInputField,
'ui:options': {
hint: 'Only needed if child, parent, custodian of child, or other',
expandUnder: 'recipientRelationship',
expandUnderCondition: showRecipientName,
},
'ui:required': (formData, index) =>
recipientNameRequired(formData, index, 'unassociatedIncomes'),
},
},
schema: {
type: 'object',
properties: {
recipientRelationship: radioSchema(Object.keys(relationshipLabels)),
otherRecipientRelationshipType: { type: 'string' },
recipientName: textSchema,
},
required: ['recipientRelationship'],
},
};

/** @returns {PageSchema} */
const recipientNamePage = {
uiSchema: {
...arrayBuilderItemSubsequentPageTitleUI(
'Recurring income not associated with accounts or assets',
),
recipientName: textUI({
title: 'Tell us the income recipient’s name',
hint: 'Only needed if child, parent, custodian of child, or other',
}),
},
schema: {
type: 'object',
properties: {
recipientName: textSchema,
},
required: ['recipientName'],
},
};

/** @returns {PageSchema} */
const incomeTypePage = {
uiSchema: {
Expand Down Expand Up @@ -220,6 +227,14 @@ export const unassociatedIncomePages = arrayBuilderPages(
uiSchema: incomeRecipientPage.uiSchema,
schema: incomeRecipientPage.schema,
}),
unassociatedIncomeRecipientNamePage: pageBuilder.itemPage({
title: 'Unassociated income recipient name',
path: 'unassociated-incomes/:index/recipient-name',
depends: (formData, index) =>
recipientNameRequired(formData, index, 'unassociatedIncomes'),
uiSchema: recipientNamePage.uiSchema,
schema: recipientNamePage.schema,
}),
unassociatedIncomeTypePage: pageBuilder.itemPage({
title: 'Unassociated income type',
path: 'unassociated-incomes/:index/income-type',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
otherRecipientRelationshipExplanationRequired,
otherIncomeTypeExplanationRequired,
recipientNameRequired,
showRecipientName,
} from '../../../helpers';
import { relationshipLabels, incomeTypeEarnedLabels } from '../../../labels';

Expand Down Expand Up @@ -137,29 +136,37 @@ const incomeRecipientPage = {
'associatedIncomes',
),
},
recipientName: {
'ui:title': 'Tell us the income recipient’s name',
'ui:webComponentField': VaTextInputField,
'ui:options': {
hint: 'Only needed if child, parent, custodian of child, or other',
expandUnder: 'recipientRelationship',
expandUnderCondition: showRecipientName,
},
'ui:required': (formData, index) =>
recipientNameRequired(formData, index, 'associatedIncomes'),
},
},
schema: {
type: 'object',
properties: {
recipientRelationship: radioSchema(Object.keys(relationshipLabels)),
otherRecipientRelationshipType: { type: 'string' },
recipientName: textSchema,
},
required: ['recipientRelationship'],
},
};

/** @returns {PageSchema} */
const recipientNamePage = {
uiSchema: {
...arrayBuilderItemSubsequentPageTitleUI(
'Income and net worth associated with financial accounts',
),
recipientName: textUI({
title: 'Tell us the income recipient’s name',
hint: 'Only needed if child, parent, custodian of child, or other',
}),
},
schema: {
type: 'object',
properties: {
recipientName: textSchema,
},
required: ['recipientName'],
},
};

/** @returns {PageSchema} */
const incomeTypePage = {
uiSchema: {
Expand Down Expand Up @@ -227,6 +234,14 @@ export const associatedIncomePages = arrayBuilderPages(
uiSchema: incomeRecipientPage.uiSchema,
schema: incomeRecipientPage.schema,
}),
associatedIncomeRecipientNamePage: pageBuilder.itemPage({
title: 'Financial account recipient name',
path: 'associated-incomes/:index/recipient-name',
depends: (formData, index) =>
recipientNameRequired(formData, index, 'associatedIncomes'),
uiSchema: recipientNamePage.uiSchema,
schema: recipientNamePage.schema,
}),
associatedIncomeTypePage: pageBuilder.itemPage({
title: 'Financial account type',
path: 'associated-incomes/:index/income-type',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
arrayBuilderYesNoUI,
radioUI,
radioSchema,
textUI,
textSchema,
} from '~/platform/forms-system/src/js/web-component-patterns';
import currencyUI from 'platform/forms-system/src/js/definitions/currency';
Expand All @@ -16,7 +17,6 @@ import {
formatCurrency,
otherRecipientRelationshipExplanationRequired,
recipientNameRequired,
showRecipientName,
} from '../../../helpers';
import { relationshipLabels, ownedAssetTypeLabels } from '../../../labels';
import {
Expand Down Expand Up @@ -141,29 +141,37 @@ const ownedAssetRecipientPage = {
'ownedAssets',
),
},
recipientName: {
'ui:title': 'Tell us the income recipient’s name',
'ui:webComponentField': VaTextInputField,
'ui:options': {
hint: 'Only needed if child, parent, custodian of child, or other',
expandUnder: 'recipientRelationship',
expandUnderCondition: showRecipientName,
},
'ui:required': (formData, index) =>
recipientNameRequired(formData, index, 'ownedAssets'),
},
},
schema: {
type: 'object',
properties: {
recipientRelationship: radioSchema(Object.keys(relationshipLabels)),
otherRecipientRelationshipType: { type: 'string' },
recipientName: textSchema,
},
required: ['recipientRelationship'],
},
};

/** @returns {PageSchema} */
const recipientNamePage = {
uiSchema: {
...arrayBuilderItemSubsequentPageTitleUI(
'Income and net worth associated with owned assets',
),
recipientName: textUI({
title: 'Tell us the income recipient’s name',
hint: 'Only needed if child, parent, custodian of child, or other',
}),
},
schema: {
type: 'object',
properties: {
recipientName: textSchema,
},
required: ['recipientName'],
},
};

/** @returns {PageSchema} */
const ownedAssetTypePage = {
uiSchema: {
Expand Down Expand Up @@ -233,6 +241,14 @@ export const ownedAssetPages = arrayBuilderPages(options, pageBuilder => ({
uiSchema: ownedAssetRecipientPage.uiSchema,
schema: ownedAssetRecipientPage.schema,
}),
ownedAssetRecipientNamePage: pageBuilder.itemPage({
title: 'Owned Asset recipient name',
path: 'owned-assets/:index/recipient-name',
depends: (formData, index) =>
recipientNameRequired(formData, index, 'ownedAssets'),
uiSchema: recipientNamePage.uiSchema,
schema: recipientNamePage.schema,
}),
ownedAssetTypePage: pageBuilder.itemPage({
title: 'Owned asset type',
path: 'owned-assets/:index/income-type',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
arrayBuilderYesNoUI,
radioUI,
radioSchema,
textUI,
textareaUI,
textareaSchema,
textSchema,
Expand All @@ -21,7 +22,6 @@ import {
otherRecipientRelationshipExplanationRequired,
otherGeneratedIncomeTypeExplanationRequired,
recipientNameRequired,
showRecipientName,
} from '../../../helpers';
import { relationshipLabels, generatedIncomeTypeLabels } from '../../../labels';

Expand Down Expand Up @@ -147,29 +147,37 @@ const royaltyRecipientPage = {
'royaltiesAndOtherProperties',
),
},
recipientName: {
'ui:title': 'Tell us the income recipient’s name',
'ui:webComponentField': VaTextInputField,
'ui:options': {
hint: 'Only needed if child, parent, custodian of child, or other',
expandUnder: 'recipientRelationship',
expandUnderCondition: showRecipientName,
},
'ui:required': (formData, index) =>
recipientNameRequired(formData, index, 'royaltiesAndOtherProperties'),
},
},
schema: {
type: 'object',
properties: {
recipientRelationship: radioSchema(Object.keys(relationshipLabels)),
otherRecipientRelationshipType: { type: 'string' },
recipientName: textSchema,
},
required: ['recipientRelationship'],
},
};

/** @returns {PageSchema} */
const recipientNamePage = {
uiSchema: {
...arrayBuilderItemSubsequentPageTitleUI(
'Income and net worth associated with royalties and other properties',
),
recipientName: textUI({
title: 'Tell us the income recipient’s name',
hint: 'Only needed if child, parent, custodian of child, or other',
}),
},
schema: {
type: 'object',
properties: {
recipientName: textSchema,
},
required: ['recipientName'],
},
};

/** @returns {PageSchema} */
const generatedIncomeTypePage = {
uiSchema: {
Expand Down Expand Up @@ -247,6 +255,14 @@ export const royaltiesAndOtherPropertyPages = arrayBuilderPages(
uiSchema: royaltyRecipientPage.uiSchema,
schema: royaltyRecipientPage.schema,
}),
royaltyRecipientNamePage: pageBuilder.itemPage({
title: 'Royalties and other properties recipient name',
path: 'royalties-and-other-properties/:index/recipient-name',
depends: (formData, index) =>
recipientNameRequired(formData, index, 'royaltiesAndOtherProperties'),
uiSchema: recipientNamePage.uiSchema,
schema: recipientNamePage.schema,
}),
generatedIncomeTypePage: pageBuilder.itemPage({
title: 'Royalties and other properties type',
path: 'royalties-and-other-properties/:index/income-type',
Expand Down
Loading

0 comments on commit a2ed1b2

Please sign in to comment.