From 17aa4db60eb13c70d60f85426104fe4469af6c4c Mon Sep 17 00:00:00 2001 From: ttingle-ch Date: Thu, 21 Nov 2024 09:44:42 +0000 Subject: [PATCH 1/2] Fixed country name and premise not being retained on error Fixed wrong hint text showing on business address lookup screen --- locales/cy/address-look-up.json | 1 + locales/en/address-look-up.json | 1 + .../correspondence-address/correspondence-address-manual.ts | 6 +++--- .../capture-correspondence-address-manual.njk | 5 ++++- .../business-address-auto-lookup/auto-lookup-address.njk | 2 +- src/views/partials/country-typeahead-input.njk | 2 +- .../correspondence-address-manual.test.ts | 6 +++--- 7 files changed, 14 insertions(+), 9 deletions(-) diff --git a/locales/cy/address-look-up.json b/locales/cy/address-look-up.json index 4cf07dea..2683551f 100644 --- a/locales/cy/address-look-up.json +++ b/locales/cy/address-look-up.json @@ -4,6 +4,7 @@ "correspondenceLookUpAddressPostCodeInput": "Cod post y DU", "correspondenceLookUpAddressInputHint1": "Enw neu rif eiddo", "correspondenceLookUpAddressInputHint2": "Bydd angen i chi cofnodi'r cyfeiriad â llaw os nad yw yn y Deyrnas Unedig", + "businessLookUpAddressPostcodeHint": "Er enghraifft, 'Y Felin', '116' neu 'Fflat 37a'", "correspondenceLookUpAddressFindAddressBtn": "Dod o hyd i gyfeiriad", "correspondenceLookUpAddressManuallyBtn": "Cofnodwch y cyfeiriad â llaw", "correspondenceLookUpAddressListTitle": "Dewiswch y cyfeiriad gohebiaeth", diff --git a/locales/en/address-look-up.json b/locales/en/address-look-up.json index 2a0b5bb9..99bfe2db 100644 --- a/locales/en/address-look-up.json +++ b/locales/en/address-look-up.json @@ -4,6 +4,7 @@ "correspondenceLookUpAddressPostCodeInput": "UK postcode", "correspondenceLookUpAddressInputHint1": "Property name or number", "correspondenceLookUpAddressInputHint2": "You'll need to enter the address manually if it's not in the UK", + "businessLookUpAddressPostcodeHint": "For example, The Mill', '116' or 'Flat 37a'", "correspondenceLookUpAddressFindAddressBtn": "Find address", "correspondenceLookUpAddressManuallyBtn": "Enter address manually", "correspondenceLookUpAddressListTitle": "Select the correspondence address", diff --git a/src/services/correspondence-address/correspondence-address-manual.ts b/src/services/correspondence-address/correspondence-address-manual.ts index 1b441429..432c2081 100644 --- a/src/services/correspondence-address/correspondence-address-manual.ts +++ b/src/services/correspondence-address/correspondence-address-manual.ts @@ -10,7 +10,7 @@ export class CorrespondenceAddressManualService { addressLine2: req.body.addressLine2, locality: req.body.addressTown, region: req.body.addressCounty, - country: req.body.addressCountry, + country: req.body.countryInput, postalCode: req.body.addressPostcode }; const applicantDetails = acspData.applicantDetails || {}; @@ -20,12 +20,12 @@ export class CorrespondenceAddressManualService { public getCorrespondenceManualAddress (acspData: AcspData) { return { - propertyDetails: acspData?.applicantDetails?.correspondenceAddress?.premises, + addressPropertyDetails: acspData?.applicantDetails?.correspondenceAddress?.premises, addressLine1: acspData?.applicantDetails?.correspondenceAddress?.addressLine1, addressLine2: acspData?.applicantDetails?.correspondenceAddress?.addressLine2, addressTown: acspData?.applicantDetails?.correspondenceAddress?.locality, addressCounty: acspData?.applicantDetails?.correspondenceAddress?.region, - addressCountry: + countryInput: acspData?.applicantDetails?.correspondenceAddress?.country, addressPostcode: acspData?.applicantDetails?.correspondenceAddress?.postalCode diff --git a/src/views/common/correspondence-address-manual/capture-correspondence-address-manual.njk b/src/views/common/correspondence-address-manual/capture-correspondence-address-manual.njk index ec095d96..47b66e14 100644 --- a/src/views/common/correspondence-address-manual/capture-correspondence-address-manual.njk +++ b/src/views/common/correspondence-address-manual/capture-correspondence-address-manual.njk @@ -31,7 +31,7 @@ }, id: "addressPropertyDetails", name: "addressPropertyDetails", - value: payload["propertyDetails"], + value: payload["addressPropertyDetails"], errorMessage: { text: errors["addressPropertyDetails"].text } if errors.addressPropertyDetails @@ -85,6 +85,9 @@
{% set dropdownDefaultText = i18n.whereDoYouLiveDefaultDropdownText %} + {% if payload.countryInput | length %} + {% set dropdownValue = payload.countryInput %} + {% endif %}

{{ i18n.whereDoYouLiveHint }}

{% set errorMessage = errors %} diff --git a/src/views/features/unincorporated/business-address-auto-lookup/auto-lookup-address.njk b/src/views/features/unincorporated/business-address-auto-lookup/auto-lookup-address.njk index 11d90857..cd1ffdfb 100644 --- a/src/views/features/unincorporated/business-address-auto-lookup/auto-lookup-address.njk +++ b/src/views/features/unincorporated/business-address-auto-lookup/auto-lookup-address.njk @@ -38,7 +38,7 @@ autocomplete: "street-address", value: payload.premise, hint: { - text: i18n.correspondenceLookUpAddressInputHint2, + text: i18n.businessLookUpAddressPostcodeHint, classes: "govuk-hint" } }) }} diff --git a/src/views/partials/country-typeahead-input.njk b/src/views/partials/country-typeahead-input.njk index 680dcf46..d14ebc96 100644 --- a/src/views/partials/country-typeahead-input.njk +++ b/src/views/partials/country-typeahead-input.njk @@ -2,7 +2,7 @@