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 1 commit
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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,10 @@
<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=${inputName}, value='homelessSwitch', label=#{personal-situations.which.option1})}"/>
<th:block
th:replace="~{'fragments/inputs/checkboxInSet' :: checkboxInSet(inputName=${inputName}, value='strugglingDrugsAlcohol', label=#{personal-situations.which.option2})}"/>
<th:block
th:replace="~{'fragments/inputs/checkboxInSet' :: checkboxInSet(inputName=${inputName}, value='domesticViolenceFlag', label=#{personal-situations.which.option3})}"/>
<th:block
th:replace="~{'fragments/inputs/checkboxInSet' :: checkboxInSet(inputName=${inputName}, value='disability', label=#{personal-situations.which.option4})}"/>
<th:block
th:replace="~{'fragments/inputs/checkboxInSet' :: checkboxInSet(inputName=${inputName} ,value='other', label=#{personal-situations.which.option5})}"/>
<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>
Expand Down