Skip to content

Commit

Permalink
MAN-172: No fixed address and error fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pmcphee77 committed Feb 5, 2025
1 parent 97d44aa commit eef139f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
Original file line number Diff line number Diff line change
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: errorMessages | toErrorList }) }}
{% 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

0 comments on commit eef139f

Please sign in to comment.