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

updated the household personal situations page #491

Merged
merged 3 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.ladocuploader.app.data.enums;

import java.util.HashMap;
import java.util.Map;
import lombok.Getter;

@Getter
public enum PersonalSituationType {
HOMELESS_SWITCH("experiencing homelessness", "", "personal-situations.which.option1"),
DRUGS_ALCOHOL("struggling with drugs or alcohol", "", "personal-situations.which.option2"),
DOMESTIC_ABUSE("experiencing domestic abuse", "", "personal-situations.which.option3"),
DISABILITY("personal issue or disability", "", "personal-situations.which.option4"),
OTHER("other", "", "personal-situations.which.option5");

private final String value;
private final String abbreviation;
analoo marked this conversation as resolved.
Show resolved Hide resolved
private final String labelSrc;

static private final Map<String, PersonalSituationType> MAP_BY_VALUE = new HashMap<>();

static {
for( PersonalSituationType type : PersonalSituationType.values()) {
MAP_BY_VALUE.put(type.value, type);
}
}

PersonalSituationType(String value, String abbreviation, String labelSrc) {
this.value = value;
this.abbreviation = abbreviation;
this.labelSrc = labelSrc;
}

public static String getAbbreviationFromValue(String value) {
analoo marked this conversation as resolved.
Show resolved Hide resolved
PersonalSituationType personalSituationType = (PersonalSituationType) MAP_BY_VALUE.get(value);
return personalSituationType != null ? personalSituationType.abbreviation : null;
}
}
14 changes: 4 additions & 10 deletions src/main/java/org/ladocuploader/app/inputs/LaDigitalAssister.java
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,10 @@ public class LaDigitalAssister extends FlowInputs {
private String householdHasDomesticViolenceSituation;

private String householdHasCriminalJusticeSituation;

private String personalSituationHomelessSwitch;

private String personalSituationOtherIssue;

private String personalSituationStrugglingDrugsAlcohol;

private String personalSituationDomesticViolenceFlag;

private String personalSituationDisability;

@NotEmpty(message="{error.missing-general}")
@DynamicField
private List<String> personalSituations;

// Income
private String householdSearchingForJob;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,23 @@
<th:block th:ref="whichHouseholdSituations">
<div th:each="individual, iter: ${inputData.get('affectedByPersonalSituations[]')}"
class="spacing-below-15">
<th:block th:replace="~{'fragments/inputs/checkboxFieldset' ::
checkboxFieldset(inputName='personalSituationsListed',
<th:block th:with="inputName=${'personalSituations' + T(formflow.library.inputs.FieldNameMarkers).DYNAMIC_FIELD_MARKER + individual.uuid}">
<th:block th:replace="~{'fragments/inputs/checkboxFieldset' ::
checkboxFieldset(inputName=${inputName},
ariaLabel='header',
content=~{::whichPersonalSituations})}"
th:with="messageVariant=${individual.uuid == 'you' ? 'self' : 'householdMember'}">
<th:block th:ref="whichPersonalSituations">
<h2 th:text="${messageVariant == 'self' ? #messages.msgWithParams('personal-situations-which-you.subheader', individual.firstName) : #messages.msgWithParams('personal-situations-which.subheader', individual.firstName)}"></h2>
<p th:text="#{general.check-all-that-apply}"></p>
<th:block
th:replace="~{'fragments/inputs/checkboxInSet' :: checkboxInSet(inputName='personalSituationHomelessSwitch',value=${individual.uuid}, label=#{personal-situations.which.option1})}"/>
<th:block
th:replace="~{'fragments/inputs/checkboxInSet' :: checkboxInSet(inputName='personalSituationStrugglingDrugsAlcohol',value=${individual.uuid}, label=#{personal-situations.which.option2})}"/>
<th:block
th:replace="~{'fragments/inputs/checkboxInSet' :: checkboxInSet(inputName='personalSituationDomesticViolenceFlag',value=${individual.uuid}, label=#{personal-situations.which.option3})}"/>
<th:block
th:replace="~{'fragments/inputs/checkboxInSet' :: checkboxInSet(inputName='personalSituationDisability',value=${individual.uuid}, label=#{personal-situations.which.option4})}"/>
<th:block
th:replace="~{'fragments/inputs/checkboxInSet' :: checkboxInSet(inputName='personalSituationOtherIssue',value=${individual.uuid}, label=#{personal-situations.which.option5}, helptext=#{personal-situations.other.helptext})}"/>
</th:block>
</th:block>
th:with="messageVariant=${individual.uuid == 'you' ? 'self' : 'householdMember'}">
<th:block th:ref="whichPersonalSituations">
<h2 th:text="${messageVariant == 'self' ? #messages.msgWithParams('personal-situations-which-you.subheader', individual.firstName) : #messages.msgWithParams('personal-situations-which.subheader', individual.firstName)}"></h2>
<p th:text="#{general.check-all-that-apply}"></p>
<th:block th:each="personalSituation : ${T(org.ladocuploader.app.data.enums.PersonalSituationType).values()}">
<th:block
th:replace="~{fragments/inputs/checkboxInSet :: checkboxInSet(inputName=${inputName}, value=${personalSituation.getValue()}, label=#{${personalSituation.getLabelSrc()}})}"/>
</th:block>
</th:block>
</th:block>
</th:block>
<hr/>
</div>
<div class="form-card__footer">
<th:block th:replace="~{fragments/inputs/submitButton :: submitButton(
Expand Down