Skip to content

Commit

Permalink
Prevent adding legally closed organisations (#108)
Browse files Browse the repository at this point in the history
The ODS API which we use to populate the autocomplete for the
organisation search lets you filter out 'inactive' organisations,
however you cannot filter out organisations which are legally closed but
still operationally open.

We can do a check for this, but this would have to happen on the
subsequent page once an organisation has been selected.

This design would prevent you continuing if you select one of these
legally-closed organisations, by adding a warning message at the top and
removing the Continue button.

## Screenshot

![Screenshot 2024-09-16 at 17 08
29](https://github.com/user-attachments/assets/62b553b9-0abf-4b66-9e53-8a6b0f34eb49)
  • Loading branch information
frankieroberto authored Sep 16, 2024
1 parent 0394463 commit 569e807
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
3 changes: 2 additions & 1 deletion app/data/session-data-defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,8 @@ module.exports = {
"FAH85": {"name": "Boots", "address": "77 High Street", "town": "Bromley", "postcode": "Br1 1Jy"},
"FAH9": {"name": "Whittington Pharmacy", "address": "13B Main Street,Whittington", "postcode": "Lichfield", "postcode": "Ws14 9Ju"},
"FAH94": {"name": "Lo'S Pharmacy,Outwood Park Medical Centre,Potovens Lane,Outwood,Wakefield", "postcode": "Wf1 2Pe"},
"FAJ00": {"name": "Jades Chemist", "address": "19 The Parade", "town": "Crawley", "postcode": "Rh10 8Dt"}
"FAJ00": {"name": "Jades Chemist", "address": "19 The Parade", "town": "Crawley", "postcode": "Rh10 8Dt"},
"FAZZZ": {"name": "Legally Closed Pharamcy", "address": "30 Legal Close", "town": "London", "postcode": "CL0 5ED", legallyClosed: "2001-02-04"}
},
"sites": {
"RWX15": {
Expand Down
7 changes: 5 additions & 2 deletions app/routes/regions.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,18 @@ module.exports = router => {
router.get('/regions/v1/organisation-details', (req, res) => {
const organisationCode = req.session.data.organisationCode

let organisationName, organisationLine1, organisationTown, organisationPostcode, organisationType
let organisationName, organisationLine1, organisationTown, organisationPostcode, organisationType, legallyClosed

if (organisationCode.startsWith('FA')) {
organisationName = req.session.data.nhsPharmacies[organisationCode].name
organisationLine1 = req.session.data.nhsPharmacies[organisationCode].address
organisationTown = req.session.data.nhsPharmacies[organisationCode].town
organisationPostcode = req.session.data.nhsPharmacies[organisationCode].postcode
legallyClosed = req.session.data.nhsPharmacies[organisationCode].legallyClosed
organisationType = 'Community Pharmacy'
} else {
organisationName = req.session.data.nhsTrusts[organisationCode]
legallyClosed = false
organisationLine1 = 'Cobbett House, Oxford Road'
organisationTown = 'Manchester'
organisationPostcode = 'M13 9WL'
Expand All @@ -80,7 +82,8 @@ module.exports = router => {
line1: organisationLine1,
town: organisationTown,
postcode: organisationPostcode
}
},
legallyClosed: legallyClosed
}

res.render('regions/v1/organisation-details', {
Expand Down
22 changes: 18 additions & 4 deletions app/views/regions/v1/organisation-details.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@

<h1 class="nhsuk-heading-xl">Organisation</h1>

{% if organisation.legallyClosed %}

{% set warningHtml %}
<p>This organisation was legally closed on {{ organisation.legallyClosed | govukDate }} and cannot be added.</p>
{% endset %}

{{ warningCallout({
heading: "Important",
HTML: warningHtml
}) }}
{% endif %}

{{ summaryList({
rows: [
{
Expand Down Expand Up @@ -60,12 +72,14 @@ <h1 class="nhsuk-heading-xl">Organisation</h1>
]
}) }}

{% if not organisation.legallyClosed %}

{{ button({
"text": "Continue",
href: "/regions/v1/add-email"
}) }}
{{ button({
"text": "Continue",
href: "/regions/v1/add-email"
}) }}

{% endif %}

</div>
</div>
Expand Down

0 comments on commit 569e807

Please sign in to comment.