Skip to content

Commit

Permalink
[CCAP-470] create providerresponse registration service languages scr…
Browse files Browse the repository at this point in the history
…een (#1006)
  • Loading branch information
enyia21 authored Jan 17, 2025
1 parent ff81e75 commit a300f6f
Show file tree
Hide file tree
Showing 10 changed files with 400 additions and 44 deletions.
5 changes: 5 additions & 0 deletions src/main/java/org/ilgcc/app/inputs/Providerresponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import formflow.library.utils.RegexUtils;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Pattern;
import java.util.List;

public class Providerresponse extends FlowInputs {

Expand Down Expand Up @@ -118,4 +120,7 @@ public class Providerresponse extends FlowInputs {
private String providerTaxIdSSN;
@Pattern(regexp = "\\d{9}", message = "{registration-tax-id-ein.error}")
private String providerTaxIdEIN;
@NotEmpty(message = "{registration-service-languages.error}")
private List<String> providerLanguagesOffered;
private String providerLanguagesOffered_other;
}
60 changes: 60 additions & 0 deletions src/main/java/org/ilgcc/app/pdf/ProviderLanguagesPreparer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package org.ilgcc.app.pdf;

import formflow.library.data.Submission;
import formflow.library.pdf.PdfMap;
import formflow.library.pdf.SingleField;
import formflow.library.pdf.SubmissionField;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.ilgcc.app.utils.enums.ProviderLanguagesOffered;
import org.springframework.stereotype.Component;

@Component
public class ProviderLanguagesPreparer extends ProviderSubmissionFieldPreparer {

@Override
public Map<String, SubmissionField> prepareSubmissionFields(Submission familySubmission, PdfMap pdfMap) {
var results = new HashMap<String, SubmissionField>();
Optional<Submission> providerSubmission = getProviderSubmission(familySubmission);
if (providerSubmission.isEmpty()) {
return results;
}

var providerInputData = providerSubmission.get().getInputData();
List<String> otherLanguages = new ArrayList<>();
if (providerInputData.containsKey("providerLanguagesOffered[]")) {
List<String> providerLanguagesOffered = (List<String>) providerInputData.get("providerLanguagesOffered[]");
if (providerLanguagesOffered.isEmpty() || providerLanguagesOffered.contains("NONE")) {
return results;
}

for (ProviderLanguagesOffered provider : ProviderLanguagesOffered.values()) {
if (providerLanguagesOffered.contains(provider.getValue())) {
if (!provider.getProviderLanguagePdfFieldValue().equalsIgnoreCase("Other")) {
String pdfMapInputName = String.format("providerLanguage%s", provider.getValue());
results.put(pdfMapInputName, new SingleField(pdfMapInputName, "true", null));
} else {
results.put("providerLanguageOther", new SingleField("providerLanguageOther", "true", null));
otherLanguages.add(provider.getProviderLanguageOtherDetailPdfFieldValue());
}
}
}

if (providerLanguagesOffered.contains("other")) {
if (otherLanguages.isEmpty()) {
results.put("providerLanguageOther", new SingleField("providerLanguageOther", "true", null));
}
}

if (!otherLanguages.isEmpty()) {
String otherLanguagesList = String.join(", ", otherLanguages);
results.put("providerLanguageOtherDetail", new SingleField("providerLanguageOtherDetail", otherLanguagesList, null));
}
return results;
}
return results;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.ilgcc.app.utils.enums;

import lombok.Getter;

@Getter

public enum ProviderLanguagesOffered {
ENGLISH("registration-service-languages.provider-languages.english", "English", "ENGLISH", ""),
SPANISH("registration-service-languages.provider-languages.spanish" ,"Spanish", "SPANISH", ""),
POLISH("registration-service-languages.provider-languages.polish","Polish", "POLISH", ""),
CHINESE("registration-service-languages.provider-languages.chinese" ,"Chinese", "CHINESE", ""),
TAGALOG("registration-service-languages.provider-languages.tagalog", "Tagalog","OTHER",
"Tagalog (including Filipino)"),
HINDI("registration-service-languages.provider-languages.hindi", "Hindi","OTHER", "Hindi"),
ARABIC("registration-service-languages.provider-languages.arabic", "Arabic","OTHER", "Arabic");
private final String label;
private final String value;
private final String providerLanguagePdfFieldValue;
private final String providerLanguageOtherDetailPdfFieldValue;

ProviderLanguagesOffered(String label, String value ,String providerLanguagePdfFieldValue, String providerLanguageOtherDetailPdfFieldValue) {
this.label = label;
this.value = value;
this.providerLanguagePdfFieldValue = providerLanguagePdfFieldValue;
this.providerLanguageOtherDetailPdfFieldValue = providerLanguageOtherDetailPdfFieldValue;
}
}

18 changes: 16 additions & 2 deletions src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1364,14 +1364,14 @@ registration-tax-id.reveal-body=Providers can be paid by paper check, direct dep
registration-tax-id.ssn=SSN (Social Security Number)
registration-tax-id.fein=FEIN (Federal Employer Identification Number)

#registration-tax-id-ssn
# registration-tax-id-ssn
registration-tax-id-ssn.title=SSN
registration-tax-id-ssn.header=What is your Social Security Number?
registration-tax-id-ssn.helper=You don't need it to register for CCAP, but you will need it to get paid.
registration-tax-id-ssn.linkText=Your information is secure and will be handled in accordance with our <a id='link-to-ilgcc-privacy-policy' href="/privacy" target="_blank" rel="noopener noreferrer">privacy policy</a>.
registration-tax-id-ssn.error=Make sure the SSN is valid and 9 digits

#registration-tax-id-ein
# registration-tax-id-ein
registration-tax-id-ein.title=Employer Identification Number (EIN)
registration-tax-id-ein.header=What is your Employer Identification Number (EIN)?
registration-tax-id-ein.helper=This is also known as a federal tax identification number. This isn't required to register for CCAP, but will be required in order to actually get paid by CCAP.
Expand All @@ -1382,6 +1382,20 @@ registration-start-date.title=Child care start date
registration-start-date.header=When do you plan to start child care services under CCAP?
registration-start-date.subtext=<p>If you are not sure, enter the date the family requested you start care on.</p><p>You can be paid by CCAP for child care services <strong>up to 7 business days</strong> before the CCR&R receives your application.</p><div class="notice notice--gray spacing-below-60">If there is already a date below, it has been pre-filled from the family's CCAP application. It represents the first day they want child care.</div>

# registration-service-languages
registration-service-languages.title=Child care service languages
registration-service-languages.header=What language(s) do you provide services in?
registration-service-languages.provider-languages.english=English
registration-service-languages.provider-languages.spanish=Spanish
registration-service-languages.provider-languages.polish=Polish
registration-service-languages.provider-languages.chinese=Chinese (including Mandarin, Cantonese)
registration-service-languages.provider-languages.tagalog=Tagalog (including Filipino)
registration-service-languages.provider-languages.hindi=Hindi
registration-service-languages.provider-languages.arabic=Arabic
registration-service-languages.provider-languages.other=Other
registration-service-languages.provider-languages.other-follow-up=Please tell us what other language(s) you provide services in.
registration-service-languages.error=Select an option

# registration-checks-trainings-intro
registration-checks-trainings-intro.title=Background checks and trainings
registration-checks-trainings-intro.1=Your background history
Expand Down
6 changes: 6 additions & 0 deletions src/main/resources/pdf-map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ inputFields:
providerConvictionExplanation: PROVIDER_CONVICTION_EXPLANATION
providerIdentityCheckDateOfBirthDate: PROVIDER_DOB
providerSSN: PROVIDER_SSN
providerLanguageEnglish: PROVIDER_LANGUAGE_ENGLISH
providerLanguageSpanish: PROVIDER_LANGUAGE_SPANISH
providerLanguagePolish: PROVIDER_LANGUAGE_POLISH
providerLanguageChinese: PROVIDER_LANGUAGE_CHINESE
providerLanguageOther: PROVIDER_LANGUAGE_OTHER
providerLanguageOtherDetail: PROVIDER_LANGUAGE_OTHER_DETAIL
providerSignature: PROVIDER_SIGNATURE
providerTaxIdEIN: PROVIDER_FEIN
providerSignatureDate: PROVIDER_SIGNATURE_DATE
Expand Down
Binary file modified src/main/resources/pdfs/IL-CCAP-Form.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,28 +1,40 @@
<!DOCTYPE html>
<html th:lang="${#locale.language}" xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{fragments/head :: head(title='TEMPLATE')}"></head>
<body>
<div class="page-wrapper">
<div th:replace="~{fragments/toolbar :: toolbar}"></div>
<section class="slab">
<div class="grid">
<div th:replace="~{fragments/goBack :: goBackLink}"></div>
<main id="content" role="main" class="form-card spacing-above-35">
<th:block th:replace="~{fragments/cardHeader :: cardHeader(header='#{placeholder}', subtext='#{placeholder}')}"/>
<th:block th:replace="~{fragments/form :: form(action=${formAction}, content=~{::formContent})}">
<th:block th:ref="formContent">
<div class="form-card__content">

</div>
<div class="form-card__footer">
<th:block th:replace="~{fragments/inputs/submitButton :: submitButton(text=#{general.inputs.continue})}"/>
</div>
</th:block>
</th:block>
</main>
</div>
</section>
</div>
<th:block th:replace="~{fragments/footer :: footer}"/>
</body>
</html>
<th:block
th:replace="~{fragments/screens/screenWithOneInput ::
screenWithOneInput(
title=#{registration-service-languages.title},
header=#{registration-service-languages.header},
iconFragment=~{fragments/gcc-icons :: language-preference},
required='true',
buttonLabel=#{general.inputs.continue},
formAction=${formAction},
inputContent=~{::inputContent})}">
<th:block th:ref="inputContent">
<th:block th:replace="~{fragments/inputs/checkboxFieldset ::
checkboxFieldset(inputName='providerLanguagesOffered',
noneOfTheAboveLabel=#{general.inputs.prefer-not-to-answer},
ariaLabel='header',
content=~{::providerLanguagesContent})}">
<th:block th:ref="providerLanguagesContent">
<th:block th:each="option : ${T(org.ilgcc.app.utils.enums.ProviderLanguagesOffered).values()}">
<th:block th:replace="~{fragments/inputs/checkboxInSet ::
checkboxInSet(inputName=${inputName},
value=${option.getValue()},
label=${#strings.isEmpty(option.getLabel()) ? null : #messages.msg(option.getLabel())})}"/>
</th:block>
<div class="question-with-follow-up spacing-below-15">
<div class="question-with-follow-up__question">
<th:block
th:replace="~{fragments/inputs/checkboxInSet :: checkboxInSet(inputName=${inputName},value='other', label=#{registration-service-languages.provider-languages.other}, followUpId='#provider-languages-other-followUp')}"/>
</div>
<div class="question-with-follow-up__follow-up" id="provider-languages-other-followUp">
<th:block th:replace="~{fragments/inputs/text ::
text(inputName='providerLanguagesOffered_other',
label=#{registration-service-languages.provider-languages.other-follow-up})}"/>
</div>
</div>
<th:block th:replace="~{fragments/inputs/checkboxInSet ::
checkboxInSet(inputName=${inputName}, value='NONE', label=${noneOfTheAboveLabel}, noneOfTheAbove=true)}"/>
</th:block>
</th:block>
</th:block>
</th:block>
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ void BasicInfoFlow() {
testPage.enter("providerTaxIdSSN", "333-22-2222");
testPage.clickContinue();

//registration-service-languages-error
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("registration-service-languages.title"));
testPage.clickContinue();
assertThat(testPage.hasErrorText(getEnMessage("registration-service-languages.error"))).isTrue();

//registration-service-languages
testPage.clickElementById("providerLanguagesOffered-English-label");
testPage.clickContinue();

}

@Test
Expand Down Expand Up @@ -206,12 +215,18 @@ void LicenseExemptInProviderHomeFlow() {
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("registration-tax-id.title"));
testPage.clickElementById("providerTaxIdType-SSN-label");
testPage.clickContinue();
//

assertThat(testPage.getTitle()).isNotEqualTo(getEnMessage("registration-tax-id-ssn.title"));
assertThat(testPage.getTitle()).isNotEqualTo(getEnMessage("registration-tax-id-ein.title"));

// registration-service-languages
// assertThat(testPage.hasErrorText(getEnMessage("registration-service-languages.title"))).isTrue();
//registration-service-languages-error
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("registration-service-languages.title"));
testPage.clickContinue();
assertThat(testPage.hasErrorText(getEnMessage("registration-service-languages.error"))).isTrue();

//registration-service-languages
testPage.clickElementById("providerLanguagesOffered-other");
testPage.enter("providerLanguagesOffered_other", "Test");
testPage.clickContinue();

// registration-start-date
Expand Down Expand Up @@ -350,8 +365,12 @@ void LicenseExemptInChildHomeFlow() {
testPage.enter("providerTaxIdEIN", "123456789");
testPage.clickContinue();

// registration-service-languages
// assertThat(testPage.hasErrorText(getEnMessage("registration-service-languages.title"))).isTrue();
//Test Prefer Not to Answer Implementation
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("registration-service-languages.title"));
testPage.clickElementById("providerLanguagesOffered-English-label");
assertThat(testPage.findElementById("providerLanguagesOffered-English").isSelected()).isTrue();
testPage.clickElementById("none__checkbox-providerLanguagesOffered");
assertThat(testPage.findElementById("providerLanguagesOffered-English").isSelected()).isFalse() ;
testPage.clickContinue();

// registration-start-date
Expand Down Expand Up @@ -462,12 +481,26 @@ void LicensedChildCareHomeFlow() {
testPage.clickElementById("providerTaxIdType-SSN-label");
testPage.clickContinue();

//
assertThat(testPage.getTitle()).isNotEqualTo(getEnMessage("registration-tax-id-ssn.title"));
assertThat(testPage.getTitle()).isNotEqualTo(getEnMessage("registration-tax-id-ein.title"));

// registration-service-languages
// assertThat(testPage.hasErrorText(getEnMessage("registration-service-languages.title"))).isTrue();
//registration-service-languages
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("registration-service-languages.title"));
testPage.clickElementById("providerLanguagesOffered-Arabic-label");
testPage.clickElementById("providerLanguagesOffered-Chinese-label");
testPage.clickElementById("providerLanguagesOffered-Polish-label");
testPage.clickElementById("providerLanguagesOffered-Tagalog-label");
testPage.clickElementById("providerLanguagesOffered-other");
testPage.enter("providerLanguagesOffered_other", "Test");
testPage.clickContinue();
testPage.goBack();

assertThat(testPage.findElementById("providerLanguagesOffered-Arabic").isSelected()).isTrue();
assertThat(testPage.findElementById("providerLanguagesOffered-Tagalog").isSelected()).isTrue();
assertThat(testPage.findElementById("providerLanguagesOffered-Chinese").isSelected()).isTrue();
assertThat(testPage.findElementById("providerLanguagesOffered-English-label").isSelected()).isFalse();
assertThat(testPage.findElementById("providerLanguagesOffered-other").isSelected()).isTrue();
assertThat(testPage.getInputValue("providerLanguagesOffered_other")).isEqualTo("Test");
testPage.clickContinue();

// registration-start-date
Expand Down Expand Up @@ -580,8 +613,13 @@ void LicensedChildCareCenterFlow() {
testPage.enter("providerTaxIdEIN", "123456789");
testPage.clickContinue();

// registration-service-languages
// assertThat(testPage.hasErrorText(getEnMessage("registration-service-languages.title"))).isTrue();
//registration-service-languages-error
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("registration-service-languages.title"));
testPage.clickContinue();
assertThat(testPage.hasErrorText(getEnMessage("registration-service-languages.error"))).isTrue();

//registration-service-languages
testPage.clickElementById("providerLanguagesOffered-Polish-label");
testPage.clickContinue();

// registration-start-date
Expand Down Expand Up @@ -693,8 +731,13 @@ void LicensedGroupChildCareHomeFlow() {
testPage.clickElementById("providerTaxIdType-SSN-label");
testPage.clickContinue();

// registration-service-languages
// assertThat(testPage.hasErrorText(getEnMessage("registration-service-languages.title"))).isTrue();
//registration-service-languages-error
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("registration-service-languages.title"));
testPage.clickContinue();
assertThat(testPage.hasErrorText(getEnMessage("registration-service-languages.error"))).isTrue();

//registration-service-languages
testPage.clickElementById("providerLanguagesOffered-Hindi-label");
testPage.clickContinue();

// registration-start-date
Expand Down Expand Up @@ -836,10 +879,14 @@ void LicenseExemptChildCareCenter() {
testPage.clickElementById("providerTaxIdType-SSN-label");
testPage.clickContinue();

//registration-tax-id-ssn.title
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("registration-tax-id-ssn.title"));
testPage.enter("providerTaxIdSSN", "333-22-2222");
testPage.clickContinue();

// registration-service-languages
// assertThat(testPage.hasErrorText(getEnMessage("registration-service-languages.title"))).isTrue();
//registration-service-languages
assertThat(testPage.getTitle()).isEqualTo(getEnMessage("registration-service-languages.title"));
testPage.clickElementById("providerLanguagesOffered-Spanish-label");
testPage.clickContinue();

// registration-start-date
Expand Down
Loading

0 comments on commit a300f6f

Please sign in to comment.