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

MAN-172: No fixed address and error fixes #307

Merged
merged 1 commit into from
Feb 5, 2025
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
2 changes: 1 addition & 1 deletion integration_tests/e2e/personalDetails.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ context('Personal Details', () => {
page.getRowData('contactDetails', 'telephoneNumber', 'Value').should('contain.text', '0123456999')
page.getRowData('contactDetails', 'mobileNumber', 'Value').should('contain.text', '071838893')
page.getRowData('contactDetails', 'emailAddress', 'Value').should('contain.text', 'address1@gmail.com')
page.getRowData('contactDetails', 'mainAddress', 'Value').should('contain.text', '32 SCOTLAND STREET')
page.getRowData('contactDetails', 'mainAddress', 'Value').should('contain.text', 'No fixed address')
page.getRowData('contactDetails', 'otherAddresses', 'Value').should('contain.text', '1 other address')
page.getRowData('contactDetails', 'contacts', 'Value').should('contain.text', 'Steve Wilson – GP (secondary)')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{% set headerGender = personalDetails.preferredGender %}
{% set dateWarning = 'An end date will change this to a previous address and you will need to add a new main address.' %}
{% set addressTypeSelectItems = [{text: "Select address type", value: null }] %}
{% for addressType in personalDetails.addressTypes %}
{% for addressType in personalDetails.addressTypes|sort(attribute='description') %}
{% set addressTypeSelectItems = (addressTypeSelectItems.push({
selected: personalDetails.mainAddress.typeCode === addressType.code,
text: addressType.description,
Expand Down Expand Up @@ -55,7 +55,10 @@
}) if personalDetails.mainAddress.to }}

{% if errorMessages %}
{{ govukErrorSummary({ titleText: "There is a problem", errorList: errorMessages | toErrorList }) }}
{% set errorList = errorMessages | toErrorList %}
{% if errorList > 0 %}
{{ govukErrorSummary({ titleText: "There is a problem", errorList: errorList }) }}
{% endif %}
{% endif %}

{% endblock %}
Expand Down
13 changes: 8 additions & 5 deletions server/views/pages/personal-details.njk
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,16 @@
{% block pageContent %}
{% set contactDetails %}
{% set mainAddress = personalDetails.mainAddress %}

{% set address %}
{% if personalDetails.mainAddress %}
{% set addressAsList = addressToList(mainAddress, noFixedAddress) %}
{% if addressAsList.length > 0 %}
{{ addressAsList.join('<br>') | safe }}
<br/>
{% if mainAddress.noFixedAddress === true %}
No fixed address
{% else %}
{% set addressAsList = addressToList(mainAddress) %}
{% if addressAsList.length > 0 %}
{{ addressAsList.join('<br>') | safe }}
<br/>
{% endif %}
{% endif %}
<p class="govuk-!-margin-top-2 govuk-!-margin-bottom-0">
<span class="govuk-summary-list__key govuk-!-padding-bottom-0" data-qa="addressTypeLabel">Type of address</span>
Expand Down
9 changes: 4 additions & 5 deletions server/views/pages/personal-details/_address.njk
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@

{% set addressHtml %}
{% set fullAddress %}
{% if address.noFixedAbode %}
No fixed abode<br />
{{ address.type }}
{% if address.noFixedAddress %}
No fixed address
{% else %}
{{ addressToList(address).join('<br>') | safe }}
{% endif %}

{{ addressToList(address).join('<br>') | safe }}
{% endset %}

{{ govukSummaryList({
Expand Down
21 changes: 11 additions & 10 deletions server/views/pages/personal-details/addresses.njk
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,19 @@
iconFallbackText: 'Warning'
}) }} -->

<p>
<a href="{{ deliusDeepLinkUrl('AddressandAccommodation', crn) }}" target="_blank">Update addresses on NDelius (opens in new tab)</a>
</p>

{% set address = addressOverview.mainAddress %}
<span data-qa="mainAddressSection">
{% set addressType = 'address' %}
{% set loopIndex = '' %}
{% include './_address.njk' %}
</span>
{% if addressOverview.mainAddress %}
<p>
<a href="{{ deliusDeepLinkUrl('AddressandAccommodation', crn) }}" target="_blank">Update addresses on NDelius (opens in new tab)</a>
</p>
<span data-qa="mainAddressSection">
{% set addressType = 'address' %}
{% set loopIndex = '' %}
{% include './_address.njk' %}
</span>
{% endif %}

{% if addressOverview.otherAddresses.length > 0 %}
{% if addressOverview.otherAddresses.length > 0 %}
<h2 class="govuk-heading-l govuk-!-margin-top-8">Other addresses</h2>
<p>
<a href="{{ deliusDeepLinkUrl('AddressandAccommodation', crn) }}" target="_blank">Edit all other addresses on NDelius (opens in new tab)</a>
Expand Down
Loading