From eb70c654467400dd8f4b4da1b35cf5bfec6c968b Mon Sep 17 00:00:00 2001 From: albinagu <47886428+albinagu@users.noreply.github.com> Date: Tue, 18 Jun 2024 12:45:36 +0000 Subject: [PATCH] fix(estate): bug fix (#15254) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../AdditionalEstateMember.tsx | 2 +- .../src/fields/AssetsRepeater/index.tsx | 38 ++++++++++--------- .../src/lib/utils/helpers.ts | 5 ++- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/libs/application/templates/estate/src/fields/EstateMembersRepeater/AdditionalEstateMember.tsx b/libs/application/templates/estate/src/fields/EstateMembersRepeater/AdditionalEstateMember.tsx index ebdf90c25669..8c887f79d2b0 100644 --- a/libs/application/templates/estate/src/fields/EstateMembersRepeater/AdditionalEstateMember.tsx +++ b/libs/application/templates/estate/src/fields/EstateMembersRepeater/AdditionalEstateMember.tsx @@ -181,7 +181,7 @@ export const AdditionalEstateMember = ({ options={relationOptions} error={error?.relation} backgroundColor="blue" - required + required={!field.initial} /> {application.answers.selectedEstate === diff --git a/libs/application/templates/inheritance-report/src/fields/AssetsRepeater/index.tsx b/libs/application/templates/inheritance-report/src/fields/AssetsRepeater/index.tsx index 7cbe11193827..5a7921d3e94d 100644 --- a/libs/application/templates/inheritance-report/src/fields/AssetsRepeater/index.tsx +++ b/libs/application/templates/inheritance-report/src/fields/AssetsRepeater/index.tsx @@ -413,29 +413,31 @@ const RealEstateNumberField = ({ }, [queryLoading]) useEffect(() => { - const propertyNumber = propertyNumberInput - .trim() - .toUpperCase() - .replace('-', '') + if (!props.readOnly) { + const propertyNumber = propertyNumberInput + .trim() + .toUpperCase() + .replace('-', '') - setValue(descriptionFieldName, '') + setValue(descriptionFieldName, '') - if (isValidRealEstate(propertyNumber)) { - clearErrors(fieldName) + if (isValidRealEstate(propertyNumber)) { + clearErrors(fieldName) - getProperty({ - variables: { - input: { - propertyNumber, + getProperty({ + variables: { + input: { + propertyNumber, + }, }, - }, - }) - } else { - if (propertyNumber.length !== 0) { - setError(fieldName, { - message: formatMessage(m.errorPropertyNumber), - type: 'validate', }) + } else { + if (propertyNumber.length !== 0) { + setError(fieldName, { + message: formatMessage(m.errorPropertyNumber), + type: 'validate', + }) + } } } // eslint-disable-next-line react-hooks/exhaustive-deps diff --git a/libs/application/templates/inheritance-report/src/lib/utils/helpers.ts b/libs/application/templates/inheritance-report/src/lib/utils/helpers.ts index c5769bedce58..638218839390 100644 --- a/libs/application/templates/inheritance-report/src/lib/utils/helpers.ts +++ b/libs/application/templates/inheritance-report/src/lib/utils/helpers.ts @@ -21,8 +21,9 @@ export const currencyStringToNumber = (str: string) => { return parseInt(cleanString, 10) } -export const isValidString = (string: string | undefined) => - string && /\S/.test(string) +export const isValidString = (string: string | undefined) => { + return string && /\S/.test(string) +} export const getEstateDataFromApplication = ( application: Application,