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

Add docUploadOwner and docUploadReviewOwner screens #704

Merged
merged 7 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
Expand Up @@ -446,8 +446,14 @@ public class LaDigitalAssister extends FlowInputs {

private String continueAssociateDocType;

private String continueDocOwner;

@NotBlank(message = "{doc-type.select-a-type}")
@DynamicField
private String docType;

@NotBlank(message = "{document-who.please-select}")
@DynamicField
private String documentOwner;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.ladocuploader.app.submission.conditions;

import formflow.library.data.Submission;
import org.springframework.stereotype.Component;

@Component
public class ContinueDocOwner extends BasicCondition {

@Override
public Boolean run(Submission submission) {
return run(submission, "continueDocOwner", "true");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,11 @@ public static ArrayList<HashMap<String, Object>> getHouseholdIncomeReviewItems(S
public static String getDecryptedSSNKeyName(String uuid) {
return "householdMemberSsn%s%s".formatted(DYNAMIC_FIELD_MARKER, uuid);
}

public static String getHouseholdMemberNameByFileId(UUID fileId, Submission submission) {
if (submission.getInputData().containsKey("documentOwner_wildcard_" + fileId)) {
return submission.getInputData().get("documentOwner_wildcard_" + fileId).toString();
}
return "";
}
}
16 changes: 13 additions & 3 deletions src/main/resources/flows-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -536,10 +536,18 @@ flow:
docUploadType:
beforeSaveAction: AssociateDocTypeLabel
nextScreens:
- name: docUploadReview
- name: docUploadReviewTypes
condition: ContinueAssociateDocType
- name: docUpload
docUploadReview:
docUploadReviewTypes:
nextScreens:
- name: docUploadOwner
docUploadOwner:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny, non blocking. This reads easier when the sections are in order. I'd expect docUploadReviewTypes to be in line 542 and then docUploadOwner to be listed afterward.

nextScreens:
- name: docUploadReviewOwner
condition: ContinueDocOwner
- name: docUpload
docUploadReviewOwner:
nextScreens:
- name: docUploadSubmit
docUploadSubmit:
Expand All @@ -561,7 +569,9 @@ landmarks:
- docUploadRecommendations
- docUpload
- docUploadType
- docUploadReview
- docUploadOwner
- docUploadReviewOwner
- docUploadReviewTypes
- docUploadSubmit
subflows:
household:
Expand Down
8 changes: 8 additions & 0 deletions src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,8 @@ general.add-or-delete-files=Add or delete files
review-documents.continue=Yes, continue
review-documents.edit-document-types=No, edit document types

review-documents-owner.header=Are these documents tagged with the right person?

doc-type.select-a-type=Please select a document type
add-document-types.title=Select document types
add-document-types.header=Select the document types
Expand All @@ -1212,6 +1214,12 @@ add-document-types.doc-type-label.legal.court-order=Court Order
add-document-types.doc-type-label.paternity.ack-of-paternity=Acknowledgement of Paternity
add-document-types.doc-type-label.correspondence.other=Other

#Doc Upload Who
document-who.title=Select who each document belongs to
document-who.header=Select who the document belongs to
document-who.placeholder=Select a person
document-who.please-select=Please select which person this document is for

# doc upload intro
doc-upload-intro.title=Doc upload intro
doc-upload-intro.header=Your application is complete! Would you like to upload documents?
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/messages_vi.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,8 @@ general.add-or-delete-files=Thêm ho\u1eb7c xóa t\u1eadp tin
review-documents.continue=Vâng, ti\u1ebfp t\u1ee5c
review-documents.edit-document-types=Không, ch\u1ec9nh s\u1eeda lo\u1ea1i gi\u1ea5y t\u1edd

review-documents-owner.header=Nh\u1EEFng t\u00E0i li\u1EC7u n\u00E0y c\u00F3 \u0111\u01B0\u1EE3c g\u1EAFn th\u1EBB v\u1EDBi ng\u01B0\u1EDDi \u0111\u00FAng kh\u00F4ng?

doc-type.select-a-type=Vui lòng ch\u1ecdn lo\u1ea1i gi\u1ea5y t\u1edd
add-document-types.title=Ch\u1ecdn lo\u1ea1i gi\u1ea5y t\u1edd
add-document-types.header=Ch\u1ecdn lo\u1ea1i gi\u1ea5y t\u1edd
Expand All @@ -1214,6 +1216,11 @@ add-document-types.doc-type-label.legal.court-order=L\u1ec7nh c\u1ee7a tòa án
add-document-types.doc-type-label.paternity.ack-of-paternity=Gi\u1ea5y xác nh\u1eadn quan h\u1ec7 cha con
add-document-types.doc-type-label.correspondence.other=Khác

document-who.title=Ch\u1ECDn ng\u01B0\u1EDDi m\u00E0 m\u1ED7i t\u00E0i li\u1EC7u thu\u1ED9c v\u1EC1
document-who.header=Ch\u1ECDn ng\u01B0\u1EDDi m\u00E0 t\u00E0i li\u1EC7u thu\u1ED9c v\u1EC1
document-who.placeholder=Ch\u1ECDn m\u1ED9t ng\u01B0\u1EDDi
document-who.please-select=Vui l\u00F2ng ch\u1ECDn ng\u01B0\u1EDDi m\u00E0 t\u00E0i li\u1EC7u n\u00E0y d\u00E0nh cho

# doc upload intro
doc-upload-intro.title=Gi\u1edbi thi\u1ec7u t\u1ea3i gi\u1ea5y t\u1edd lên
doc-upload-intro.header=\u0110\u01a1n \u0111\u0103ng ký c\u1ee7a quý v\u1ecb \u0111ã hoàn t\u1ea5t! Quý v\u1ecb có mu\u1ed1n t\u1ea3i gi\u1ea5y t\u1edd lên không?
Expand Down
6 changes: 5 additions & 1 deletion src/main/resources/templates/fragments/fileDetails.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<th:block
th:fragment="fileDetails(userFile)"
th:fragment="fileDetails(userFile, person)"
th:id="${userFile.get('originalFilename')}"
th:with="extIndex=${userFile.get('originalFilename').lastIndexOf('.')},
docTypeInfo=${showDocType != null ? showDocType : true}">
Expand All @@ -22,6 +22,10 @@
<div class="display-flex file-details">
<div class="dz-detail">
<span th:if="${docTypeInfo == true}" th:text="${'Type: ' + #messages.msg(T(org.ladocuploader.app.file.DocTypeEnum).findNameSrcForValue(userFile.get('docTypeLabel')))}"></span>
<th:block th:if="${person != ''}">
<br />
<span th:text="${'Person: ' + person}"></span>
</th:block>
</div>
</div>
<div class="display-flex body-gray file-details">
Expand Down
64 changes: 64 additions & 0 deletions src/main/resources/templates/laDigitalAssister/docUploadOwner.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html th:lang="${#locale.language}">
<head th:replace="~{fragments/head :: head(title=#{document-who.title}, useDropzone=false)}"></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=#{document-who.header})}"/>
<th:block th:replace="~{fragments/form :: form(action=${formAction}, content=~{::clientInfoFormContents})}">
<th:block th:ref="clientInfoFormContents"
th:with="
fileIds = ${T(org.ladocuploader.app.utils.UserFileUtilities).getUserFileIdsInOrder(userFiles)},
userFileInfo = ${T(org.ladocuploader.app.utils.UserFileUtilities).getUserFileInfo(session.userFiles, userFiles, flow, 'uploadDocuments')},
numberOfFiles = ${userFileInfo.keySet().size()},
maxFiles=${@environment.getProperty('form-flow.uploads.max-files')}">
<div th:id="upload-doc-div-details" class="spacing-below-25">
<p th:if="${numberOfFiles == 1}" th:id="upload-doc-text-details" class="upload-doc-text" th:text="#{general.files.file-added.one(${maxFiles})}"></p>
<p th:if="${numberOfFiles > 1}" th:id="upload-doc-text-details" class="upload-doc-text" th:text="#{general.files.file-added.other(${numberOfFiles}, ${maxFiles})}"></p>
</div>
<div class="form-card__content">
<div class="dropzone file-preview-template preview-container">
<th:block th:each="fileId, iter: ${fileIds}">
<th:block th:with="
userFile=${userFileInfo.get(fileId)},
docWhoInputName=${'documentOwner' + T(formflow.library.inputs.FieldNameMarkers).DYNAMIC_FIELD_MARKER + fileId}">
<th:block th:replace="~{fragments/fileDetails :: fileDetails(userFile=${userFile}, person=${''}, showDocType=false)}"></th:block>
<th:block th:replace="~{fragments/inputs/selectCustom :: select(
inputName=${docWhoInputName},
content=~{::docWho},
ariaDescribedBy=${fileId},
ariaLabel='header')}">
<th:block th:ref="docWho">
<th:block
th:replace="~{fragments/inputs/selectOptionPlaceholder :: selectOptionPlaceholder(optionText=#{document-who.placeholder})}"/>
<th:block th:each="docPerson : ${T(org.ladocuploader.app.utils.SubmissionUtilities).getHouseholdMemberNames(submission)}">
<th:block
th:replace="~{fragments/inputs/selectOption :: selectOption(value=${docPerson}, optionText=${docPerson})}"/>
</th:block>
</th:block>
</th:block>
</th:block>
</th:block>
</div>
</div>
<div class="form-card__footer">
<th:block th:replace="~{fragments/inputs/yesOrNo :: yesOrNo(
inputName='continueDocOwner',
ariaDescribe='header',
overrideNoText=#{general.add-or-delete-files},
overrideYesText=#{general.inputs.continue})}"/>
</div>
</th:block>
</th:block>
</main>
</div>
</section>
</div>
<th:block th:replace="~{fragments/footer :: footer}" />
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html th:lang="${#locale.language}">
<head th:replace="~{fragments/head :: head(title=#{review-documents.title}, useDropzone=false)}"></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=#{review-documents-owner.header})}"/>
<th:block th:replace="~{fragments/form :: form(action=${formAction}, content=~{::clientInfoFormContents})}">
<th:block th:ref="clientInfoFormContents"
th:with="
fileIds = ${T(org.ladocuploader.app.utils.UserFileUtilities).getUserFileIdsInOrder(userFiles)},
userFileInfo = ${T(org.ladocuploader.app.utils.UserFileUtilities).getUserFileInfo(session.userFiles, userFiles, flow, 'uploadDocuments')},
numberOfFiles = ${fileIds.size()},
maxFiles=${@environment.getProperty('form-flow.uploads.max-files')}">
<div th:id="upload-doc-div-details" class="spacing-below-25">
<p th:if="${numberOfFiles == 1}" th:id="upload-doc-text-details" class="upload-doc-text" th:text="#{general.files.file-added.one(${maxFiles})}"></p>
<p th:if="${numberOfFiles > 1}" th:id="upload-doc-text-details" class="upload-doc-text" th:text="#{general.files.file-added.other(${numberOfFiles}, ${maxFiles})}"></p>
</div>
<div class="form-card__content">
<div class="dropzone file-preview-template preview-container">
<th:block th:each="fileId, iter: ${fileIds}">
<th:block th:with="userFile=${userFileInfo.get(fileId)},
personName=${T(org.ladocuploader.app.utils.SubmissionUtilities).getHouseholdMemberNameByFileId(fileId, submission)}">
<th:block th:replace="~{fragments/fileDetails :: fileDetails(userFile=${userFile}, person=${personName})}"></th:block>
</th:block>

</th:block>
</div>
</div>
<div class="form-card__footer">
<th:block th:replace="~{fragments/inputs/submitButton :: submitButton(
text=#{review-documents.continue})}"/>
<a class="button button--secondary" th:href="'/flow/' + ${flow} + '/docUpload'" th:text="#{review-documents.edit-document-types}"></a>
</div>
</th:block>
</th:block>
</main>
</div>
</section>
</div>
<th:block th:replace="~{fragments/footer :: footer}" />
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
<div class="form-card__content">
<div class="dropzone file-preview-template preview-container">
<th:block th:each="fileId, iter: ${fileIds}">
<th:block th:with="userFile=${userFileInfo.get(fileId) }">
<th:block th:replace="~{fragments/fileDetails :: fileDetails(userFile=${userFile})}"></th:block>
<th:block th:with="userFile=${userFileInfo.get(fileId) },
personName=${T(org.ladocuploader.app.utils.SubmissionUtilities).getHouseholdMemberNameByFileId(fileId, submission)}">
<th:block th:replace="~{fragments/fileDetails :: fileDetails(userFile=${userFile}, person=${personName})}"></th:block>
</th:block>

</th:block>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<th:block th:with="
userFile=${userFileInfo.get(fileId)},
docTypeInputName=${'docType' + T(formflow.library.inputs.FieldNameMarkers).DYNAMIC_FIELD_MARKER + fileId}">
<th:block th:replace="~{fragments/fileDetails :: fileDetails(userFile=${userFile}, showDocType=false)}"></th:block>
<th:block th:replace="~{fragments/fileDetails :: fileDetails(userFile=${userFile}, person=${''}, showDocType=false)}"></th:block>

<th:block th:replace="~{fragments/inputs/selectCustom :: select(
inputName=${docTypeInputName},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,6 @@ void fullDigitalAssisterFlow() {
testPage.clickContinue();

assertThat(testPage.getTitle()).isEqualTo(message("utilities.title"));

testPage.clickElementById("householdUtilitiesExpenses-water-label");
testPage.clickContinue();

Expand Down Expand Up @@ -824,7 +823,23 @@ void fullDigitalAssisterFlow() {
assertThat(driver.findElement(By.className("filename-text-ext")).getText()).isEqualTo(".jpeg");
assertThat(driver.findElement(By.className("dz-detail")).findElement(By.tagName("span")).getText()).isEqualTo("Type: Divorce Decree");
testPage.clickButton("Yes, continue");


// Doc owner page
assertThat(testPage.getTitle()).isEqualTo(message("document-who.title"));
WebElement docOwnerSelect = driver.findElements(By.className("select__element")).get(0);
testPage.selectFromDropdown(docOwnerSelect.getAttribute("name"), "roomy smith");
testPage.clickContinue();

// Doc review owner page
assertThat(testPage.getTitle()).isEqualTo(message("review-documents.title"));
assertThat(driver.findElement(By.className("filename-text-name")).getText()).isEqualTo("test");
assertThat(driver.findElement(By.className("filename-text-ext")).getText()).isEqualTo(".jpeg");
List<WebElement> spans = driver.findElement(By.className("dz-detail")).findElements(By.tagName("span"));
assertThat(spans.size()).isEqualTo(2);
assertThat(spans.get(0).getText()).isEqualTo("Type: Divorce Decree");
assertThat(spans.get(1).getText()).isEqualTo("Person: roomy smith");
testPage.clickButton("Yes, continue");

// Confirm submit
assertThat(testPage.getTitle()).isEqualTo(message("doc-submit-confirmation.title"));
testPage.clickButton("No, add more documents");
Expand All @@ -833,6 +848,10 @@ void fullDigitalAssisterFlow() {
testPage.clickContinue();
// review document types
testPage.clickContinue();
// add doc owner
testPage.clickButton("Yes, continue");
// review document owner
testPage.clickContinue();
// doc submit confirmation
testPage.clickButton("Yes, continue");
// final confirmation
Expand Down