From 0f9ead72459dddb3e0573bebafa04cf751ac7d82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Zi=C4=99cina?= Date: Fri, 1 Dec 2023 17:02:57 +0100 Subject: [PATCH] feat: add address verification for preferences step (#3715) * feat: add collectAddress checkbox with subfields * test: update preference tests * fix: add minimum value validation for radius field * fix: make collect address not required * fix: expand collect address fields * fix: change fields order in PreferenceDrawer * feat: add address holder fields to application * fix: make added field optional * fix: display errors properly * feat: add address holder fields to application summary * feat: add address verification for preferences step * feat: adjust padding for application summary * fix: move address holder name and relationship fields to extraData * fix: remove redundant backend address holder fields * fix: use enum for address holder fields * fix: add alternate address form component * fix: remove redundant fields from new address form * fix: verify preferences address when collectAddress true * fix: block going back on address verification add string to translation * fix: use onClick to block address Verification back button --- shared-helpers/src/locales/general.json | 1 + .../views/address/FormAddressAlternate.tsx | 102 +++++++++++++++ .../src/views/multiselectQuestions.tsx | 4 +- .../ApplicationMultiselectQuestionStep.tsx | 122 ++++++++++++++---- .../applications/ValidateAddress.tsx | 10 +- 5 files changed, 211 insertions(+), 28 deletions(-) create mode 100644 shared-helpers/src/views/address/FormAddressAlternate.tsx diff --git a/shared-helpers/src/locales/general.json b/shared-helpers/src/locales/general.json index e72dca11fc..bcc8cf8e98 100644 --- a/shared-helpers/src/locales/general.json +++ b/shared-helpers/src/locales/general.json @@ -92,6 +92,7 @@ "application.contact.suggestedAddress": "Suggested Address:", "application.contact.title": "Thanks %{firstName}. Now we need to know how to contact you.", "application.contact.verifyAddressTitle": "We have located the following address. Please confirm it's correct.", + "application.contact.verifyMultipleAddresses": "Since there are multiple options for this preference, you’ll need to verify multiple addresses.", "application.contact.workAddress": "Work Address", "application.contact.youEntered": "You Entered:", "application.contact.yourAdditionalPhoneNumber": "Your Second Phone Number", diff --git a/shared-helpers/src/views/address/FormAddressAlternate.tsx b/shared-helpers/src/views/address/FormAddressAlternate.tsx new file mode 100644 index 0000000000..73367403f9 --- /dev/null +++ b/shared-helpers/src/views/address/FormAddressAlternate.tsx @@ -0,0 +1,102 @@ +import { UseFormMethods } from "react-hook-form" +import { Field, resolveObject, Select, t } from "@bloom-housing/ui-components" +import React from "react" + +type FormAddressProps = { + subtitle?: string + dataKey: string + register: UseFormMethods["register"] + errors?: UseFormMethods["errors"] + required?: boolean + stateKeys: string[] +} + +export const FormAddressAlternate = ({ + subtitle, + dataKey, + register, + errors, + required, + stateKeys, +}: FormAddressProps) => { + return ( + <> + + {!subtitle ? t("application.preferences.options.address") : subtitle} + + + + + +
+ + +