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

Update ohep heat and electric page per design changes. #282

Merged
merged 2 commits into from
Jun 12, 2024
Merged
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
3 changes: 2 additions & 1 deletion src/main/java/org/mdbenefits/app/inputs/MdBenefitsFlow.java
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,12 @@ public class MdBenefitsFlow extends FlowInputs {

@Size(max = 30, message = "{error.character-length}")
private String electricityAccountNumber;
private String electricityAccountOwner;

private String heatingCompanyName;

@Size(max = 30, message = "{error.character-length}")
private String heatingAccountNumber;
private String heatingAccountOwner;

// medical expenses for 60+ or disability
@NotEmpty(message = "{error.missing-general}")
Expand Down
15 changes: 9 additions & 6 deletions src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ general.remove=Remove
general.optional=Optional.
general.check-all-that-apply=Check all that apply.
general.select.placeholder=Select one
general.you=(You)
general.you=(me)
general.none-of-the-above=None of the above
general.good-news=Good news!
general.i-dont-know=I don't know
Expand Down Expand Up @@ -708,14 +708,17 @@ ohep-rent.header=Are any of these true for your rent?
ohep-rent.option.heat-included=Heat is included in my rent
ohep-rent.option.section-8=I receive Section 8 for rent

ohep-electricity.title=OHEP Electricity
ohep-electricity.header=If you know it, what is your electricity account number?
ohep-electricity.subheader=We use this to send money to your electric company if you are able to get help with electricity.<br/><br/>You can find the number on bills or statements from Baltimore Gas and Electric Company (BGE), Choptank Electric Cooperative, or Delmarva Power & Light Company.<br/><br/>You may skip this question if you don't know it.
ohep-both.household.name=Whose name is on the account?
ohep-both.household.name.help=The person who gets the bill.

ohep-electricity.title=What is your electric utility account number?
ohep-electricity.header=What is your electric utility account number?
ohep-electricity.subheader=You can find the number on bills or statements from Baltimore Gas and Electric Company (BGE), Choptank Electric Cooperative, or Delmarva Power & Light Company.<br/><br/>You may skip this question if you don't know it.
ohep-electricity.label=Your electricity account number

ohep-heating.title=OHEP Heating
ohep-heating.title=What is your heating utility account number?
ohep-heating.header=What is your heating utility company name and account number?
ohep-heating.subheader=We use these to send money to your heating company if you are able to get help with heating.<br/><br/>You can find these on bills or statements from your heating company.<br/><br/>You may skip this question if you don't know them.
ohep-heating.subheader=You can find these on bills or statements from your heating company.<br/><br/>You may skip this question if you don't know them.
ohep-heating.q1=Your heating company's name
ohep-heating.q2=Your heating account number

Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/pdf-map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ inputFields:
householdHasPregnancySeeCover: hhmember_pregnancy_see_cover
heatingCompanyName: expense_heating_company_name
heatingAccountNumber: expense_heating_account_number
heatingAccountOwner: expense_heating_account_owner
electricityAccountNumber: expense_electricity_account_number
electricityAccountOwner: expense_electricity_account_owner

#Section A
isApplicantApplying: applicant_is_applying
Expand Down
Binary file modified src/main/resources/pdfs/9701.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
inputName='householdMemberJobAdd',
content=~{::householdMembers})}">
<th:block th:ref="householdMembers">
<th:block
th:replace="~{fragments/inputs/radio :: radio(inputName=${inputName},value='you', label=${inputData.firstName + ' ' + inputData.lastName + ' ' + #messages.msg('general.you')})}"/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good to go but I was curious why this value is you where the other values are the persons name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I left this part alone so I didn't have to update the pdf logic, as that looks for "you" explicitly.

<th:block th:if="${inputData.containsKey('household')}">
<th:block th:each="householdMember, iter: ${inputData.household}"
class="spacing-below-15">
<th:block
th:replace="~{fragments/inputs/radio :: radio(inputName=${inputName},value=${householdMember.householdMemberFirstName + ' ' + householdMember.householdMemberLastName}, label=${householdMember.householdMemberFirstName + ' ' + householdMember.householdMemberLastName})}"/>
</th:block>
</th:block>
<th:block
th:replace="~{fragments/inputs/radio :: radio(inputName=${inputName},value='you', label=${inputData.firstName + ' ' + inputData.lastName + ' (you) '})}"/>
</th:block>
</th:block>
</div>
Expand Down
51 changes: 46 additions & 5 deletions src/main/resources/templates/mdBenefitsFlow/ohepElectricity.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,63 @@
<div th:replace="~{fragments/goBack :: goBackLink}"></div>
<main id="content" role="main" class="form-card spacing-above-35">
<th:block th:replace="~{fragments/icons :: householdFamilyIncome}"></th:block>
<p class="grey-text" th:text="#{ohep-notice.icon-tag-line}"></p>
<th:block
th:replace="~{fragments/cardHeader :: cardHeader(header=#{ohep-electricity.header})}"/>
<p th:utext="#{ohep-electricity.subheader}"></p>
<th:block th:replace="~{fragments/form :: form(action=${formAction}, content=~{::OHEPElectricityForm})}">
th:replace="~{fragments/cardHeader :: cardHeader(
header=#{ohep-electricity.header},
subtext=#{ohep-electricity.subheader}
)}"/>
<th:block
th:replace="~{fragments/form :: form(action=${formAction}, content=~{::OHEPElectricityForm})}">
<th:block th:ref="OHEPElectricityForm">
<div class="form-card__content">
<th:block th:replace="~{fragments/inputs/text ::
text(inputName='electricityAccountNumber',
label=#{ohep-electricity.label})}" />
label=#{ohep-electricity.label})}"/>
<th:block th:replace="~{fragments/inputs/radioFieldset ::
radioFieldset(
ariaLabel='header',
inputName='electricityAccountOwner',
label=#{ohep-both.household.name},
fieldsetHelpText=#{ohep-both.household.name.help},
content=~{::householdMembers})}">
<th:block th:ref="householdMembers">
<th:block
th:replace="~{fragments/inputs/radio :: radio(
inputName=${inputName},
value=${inputData.firstName + ' ' + inputData.lastName},
label=${inputData.firstName + ' ' + inputData.lastName + ' ' + #messages.msg('general.you')})
}"/>
<th:block th:if="${inputData.containsKey('household')}">
<th:block th:each="householdMember, iter: ${inputData.household}"
class="spacing-below-15">
<th:block
th:if="${householdMember.get(T(formflow.library.data.Submission).ITERATION_IS_COMPLETE_KEY) == true}">
<th:block
th:replace="~{fragments/inputs/radio :: radio(
inputName=${inputName},
value=${householdMember.householdMemberFirstName + ' ' + householdMember.householdMemberLastName},
label=${householdMember.householdMemberFirstName + ' ' + householdMember.householdMemberLastName})}"/>
</th:block>
</th:block>
</th:block>
<th:block
th:replace="~{fragments/inputs/radio :: radio(
inputName=${inputName},
value='Unknown',
label=#{general.i-dont-know}
)}"/>
</th:block>
</th:block>
</div>
<div class="form-card__footer">
<th:block th:replace="~{fragments/inputs/submitButton :: submitButton(
text=#{general.inputs.continue})}"/>
<div><a th:text="#{general.i-dont-know}"
th:href="'/flow/' + ${flow} + '/ohepHeating'"></a></div>
</div>
</th:block>
</th:block>
</th:block>
</main>
</div>
</section>
Expand Down
52 changes: 47 additions & 5 deletions src/main/resources/templates/mdBenefitsFlow/ohepHeating.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,64 @@
<div th:replace="~{fragments/goBack :: goBackLink}"></div>
<main id="content" role="main" class="form-card spacing-above-35">
<th:block th:replace="~{fragments/icons :: householdFamilyIncome}"></th:block>
<p class="grey-text" th:text="#{ohep-notice.icon-tag-line}"></p>
<th:block
th:replace="~{fragments/cardHeader :: cardHeader(header=#{ohep-heating.header})}"/>
<p th:utext="#{ohep-heating.subheader}"></p>
<th:block th:replace="~{fragments/form :: form(action=${formAction}, content=~{::OHEPHeatingForm})}">
th:replace="~{fragments/cardHeader :: cardHeader(
header=#{ohep-heating.header},
subtext=#{ohep-heating.subheader}
)}"/>
<th:block
th:replace="~{fragments/form :: form(action=${formAction}, content=~{::OHEPHeatingForm})}">
<th:block th:ref="OHEPHeatingForm">
<div class="form-card__content">
<th:block th:replace="~{fragments/inputs/text ::
text(inputName='heatingCompanyName',
label=#{ohep-heating.q1})}" />
label=#{ohep-heating.q1})}"/>
<th:block th:replace="~{fragments/inputs/text ::
text(inputName='heatingAccountNumber',
label=#{ohep-heating.q2})}" />
label=#{ohep-heating.q2})}"/>

<th:block th:replace="~{fragments/inputs/radioFieldset ::
radioFieldset(
ariaLabel='header',
inputName='heatingAccountOwner',
label=#{ohep-both.household.name},
fieldsetHelpText=#{ohep-both.household.name.help},
content=~{::householdMembers})}">
<th:block th:ref="householdMembers">
<th:block
th:replace="~{fragments/inputs/radio :: radio(
inputName=${inputName},
value=${inputData.firstName + ' ' + inputData.lastName},
label=${inputData.firstName + ' ' + inputData.lastName + ' ' + #messages.msg('general.you')})
}"/>
<th:block th:if="${inputData.containsKey('household')}">
<th:block th:each="householdMember, iter: ${inputData.household}"
class="spacing-below-15">
<th:block
th:if="${householdMember.get(T(formflow.library.data.Submission).ITERATION_IS_COMPLETE_KEY) == true}">
<th:block
th:replace="~{fragments/inputs/radio :: radio(
inputName=${inputName},
value=${householdMember.householdMemberFirstName + ' ' + householdMember.householdMemberLastName},
label=${householdMember.householdMemberFirstName + ' ' + householdMember.householdMemberLastName})}"/>
</th:block>
</th:block>
</th:block>
<th:block
th:replace="~{fragments/inputs/radio :: radio(
inputName=${inputName},
value='Unknown',
label=#{general.i-dont-know}
)}"/>
</th:block>
</th:block>
</div>
<div class="form-card__footer">
<th:block th:replace="~{fragments/inputs/submitButton :: submitButton(
text=#{general.inputs.continue})}"/>
<div><a th:text="#{general.i-dont-know}"
th:href="'/flow/' + ${flow} + '/ohepThankYou'"></a></div>
</div>
</th:block>
</th:block>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
<div class="center text--align-center">
<th:block
th:replace="~{fragments/cardHeader :: cardHeader(header=#{ohep-thank-you.header})}"/>
<img src="/assets/images/ohep-logo.png" th:alt="#{ohep-thank-you-alt-text}" class="ohep-logo" style="height: 33%; width: 33%;">
<img src="/assets/images/ohep-logo.png" th:alt="#{ohep-thank-you-alt-text}"
class="ohep-logo" style="height: 108px; width: 118px;">
</div>
<div class="form-card__content">
<p th:utext="#{ohep-thank-you.content1}"></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.mdbenefits.app.data.enums.ApplicantObjective;
import org.mdbenefits.app.data.enums.CitizenshipStatus;
import org.mdbenefits.app.data.enums.County;
import org.mdbenefits.app.data.enums.EthnicityType;
import org.mdbenefits.app.testutils.AbstractBasePageTest;
Expand Down Expand Up @@ -121,8 +122,11 @@ void doesNotDisplayAmountWhenMedicalExpenseIsNone() {
@Test
void incomeFlow() {
loadUserPersonalData();
loadHouseHoldData("Third", "User", "12", "22", "1991", true);
loadHouseHoldData("Fourth", "User", "01", "23", "1997", true);

loadHouseHoldData("Third", "User", "12", "22", "1991", true, "123-54-2222",
"F", true, true, true);
loadHouseHoldData("Fourth", "User", "01", "23", "1997", true, "111-11-1111",
"F", true, true, true);
preloadIncomeScreen();

assertThat(testPage.getTitle()).isEqualTo(message("income-by-job.title"));
Expand Down Expand Up @@ -931,6 +935,44 @@ void howThisWorksShouldShowCorrectEmailForCounty() {
assertThat(testPage.findElementById("county-document-email").getText()).contains("qacfia.customeraccount@maryland.gov");
}

@Test
void allHouseholdMemberShouldBeOnOHEPPagesEvenIfNotApplying() {
preloadCountyScreen(message(County.BALTIMORE.getLabelSrc()));
loadUserPersonalData();
loadHouseHoldData("Second", "User", "12", "22", "1991", true,
"123-22-2222", "M", false, false, false);
loadHouseHoldData("Third", "User", "01", "23", "1997", false,
null, null, false, false, false);

testPage.navigateToFlowScreen("mdBenefitsFlow/ohepElectricity");
// make sure both family members are there, even those not technically applying
// selectRadio will throw an error if it cannot find a selection on the input.
testPage.selectRadio("electricityAccountOwner", "test test2");
testPage.selectRadio("electricityAccountOwner", "Second User");
testPage.selectRadio("electricityAccountOwner", "Third User");
}

@Test
void shouldBeAbleToSkipOHEPUtilityPages() {
preloadCountyScreen(message(County.BALTIMORE.getLabelSrc()));
loadUserPersonalData();
loadHouseHoldData("Second", "User", "12", "22", "1991", true,
"111-11-1111", "F", true, true, true);
loadHouseHoldData("Third", "User", "01", "23", "1997", false,
null, null, false, false, false);

testPage.navigateToFlowScreen("mdBenefitsFlow/ohepElectricity");

testPage.clickLink("I don't know");
assertThat(testPage.getTitle()).isEqualTo(message("ohep-heating.title"));

testPage.clickLink("I don't know");
assertThat(testPage.getTitle()).isEqualTo(message("ohep-thank-you.title"));

testPage.clickContinue();
assertThat(testPage.getTitle()).isEqualTo(message("medical-expenses-amount.title"));
}

@Test
void confirmationPageWithNoFeedback() {
testPage.navigateToFlowScreen("mdBenefitsFlow/confirmation");
Expand Down Expand Up @@ -995,13 +1037,33 @@ void loadUserPersonalData() {
testPage.clickContinue();
}

void loadHouseHoldData(String firstName, String lastName, String month, String day, String year, boolean isApplying) {
void loadHouseHoldData(String firstName, String lastName, String month,
String day, String year, boolean isApplying, String ssn, String sex,
boolean isPregnant, boolean isEnrolledInSchool, boolean hasDisability) {
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Show resolved Hide resolved
testPage.navigateToFlowScreen("mdBenefitsFlow/householdInfo");
testPage.enter("householdMemberFirstName", firstName);
testPage.enter("householdMemberLastName", lastName);
testPage.selectFromDropdown("householdMemberRelationship", message("household-info.relationship.child"));
testPage.selectRadio("householdMemberApplyingForBenefits", isApplying ? "Yes" : "No");
testPage.clickContinue();

if (isApplying == false) {
return;
}

testPage.selectFromDropdown("householdMemberCitizenshipStatus", message(CitizenshipStatus.US_CITIZEN.getLabelSrc()));
testPage.enter("householdMemberSsn", ssn);
testPage.enter("householdMemberBirthMonth", month);
testPage.enter("householdMemberBirthDay", day);
testPage.enter("householdMemberBirthYear", year);

testPage.selectRadio("householdMemberSex", sex);
testPage.selectRadio("householdMemberIsPregnant", isPregnant ? "Yes" : "No");
testPage.selectRadio("householdMemberEnrolledInSchool", isEnrolledInSchool ? "Yes" : "No");
testPage.selectRadio("householdMemberHasDisability", hasDisability ? "Yes" : "No");
testPage.clickContinue();
// race/ethnicity (all optional)
testPage.clickContinue();
}

void loadAddressData() {
Expand Down
21 changes: 21 additions & 0 deletions src/test/java/org/mdbenefits/app/pdf/PdfServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,46 @@ void generate() throws IOException {
.with("someoneConvictedForTradingBenefits", "true")
.with("someoneIsReceivingBenefitsWithFakeID", "false")
.with("applicantRace[]", List.of(RaceType.ASIAN.name(), RaceType.WHITE.name()))
.with("heatingCompanyName", "Big Heating Company")
.with("heatingAccountNumber", "h-54321")
.with("heatingAccountOwner", "Jane Doe")
.with("electricityAccountNumber", "e-12345")
.with("electricityAccountOwner", "John Doe")
.with("confirmationNumber", "M123456789")
.build();

submission.setFlow("mdBenefitsFlow");
submission.setSubmittedAt(OffsetDateTime.parse("2024-01-01T00:00:00Z"));

File pdfFile = pdfService.generate(submission);

// Cover page 1
String page1 = getPageText(pdfFile, 1);

// Confirmation number
assertThat(page1).contains("M123456789");

// Applicant full name
assertThat(page1).contains("Doe, John");

// Submission Date
assertThat(page1).contains("01/01/2024");

// Applicant Phone
assertThat(page1).contains("(510) 555-1111");
assertThat(page1).contains("(510) 555-2222");
assertThat(page1).contains("(510) 555-3333");

// Heating company info on the cover page
assertThat(page1).contains("Big Heating Company");
assertThat(page1).contains("h-54321");
assertThat(page1).contains("Jane Doe");

// electricity company info on the cover page
assertThat(page1).contains("e-12345");
// note that this is already on the page as applicant, but as: "Doe, John"
assertThat(page1).contains("John Doe");

// 9701 Page 1
String page4 = getPageText(pdfFile, 4);
assertThat(page4).contains("Doe, John");
Expand Down
Loading