Skip to content

Commit

Permalink
[CCAP-236] Limit parent and guardian from adding more than 4 jobs each (
Browse files Browse the repository at this point in the history
  • Loading branch information
analoo authored Aug 23, 2024
1 parent f1dde7e commit f57ea0c
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,12 @@ activities-parent-partner-type.other-follow-up=Please tell us why they need chil
activities-add-jobs.title=Activities Add Jobs
activities-add-jobs.header=Let's start by adding your jobs,
activities-add-jobs.subtext=You will add one job at a time. We'll ask for your work schedule for each of your jobs.
activities-add-jobs.number-limit=You can add <strong>up to 4 jobs.</strong>
activities-add-jobs.add-a-job=Add a job
activities-add-jobs.your-jobs=Your Jobs
activities-add-jobs.this-is-all-my-jobs=That is all my jobs
activities-add-jobs.header.any-other-jobs=Do you have any other jobs, {0}?
activities-add-jobs.max-jobs-reached=You've reached the maximum of 4 jobs per parent or guardian.
activities-add-jobs.subtext.add-jobs-list=We will ask for your income and work schedule for each of your jobs.
#activities-employer-name
activities-employer-name.title=Activities Employer Name
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/pdf-map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ subflowInfo:
childCareScheduleSundayEnd: CHILD_CARE_SCHEDULE_SUNDAY_END
childCareScheduleSundayEndAmPm: CHILD_CARE_SCHEDULE_SUNDAY_END_AM_PM
primaryParentJobs:
totalIterations: 2
totalIterations: 4
inputFields:
companyName: APPLICANT_EMPLOYER_NAME
employerStreetAddress: APPLICANT_EMPLOYER_ADDRESS
Expand Down Expand Up @@ -218,7 +218,7 @@ subflowInfo:
applicantEmployerTravelTimeHours: APPLICANT_EMPLOYER_TRAVEL_TIME_HOURS
applicantEmployerTravelTimeMins: APPLICANT_EMPLOYER_TRAVEL_TIME_MINS
parentPartnerJobs:
totalIterations: 2
totalIterations: 4
inputFields:
partnerCompanyName: PARTNER_EMPLOYER_NAME
partnerEmployerStreetAddress: PARTNER_EMPLOYER_ADDRESS
Expand Down
Binary file modified src/main/resources/pdfs/IL-CCAP-Form.pdf
Binary file not shown.
15 changes: 13 additions & 2 deletions src/main/resources/templates/gcc/activities-add-jobs.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,25 @@
<div th:replace="~{fragments/goBack :: goBackLink}"></div>
<main id="content" role="main" class="form-card spacing-above-35"
th:with="parentName=${T(org.ilgcc.app.utils.SubmissionUtilities).applicantFirstName(inputData)},
addedJobs=${inputData.containsKey('jobs') && inputData.get('jobs').size() > 0}">
addedJobs=${inputData.containsKey('jobs') && inputData.get('jobs').size() > 0},
maxJobs=${inputData.containsKey('jobs') && inputData.get('jobs').size() >= 4}">
<th:block th:replace="~{fragments/gcc-icons :: income}"></th:block>
<th:block th:with="addJobsHeader=|#{activities-add-jobs.header} ${parentName}.|,
addMoreJobsHeader=#{activities-add-jobs.header.any-other-jobs(${parentName})},
jobsSubtext=#{activities-add-jobs.subtext},
addMoreJobsSubtext=#{activities-add-jobs.subtext.add-jobs-list}">
<th:block th:replace="~{fragments/cardHeader :: cardHeader(header=${addedJobs ? addMoreJobsHeader : addJobsHeader},
subtext=${addedJobs ? addMoreJobsSubtext : jobsSubtext})}"/>
<th:block th:if="${!addedJobs}">
<p th:utext="#{'activities-add-jobs.number-limit'}"
class="notice notice--gray spacing-below-25"></p>
</th:block>

<th:block th:if="${maxJobs}">
<p th:text="#{'activities-add-jobs.max-jobs-reached'}"
class="notice--warning spacing-below-25"></p>
</th:block>

</th:block>
<th:block th:replace="~{fragments/form :: form(action=${formAction}, content=~{::formContent})}">
<th:block th:ref="formContent">
Expand Down Expand Up @@ -44,7 +55,7 @@
<div class="form-card__footer">
<div class="spacing-below-15">
<a th:id="add-parent-job" th:href="'/flow/' + ${flow} + '/activities-employer-name'"
class="button button--primary spacing-above-15">
th:class="'button button--primary spacing-above-15' + ${maxJobs ? ' disabled' : ''}">
<i class="icon-add"></i>
<span th:text="#{activities-add-jobs.add-a-job}"></span>
</a>
Expand Down
14 changes: 12 additions & 2 deletions src/main/resources/templates/gcc/activities-partner-add-job.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,24 @@
<div th:replace="~{fragments/goBack :: goBackLink}"></div>
<main id="content" role="main" class="form-card spacing-above-35"
th:with="parentName=${inputData.get('parentPartnerFirstName')},
addedJobs=${inputData.containsKey('partnerJobs') && inputData.get('partnerJobs').size() > 0}">
addedJobs=${inputData.containsKey('partnerJobs') && inputData.get('partnerJobs').size() > 0},
maxJobs=${inputData.containsKey('partnerJobs') && inputData.get('partnerJobs').size() >= 4}">
<th:block th:replace="~{fragments/gcc-icons :: income}"></th:block>
<th:block th:with="addJobsHeader=#{activities-partner-add-jobs.header(${fieldData.get('parentPartnerFirstName')})},
addMoreJobsHeader=#{activities-partner-add-job.header.any-other-jobs(${inputData.get('parentPartnerFirstName')})},
jobsSubtext=#{activities-partner-add-jobs.subtext},
addMoreJobsSubtext=#{activities-partner-add-job.subtext.add-jobs-list}">
<th:block th:replace="~{fragments/cardHeader :: cardHeader(header=${addedJobs ? addMoreJobsHeader : addJobsHeader},
subtext=${addedJobs ? addMoreJobsSubtext : jobsSubtext})}"/>
<th:block th:if="${!addedJobs}">
<p th:utext="#{'activities-add-jobs.number-limit'}"
class="notice notice--gray spacing-below-25"></p>
</th:block>

<th:block th:if="${maxJobs}">
<p th:text="#{'activities-add-jobs.max-jobs-reached'}"
class="notice--warning spacing-below-25"></p>
</th:block>
</th:block>
<th:block th:replace="~{fragments/form :: form(action=${formAction}, content=~{::formContent})}">
<th:block th:ref="formContent">
Expand Down Expand Up @@ -44,7 +54,7 @@
<div class="form-card__footer">
<div class="spacing-below-15">
<a th:id="add-parent-job" th:href="'/flow/' + ${flow} + '/activities-partner-employer-name'"
class="button button--primary spacing-above-15">
th:class="'button button--primary spacing-above-15' + ${maxJobs ? ' disabled' : ''}">
<i class="icon-add"></i>
<span th:text="#{activities-add-jobs.add-a-job}"></span>
</a>
Expand Down
106 changes: 105 additions & 1 deletion src/test/java/org/ilgcc/app/journeys/GccFlowJourneyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ void fullGccFlow() throws IOException {
//activities-add-jobs
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("activities-add-jobs.title"));
testPage.clickButton(getEnMessage("activities-add-jobs.add-a-job"));
// Add First Job
//activities-employer-name
assertThat(testPage.getTitle()).isEqualTo("Activities Employer Name");
testPage.enter("companyName", "testCompany");
Expand Down Expand Up @@ -299,6 +300,24 @@ void fullGccFlow() throws IOException {

//activities-add-jobs (list)
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("activities-add-jobs.title"));

// Add Second Job
testPage.clickButton(getEnMessage("activities-add-jobs.add-a-job"));
addPrimaryParentJob("2");

assertThat(testPage.getTitle()).isEqualTo(getEnMessage("activities-add-jobs.title"));

// Add Third Job
testPage.clickButton(getEnMessage("activities-add-jobs.add-a-job"));
addPrimaryParentJob("3");

assertThat(testPage.findElementById("add-parent-job").getAttribute("class").contains("disabled")).isFalse();

// Add Fourth Job
testPage.clickButton(getEnMessage("activities-add-jobs.add-a-job"));
addPrimaryParentJob("4");

assertThat(testPage.findElementById("add-parent-job").getAttribute("class").contains("disabled")).isTrue();
testPage.clickButton(getEnMessage("activities-add-jobs.this-is-all-my-jobs"));

//activities-add-ed-program
Expand All @@ -312,7 +331,7 @@ void fullGccFlow() throws IOException {
testPage.clickContinue();

//activities-ed-program-name
testPage.enter("applicantSchoolName", "World Training Program");
testPage.enter("applicantSchoolName", "World Partner Training Program");
testPage.clickContinue();

//activities-ed-program-info
Expand Down Expand Up @@ -368,6 +387,7 @@ void fullGccFlow() throws IOException {
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("activities-partner-employer-address.title"));
testPage.enter("partnerEmployerPhoneNumber", "4444");
testPage.enter("partnerEmployerCity", "Oakland");
testPage.enter("partnerEmployerState", "IL - Illinois");
testPage.enter("partnerEmployerStreetAddress", "123 Partner Employer Address");
testPage.enter("partnerEmployerZipCode", "6042");
testPage.clickContinue();
Expand Down Expand Up @@ -415,6 +435,18 @@ void fullGccFlow() throws IOException {

//activities-partner-add-job
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("activities-partner-add-jobs.title"));
testPage.clickButton("Add a job");

// Add a second parent partner job
addParentPartnerJob("2");
testPage.clickButton("Add a job");

addParentPartnerJob("3");
assertThat(testPage.findElementById("add-parent-job").getAttribute("class").contains("disabled")).isFalse();
testPage.clickButton("Add a job");

addParentPartnerJob("4");
assertThat(testPage.findElementById("add-parent-job").getAttribute("class").contains("disabled")).isTrue();
testPage.clickButton(getEnMessage("activities-partner-add-jobs.this-is-all-their-jobs"));
// activities-partner-ed
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("activities-ed-program.title"));
Expand All @@ -425,7 +457,14 @@ void fullGccFlow() throws IOException {
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("activities-ed-program.title"));
testPage.enter("partnerProgramName", "World University");
testPage.clickContinue();

assertThat(testPage.getTitle()).isEqualTo(getEnMessage("activities-ed-program.title"));
testPage.enter("partnerEdPhoneNumber", "(217) 323-1238");
testPage.enter("partnerEdStreetAddress", "234 Main St");
testPage.enter("partnerEdCity", "Springfield");
testPage.enter("partnerEdState", "IL - Illinois");
testPage.enter("partnerEdZipCode", "62628");

testPage.clickContinue();
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("activities-ed-program-method.header"));
testPage.clickElementById("partnerProgramTaught-In-Person-label");
Expand Down Expand Up @@ -607,4 +646,69 @@ private File getDownloadedPDF() throws IOException {
await().until(pdfDownloadCompletes());
return getLatestDownloadedFile(path);
}

private void addPrimaryParentJob(String postFix){
//activities-employer-name
testPage.enter("companyName", "testCompany" + postFix);
testPage.clickContinue();
//activities-employer-address
testPage.enter("employerCity", "Chicago");
testPage.enter("employerStreetAddress", "123 Test Me" + postFix);
testPage.enter("employerState", "IL - Illinois");
testPage.enter("employerPhoneNumber", "333333333"+postFix);
testPage.enter("employerZipCode", "6042"+postFix);
testPage.clickContinue();

//activities-self-employment
testPage.clickNo();

//activities-work-schedule-vary
testPage.clickNo();

//activities-job-weekly-schedule
testPage.clickElementById("activitiesJobWeeklySchedule-Monday");
testPage.clickElementById("activitiesJobWeeklySchedule-Sunday");
testPage.clickContinue();

//activities-job-hourly-schedule
testPage.clickElementById("activitiesJobHoursSameEveryDay-Yes");
testPage.enter("activitiesJobStartTimeAllDays", "09"+postFix+"0AM");
testPage.enter("activitiesJobEndTimeAllDays", "01"+postFix+"0PM");
testPage.clickContinue();

//activities-work-commute-time
testPage.selectFromDropdown("activitiesJobCommuteTime", getEnMessage("general.hours.1.hour"));
testPage.clickContinue();
}

private void addParentPartnerJob(String postFix){
testPage.enter("partnerCompanyName", "testPartnerCompany"+postFix);
testPage.clickContinue();
//activities--partner-employer-address
testPage.enter("partnerEmployerPhoneNumber", "433333333"+postFix);
testPage.enter("partnerEmployerCity", "Oakland");
testPage.enter("partnerEmployerState", "IL - Illinois");
testPage.enter("partnerEmployerStreetAddress", "123 Partner Employer Address");
testPage.enter("partnerEmployerZipCode", "6042"+postFix);
testPage.clickContinue();
//activities-partner-self-employment
testPage.clickNo();
//activities-partner-work-schedule-vary
testPage.clickNo();

//activities-partner-job-weekly-schedule
testPage.clickElementById("activitiesJobWeeklySchedule-Monday");
testPage.clickElementById("activitiesJobWeeklySchedule-Sunday");
testPage.clickContinue();

//activities-partner-job-hourly-schedule
testPage.clickElementById("activitiesJobHoursSameEveryDay-Yes");
testPage.enter("activitiesJobStartTimeAllDays", "09"+postFix+"0AM");
testPage.enter("activitiesJobEndTimeAllDays", "01"+postFix+"0PM");
testPage.clickContinue();

//activities-partner-commute-time
testPage.selectFromDropdown("activitiesJobCommuteTime", getEnMessage("general.hours.1.5.hours"));
testPage.clickContinue();
}
}
Binary file modified src/test/resources/output/test_filled_ccap.pdf
Binary file not shown.

0 comments on commit f57ea0c

Please sign in to comment.