Skip to content

Commit

Permalink
[CCAP-556] adding new school weekly schedule screen (#1214)
Browse files Browse the repository at this point in the history
  • Loading branch information
enyia21 authored Feb 28, 2025
1 parent 871f192 commit 3a73d9e
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/org/ilgcc/app/inputs/Gcc.java
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ public class Gcc extends FlowInputs {
// children-ccap-child-other-ed
private String childAttendsOtherEd;

// children-school-weekly-schedule
private String childOtherEdHoursDescription;

private String earliestChildcareStartDate;

// activities-parent-type
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/ilgcc/app/pdf/NeedChildcareForChildren.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public Map<String, SubmissionField> prepareSubmissionFields(Submission submissio
new SingleField("childCareChildInSchool", (String) child.getOrDefault("childAttendsOtherEd", ""), iteration));
results.put("childRelationship_" + iteration,
new SingleField("childRelationship", (String) child.get("childRelationship"), iteration));
results.put("childOtherEdHoursDescription_" + iteration,
new SingleField("childOtherEdHoursDescription", (String) child.getOrDefault("childOtherEdHoursDescription", ""), iteration));
iteration++;
}
return results;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.ilgcc.app.submission.conditions;

import formflow.library.config.submission.Condition;
import formflow.library.data.Submission;
import java.util.Map;
import java.util.Optional;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class ChildAttendsOtherSchoolDuringDay implements Condition {

@Override
public Boolean run(Submission submission, String id) {
Optional<Map<String, Object>> childSubflow = Optional.of(submission.getSubflowEntryByUuid("children", id));
return childSubflow.get().getOrDefault("childAttendsOtherEd", "false").equals("true");
}
}
6 changes: 6 additions & 0 deletions src/main/resources/flows-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ flow:
- name: children-ccap-child-other-ed
children-ccap-child-other-ed:
condition: IsFiveOrOlder
subflow: children
nextScreens:
- name: children-school-weekly-schedule
condition: ChildAttendsOtherSchoolDuringDay
- name: children-add
children-school-weekly-schedule:
subflow: children
nextScreens:
- name: children-add
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,9 @@ children-childcare-hourly-schedule.same-every-day=The child care hours are the s
#children-ccap-child-other-ed
children-ccap-child-other-ed.title=CCAP Child Other
children-ccap-child-other-ed.header=Does {0} attend any other school or education program during the day?
#children-school-weekly-schedule
children-school-weekly-schedule.title=School hours
children-school-weekly-schedule.header=What days and hours is {0} in school?
#
delete-confirmation.title=Delete person
delete-confirmation.header=Are you sure you want to delete {0} from the application?
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/pdf-map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ subflowInfo:
childUSCitizen: CHILD_US_CITIZEN
childCareChildInSchool: CHILD_CARE_CHILD_IN_SCHOOL
childRelationship: CHILD_RELATIONSHIP_TO_PARENT
childOtherEdHoursDescription: CHILD_CARE_CHILD_SCHOOL_HOURS
childCareScheduleMondayStart: CHILD_CARE_SCHEDULE_MONDAY_START
childCareScheduleMondayStartAmPm: CHILD_CARE_SCHEDULE_MONDAY_START_AM_PM
childCareScheduleTuesdayStart: CHILD_CARE_SCHEDULE_TUESDAY_START
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<div>
<th:block
th:replace="~{fragments/screens/screenWithOneInput ::
screenWithOneInput(
title=#{children-school-weekly-schedule.title},
header=#{children-school-weekly-schedule.header(${fieldData.get('childFirstName')})},
buttonLabel=#{general.button.continue},
formAction=${formAction},
iconFragment=~{fragments/gcc-icons :: schedule-childcare},
inputContent=~{::inputContent})}">
<th:block th:ref="inputContent">
<input type="hidden" th:name="current_uuid" th:value="${fieldData.get('uuid')}">
<th:block th:replace="~{fragments/inputs/textArea ::
textArea(inputName='childOtherEdHoursDescription',
ariaLabel='header',
rows='2',
maxLength='50')}"/>
</th:block>
</th:block>
</div>
10 changes: 10 additions & 0 deletions src/test/java/org/ilgcc/app/journeys/GccFlowJourneyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,17 @@ void fullGccFlow() throws IOException {
testPage.clickContinue();
//children-ccap-child-other-ed
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("children-ccap-child-other-ed.title"));
testPage.clickNo();
//children-add
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("children-add.title"));
testPage.goBack();
//children-ccap-child-other-ed
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("children-ccap-child-other-ed.title"));
testPage.clickYes();
//children-school-weekly-schedule
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("children-school-weekly-schedule.title"));
testPage.enter("childOtherEdHoursDescription", "M-F (8am - 5pm)");
testPage.clickContinue();
//children-add (with children listed)
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("children-add.title"));
// Add an incomplete iteration and assert that it is removed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ void NoProviderFullFlow() {
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("children-ccap-child-other-ed.title"));
testPage.clickYes();

//children-school-weekly-schedule
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("children-school-weekly-schedule.title"));
testPage.clickContinue();

//children-add (with children listed)
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("children-add.title"));
testPage.clickButton(getEnMessage("children-add.thats-all"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,18 @@ public void genderFieldCanBeEmpty() {
Map<String, SubmissionField> result = preparer.prepareSubmissionFields(submission, null);
assertThat(result.get("childGender_1")).isEqualTo(new SingleField("childGender", "", 1));
}

@Test
public void childCareChildSchoolHoursIsFilledIfPresent() {
submission = new SubmissionTestBuilder().withChild("Childcare", "Hours", "Yes")
.withChild("Tester", "LastName","Yes")
.withDescriptionOfChildAttendsOtherSchoolDuringTheDay(0, "")
.withDescriptionOfChildAttendsOtherSchoolDuringTheDay(1, "testValue")
.build();

Map<String, SubmissionField> result = preparer.prepareSubmissionFields(submission, null);
assertThat(result.get("childOtherEdHoursDescription_1")).isEqualTo(new SingleField("childOtherEdHoursDescription", "", 1));
assertThat(result.get("childOtherEdHoursDescription_2")).isEqualTo(new SingleField("childOtherEdHoursDescription", "testValue", 2));

}
}
11 changes: 11 additions & 0 deletions src/test/java/org/ilgcc/app/utils/SubmissionTestBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,18 @@ public SubmissionTestBuilder withChildAttendsSchoolDuringTheDay(int childIterati
child.put("childAttendsOtherEd", (childAttendsOtherEd));
return this;
}
public SubmissionTestBuilder withDescriptionOfChildAttendsOtherSchoolDuringTheDay(int childIterationPosition, String childOtherEdHoursDescription) {
List<Map<String, Object>> children = (List<Map<String, Object>>) submission.getInputData()
.getOrDefault("children", emptyList());
if (children.isEmpty()) {
return this;
}

Map<String, Object> child = children.get(childIterationPosition);

child.put("childOtherEdHoursDescription", childOtherEdHoursDescription);
return this;
}
public SubmissionTestBuilder withChildIsAUSCitizen(int childIterationPosition, String childIsUsCitizen) {
List<Map<String, Object>> children = (List<Map<String, Object>>) submission.getInputData()
.getOrDefault("children", emptyList());
Expand Down
Binary file modified src/test/resources/output/test_filled_ccap.pdf
Binary file not shown.

0 comments on commit 3a73d9e

Please sign in to comment.