Skip to content

Commit

Permalink
Add 'Who' pages for assets (#823)
Browse files Browse the repository at this point in the history
[#182000402]
  • Loading branch information
Rameshshakya committed Jun 3, 2022
1 parent 0eb567c commit 4edc6ad
Show file tree
Hide file tree
Showing 8 changed files with 324 additions and 33 deletions.
28 changes: 28 additions & 0 deletions src/main/resources/messages.properties
Expand Up @@ -1405,3 +1405,31 @@ assets.ownership-in-a-business=Ownership in a business
assets.real-estate=Real estate (not including your own home)
assets.more-than-1-million-in-family-assets=More than $1 million in family assets
assets.none-of-the-above=None of the above

vehicle-asset-source.title = Who has a vehicle
vehicle-asset-source.who-has=Who has a vehicle?
vehicle-asset-source.choose-whoever-is-listed=Choose whoever is listed on the legal paperwork. If something is co-owned, select both people.

stock-asset-source.title = Who has stocks, bonds, or a 401k
stock-asset-source.who-has=Who has stocks, bonds, or a 401k?
stock-asset-source.choose-whoever-is-listed=Choose whoever is listed on the legal paperwork. If something is co-owned, select both people.

life-insurance-asset-source.title = Who has life insurance
life-insurance-asset-source.who-has=Who has life insurance?
life-insurance-asset-source.choose-whoever-is-listed=Choose whoever is listed on the legal paperwork. If something is co-owned, select both people.

burial-account-asset-source.title = Who has a prepaid burial account
burial-account-asset-source.who-has=Who has a prepaid burial account?
burial-account-asset-source.choose-whoever-is-listed=Choose whoever is listed on the legal paperwork. If something is co-owned, select both people.

business-ownership-asset-source.title = Who has ownership in a business
business-ownership-asset-source.who-has=Who has ownership in a business?
business-ownership-asset-source.choose-whoever-is-listed=Choose whoever is listed on the legal paperwork. If something is co-owned, select both people.

real-estate-asset-source.title = Who has real estate (not including your own home)
real-estate-asset-source.who-has=Who has real estate (not including your own home)?
real-estate-asset-source.choose-whoever-is-listed=Choose whoever is listed on the legal paperwork. If something is co-owned, select both people.

one-million-dollar-asset-source.title = Who has more than $1 million in family assets
one-million-dollar-asset-source.who-has=Who has more than $1 million in family assets?
one-million-dollar-asset-source.choose-whoever-is-listed=Choose whoever is listed on the legal paperwork. If something is co-owned, select both people.
217 changes: 217 additions & 0 deletions src/main/resources/pages-config.yaml
Expand Up @@ -3223,6 +3223,118 @@ pageDefinitions:
isNone: true
datasources:
- pageName: choosePrograms
- &vehicleAssetSource
name: vehicleAssetSource
pageTitle: vehicle-asset-source.title
headerKey: vehicle-asset-source.who-has
headerHelpMessageKey: vehicle-asset-source.choose-whoever-is-listed
inputs:
- type: CUSTOM
name: vehicleAssetSource
validators:
- validation: NOT_BLANK
errorMessageKey: general.validation.make-sure-to-select-a-person
customInputFragment: householdOptionsCheckboxes
options:
datasources:
- pageName: personalInfo
- groupName: household
- &stockAssetSource
name: stockAssetSource
pageTitle: stock-asset-source.title
headerKey: stock-asset-source.who-has
headerHelpMessageKey: stock-asset-source.choose-whoever-is-listed
inputs:
- type: CUSTOM
name: stockAssetSource
validators:
- validation: NOT_BLANK
errorMessageKey: general.validation.make-sure-to-select-a-person
customInputFragment: householdOptionsCheckboxes
options:
datasources:
- pageName: personalInfo
- groupName: household
- &lifeInsuranceAssetSource
name: lifeInsuranceAssetSource
pageTitle: life-insurance-asset-source.title
headerKey: life-insurance-asset-source.who-has
headerHelpMessageKey: life-insurance-asset-source.choose-whoever-is-listed
inputs:
- type: CUSTOM
name: lifeInsuranceAssetSource
validators:
- validation: NOT_BLANK
errorMessageKey: general.validation.make-sure-to-select-a-person
customInputFragment: householdOptionsCheckboxes
options:
datasources:
- pageName: personalInfo
- groupName: household
- &burialAccountAssetSource
name: burialAccountAssetSource
pageTitle: burial-account-asset-source.title
headerKey: burial-account-asset-source.who-has
headerHelpMessageKey: burial-account-asset-source.choose-whoever-is-listed
inputs:
- type: CUSTOM
name: burialAccountAssetSource
validators:
- validation: NOT_BLANK
errorMessageKey: general.validation.make-sure-to-select-a-person
customInputFragment: householdOptionsCheckboxes
options:
datasources:
- pageName: personalInfo
- groupName: household
- &businessOwnershipAssetSource
name: businessOwnershipAssetSource
pageTitle: business-ownership-asset-source.title
headerKey: business-ownership-asset-source.who-has
headerHelpMessageKey: business-ownership-asset-source.choose-whoever-is-listed
inputs:
- type: CUSTOM
name: businessOwnershipAssetSource
validators:
- validation: NOT_BLANK
errorMessageKey: general.validation.make-sure-to-select-a-person
customInputFragment: householdOptionsCheckboxes
options:
datasources:
- pageName: personalInfo
- groupName: household
- &realEstateAssetSource
name: realEstateAssetSource
pageTitle: real-estate-asset-source.title
headerKey: real-estate-asset-source.who-has
headerHelpMessageKey: real-estate-asset-source.choose-whoever-is-listed
inputs:
- type: CUSTOM
name: realEstateAssetSource
validators:
- validation: NOT_BLANK
errorMessageKey: general.validation.make-sure-to-select-a-person
customInputFragment: householdOptionsCheckboxes
options:
datasources:
- pageName: personalInfo
- groupName: household
- &oneMillionDollarAssetSource
name: oneMillionDollarAssetSource
pageTitle: one-million-dollar-asset-source.title
headerKey: one-million-dollar-asset-source.who-has
headerHelpMessageKey: one-million-dollar-asset-source.choose-whoever-is-listed
inputs:
- type: CUSTOM
name: oneMillionDollarAssetSource
validators:
- validation: NOT_BLANK
errorMessageKey: general.validation.make-sure-to-select-a-person
customInputFragment: householdOptionsCheckboxes
options:
datasources:
- pageName: personalInfo
- groupName: household
workflow:
landing:
pageConfiguration: *landing
Expand Down Expand Up @@ -4371,8 +4483,113 @@ workflow:
- pageName: assets
assets:
pageConfiguration: *assets
nextPages:
- pageName: vehicleAssetSource
vehicleAssetSource:
pageConfiguration: *vehicleAssetSource
nextPages:
- pageName: stockAssetSource
skipCondition:
logicalOperator: OR
conditions:
- pageName: assets
input: assets
value: VEHICLE
matcher: DOES_NOT_CONTAIN
- *livesAlone?
datasources:
- pageName: addHouseholdMembers
- pageName: assets
stockAssetSource:
pageConfiguration: *stockAssetSource
nextPages:
- pageName: lifeInsuranceAssetSource
skipCondition:
logicalOperator: OR
conditions:
- pageName: assets
input: assets
value: STOCK_BOND
matcher: DOES_NOT_CONTAIN
- *livesAlone?
datasources:
- pageName: addHouseholdMembers
- pageName: assets
lifeInsuranceAssetSource:
pageConfiguration: *lifeInsuranceAssetSource
nextPages:
- pageName: burialAccountAssetSource
skipCondition:
logicalOperator: OR
conditions:
- pageName: assets
input: assets
value: LIFE_INSURANCE
matcher: DOES_NOT_CONTAIN
- *livesAlone?
datasources:
- pageName: addHouseholdMembers
- pageName: assets
burialAccountAssetSource:
pageConfiguration: *burialAccountAssetSource
nextPages:
- pageName: businessOwnershipAssetSource
skipCondition:
logicalOperator: OR
conditions:
- pageName: assets
input: assets
value: BURIAL_ACCOUNT
matcher: DOES_NOT_CONTAIN
- *livesAlone?
datasources:
- pageName: addHouseholdMembers
- pageName: assets
businessOwnershipAssetSource:
pageConfiguration: *businessOwnershipAssetSource
nextPages:
- pageName: realEstateAssetSource
skipCondition:
logicalOperator: OR
conditions:
- pageName: assets
input: assets
value: OWNERSHIP_BUSINESS
matcher: DOES_NOT_CONTAIN
- *livesAlone?
datasources:
- pageName: addHouseholdMembers
- pageName: assets
realEstateAssetSource:
pageConfiguration: *realEstateAssetSource
nextPages:
- pageName: oneMillionDollarAssetSource
skipCondition:
logicalOperator: OR
conditions:
- pageName: assets
input: assets
value: REAL_ESTATE
matcher: DOES_NOT_CONTAIN
- *livesAlone?
datasources:
- pageName: addHouseholdMembers
- pageName: assets
oneMillionDollarAssetSource:
pageConfiguration: *oneMillionDollarAssetSource
nextPages:
- pageName: savings
skipCondition:
logicalOperator: OR
conditions:
- pageName: assets
input: assets
value: ONE_MILLION_ASSETS
matcher: DOES_NOT_CONTAIN
- *livesAlone?
datasources:
- pageName: addHouseholdMembers
- pageName: assets
savings:
pageConfiguration: *savings
nextPages:
Expand Down
Expand Up @@ -2,32 +2,35 @@
<th:block th:fragment="householdOptionsCheckboxes (input, data)"
th:with="formInputName=${T(org.codeforamerica.shiba.pages.PageUtils).getFormInputName(input.name)},
inputData=${data.get(input.name)}">
<div class="spacing-below-60 word-wrap-break-word">
<div role="group" aria-labelledby="page-header">
<fieldset>
<label th:for="householdMember-me" class="checkbox"
th:with="fullName=${input.options.datasources.get('personalInfo').get('firstName').value[0] + ' ' + input.options.datasources.get('personalInfo').get('lastName').value[0]}">
<input type="checkbox"
th:id="householdMember-me"
th:value="${fullName} + ' applicant'"
th:name="${formInputName}"
th:checked="${inputData.value.contains(fullName)}">
<span th:text="|${fullName} #{children-in-need-of-care.you}|"></span>
</label>
<th:block th:each="iteration, iterationStat: ${input.options.subworkflows.get('household')}">
<label th:for="|householdMember${iterationStat.index}|"
class="checkbox"
th:with="fullName=${iteration.getPagesData().get('householdMemberInfo').get('firstName').value[0] + ' ' + iteration.getPagesData().get('householdMemberInfo').get('lastName').value[0]}">
<input type="checkbox"
th:id="|householdMember${iterationStat.index}|"
th:value="${fullName} + ' ' + ${iteration.id}"
th:name="${formInputName}"
th:checked="${inputData.value.contains(fullName)}">
<span
th:text="|${iteration.getPagesData().get('householdMemberInfo').get('firstName').value[0]}&nbsp;${iteration.getPagesData().get('householdMemberInfo').get('lastName').value[0]}|"></span>
</label>
</th:block>
</fieldset>
</div>
<div class="spacing-above-35 form-group" th:classappend="${!inputData.valid(data)} ? 'form-group--error' : ''">
<div class="spacing-below-60 word-wrap-break-word">
<div role="group" aria-labelledby="page-header">
<fieldset>
<label th:for="householdMember-me" class="checkbox"
th:with="fullName=${input.options.datasources.get('personalInfo').get('firstName').value[0] + ' ' + input.options.datasources.get('personalInfo').get('lastName').value[0]}">
<input type="checkbox"
th:id="householdMember-me"
th:value="${fullName} + ' applicant'"
th:name="${formInputName}"
th:checked="${inputData.value.contains(fullName + ' applicant')}">
<span th:text="|${fullName} #{children-in-need-of-care.you}|"></span>
</label>
<th:block th:each="iteration, iterationStat: ${input.options.subworkflows.get('household')}">
<label th:for="|householdMember${iterationStat.index}|"
class="checkbox"
th:with="fullName=${iteration.getPagesData().get('householdMemberInfo').get('firstName').value[0] + ' ' + iteration.getPagesData().get('householdMemberInfo').get('lastName').value[0]}">
<input type="checkbox"
th:id="|householdMember${iterationStat.index}|"
th:value="${fullName} + ' ' + ${iteration.id}"
th:name="${formInputName}"
th:checked="${inputData.value.contains(fullName + ' ' + iteration.id)}">
<span
th:text="|${iteration.getPagesData().get('householdMemberInfo').get('firstName').value[0]}&nbsp;${iteration.getPagesData().get('householdMemberInfo').get('lastName').value[0]}|"></span>
</label>
</th:block>
</fieldset>
</div>
</div>
<div th:replace="fragments/inputErrorFragment :: validationError(${data}, ${input})"></div>
</div>
</th:block>
4 changes: 3 additions & 1 deletion src/test/java/org/codeforamerica/shiba/CCAPMockMvcTest.java
Expand Up @@ -41,7 +41,9 @@ void verifyFlowWhenNoOneHasSelectedCCAPInHousehold() throws Exception {
fillAdditionalIncomeInfo();
postExpectingRedirect("supportAndCare", "supportAndCare", "false", "assets");
postExpectingSuccess("assets", "assets", "VEHICLE");
assertNavigationRedirectsToCorrectNextPage("assets", "savings");
assertNavigationRedirectsToCorrectNextPage("assets", "vehicleAssetSource");
postExpectingRedirect("realEstateAssetSource", "realEstateAssetSource", "Dwight Schrute applicant",
"savings");
postExpectingRedirect("savings", "haveSavings", "true", "savingsAmount");
postExpectingNextPageTitle("savingsAmount", "liquidAssets", "1234", "Sold assets");
assertPageDoesNotHaveElementWithId("legalStuff", "ccap-legal");
Expand Down
Expand Up @@ -327,6 +327,10 @@ void userCanCompleteTheNonExpeditedHouseholdFlow() {
testPage.enter("assets", "A vehicle");
testPage.enter("assets", "Real estate (not including your own home)");
testPage.clickContinue();
driver.findElement(By.id("householdMember-me")).click();
testPage.clickContinue();
driver.findElement(By.id("householdMember-me")).click();
testPage.clickContinue();
testPage.enter("haveSavings", YES.getDisplayValue());
testPage.enter("liquidAssets", "1234");
testPage.clickContinue();
Expand Down
Expand Up @@ -344,6 +344,16 @@ void fullApplicationWithDocumentUploads() {
testPage.enter("assets", "Real estate (not including your own home)");
testPage.clickContinue();

// Who has a vehicle?
assertThat(testPage.getTitle()).isEqualTo("Who has a vehicle");
driver.findElement(By.id("householdMember-me")).click();
testPage.clickContinue();

//Who has real estate (not including your own home)
assertThat(testPage.getTitle()).isEqualTo("Who has real estate (not including your own home)");
driver.findElement(By.id("householdMember-me")).click();
testPage.clickContinue();

// Does anyone in the household have money in a bank account or debit card?
testPage.enter("haveSavings", YES.getDisplayValue());

Expand Down

0 comments on commit 4edc6ad

Please sign in to comment.