From 346c3d9caa991dbe83979ca9db4c2789393db1d8 Mon Sep 17 00:00:00 2001 From: Alistair Laing Date: Wed, 20 Nov 2024 07:30:52 +0000 Subject: [PATCH 1/2] Update copy to reflect the attributes users will be searching on --- .../pages/temporary-accommodation/manage/bedspaceSearch.ts | 2 +- .../bedspace-search/partials/search-fields.njk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress_shared/pages/temporary-accommodation/manage/bedspaceSearch.ts b/cypress_shared/pages/temporary-accommodation/manage/bedspaceSearch.ts index ec99bf513..6b0be6cf0 100644 --- a/cypress_shared/pages/temporary-accommodation/manage/bedspaceSearch.ts +++ b/cypress_shared/pages/temporary-accommodation/manage/bedspaceSearch.ts @@ -64,7 +64,7 @@ export default class BedspaceSearchPage extends Page { this.checkCheckboxByNameAndValue('probationDeliveryUnits[]', pdu) }) - this.getLegend('Bedspace attributes') + this.getLegend('Property attributes') this.getLegend('Occupancy (optional)') searchParameters.attributes.forEach(attribute => { this.checkCheckboxByNameAndValue('attributes[]', attribute) diff --git a/server/views/temporary-accommodation/bedspace-search/partials/search-fields.njk b/server/views/temporary-accommodation/bedspace-search/partials/search-fields.njk index 185941161..296439478 100644 --- a/server/views/temporary-accommodation/bedspace-search/partials/search-fields.njk +++ b/server/views/temporary-accommodation/bedspace-search/partials/search-fields.njk @@ -59,7 +59,7 @@ {% call govukFieldset({ legend: { - text: "Bedspace attributes", + text: "Property attributes", classes: "govuk-fieldset__legend--m" } }) %} From 2b5565c7a0842b1e8f98df4ce8dea205d6936f92 Mon Sep 17 00:00:00 2001 From: Alistair Laing Date: Wed, 20 Nov 2024 09:01:33 +0000 Subject: [PATCH 2/2] Add "Wheelchair accessible" filter to bedspace search --- .../manage/bedspaceSearch.ts | 16 +++- .../factories/bedSearchParameters.ts | 2 +- .../partials/search-fields.njk | 74 +++++++++++++------ 3 files changed, 64 insertions(+), 28 deletions(-) diff --git a/cypress_shared/pages/temporary-accommodation/manage/bedspaceSearch.ts b/cypress_shared/pages/temporary-accommodation/manage/bedspaceSearch.ts index 6b0be6cf0..46bf044de 100644 --- a/cypress_shared/pages/temporary-accommodation/manage/bedspaceSearch.ts +++ b/cypress_shared/pages/temporary-accommodation/manage/bedspaceSearch.ts @@ -66,9 +66,19 @@ export default class BedspaceSearchPage extends Page { this.getLegend('Property attributes') this.getLegend('Occupancy (optional)') - searchParameters.attributes.forEach(attribute => { - this.checkCheckboxByNameAndValue('attributes[]', attribute) - }) + searchParameters.attributes + .filter(attribute => attribute === 'wheelchairAccessible') + .forEach(attribute => { + this.checkCheckboxByNameAndValue('attributes[]', attribute) + }) + + this.getLegend('Bedspace attributes') + this.getLegend('Accessibility (optional)') + searchParameters.attributes + .filter(attribute => attribute !== 'wheelchairAccessible') + .forEach(attribute => { + this.checkCheckboxByNameAndValue('attributes[]', attribute) + }) } clickBedspaceLink(room: Room) { diff --git a/server/testutils/factories/bedSearchParameters.ts b/server/testutils/factories/bedSearchParameters.ts index 48b6c6698..b01478e2f 100644 --- a/server/testutils/factories/bedSearchParameters.ts +++ b/server/testutils/factories/bedSearchParameters.ts @@ -8,7 +8,7 @@ import { import { DateFormats } from '../../utils/dateUtils' import referenceData from './referenceData' -const bedSearchAttributes: Array = ['singleOccupancy', 'sharedProperty'] +const bedSearchAttributes: Array = ['singleOccupancy', 'sharedProperty', 'wheelchairAccessible'] export default Factory.define(() => ({ startDate: DateFormats.dateObjToIsoDate(faker.date.soon()), diff --git a/server/views/temporary-accommodation/bedspace-search/partials/search-fields.njk b/server/views/temporary-accommodation/bedspace-search/partials/search-fields.njk index 296439478..b684ffb32 100644 --- a/server/views/temporary-accommodation/bedspace-search/partials/search-fields.njk +++ b/server/views/temporary-accommodation/bedspace-search/partials/search-fields.njk @@ -57,27 +57,53 @@ fieldName: "probationDeliveryUnits" }, fetchContext()) }} -{% call govukFieldset({ - legend: { - text: "Property attributes", - classes: "govuk-fieldset__legend--m" - } -}) %} - {{ formPageCheckboxes({ - classes: "govuk-checkboxes--small", - fieldName: "attributes", - fieldset: { - legend: { - text: "Occupancy (optional)", - classes: "govuk-fieldset__legend--s" - } - }, - hint: { - text: "Select all that apply" - }, - items: [ - { text: "Single", value: "singleOccupancy" }, - { text: "Shared", value: "sharedProperty" } - ] - }, fetchContext()) }} -{% endcall %} +
+
+ {% call govukFieldset({ + legend: { + text: "Property attributes", + classes: "govuk-fieldset__legend--m" + } + }) %} + {{ formPageCheckboxes({ + classes: "govuk-checkboxes--small", + fieldName: "attributes", + fieldset: { + legend: { + text: "Occupancy (optional)", + classes: "govuk-fieldset__legend--s" + } + }, + hint: { + text: "Select all that apply" + }, + items: [ + { text: "Single", value: "singleOccupancy" }, + { text: "Shared", value: "sharedProperty" } + ] + }, fetchContext()) }} + {% endcall %} +
+
+ {% call govukFieldset({ + legend: { + text: "Bedspace attributes", + classes: "govuk-fieldset__legend--m" + } + }) %} + {{ formPageCheckboxes({ + classes: "govuk-checkboxes--small", + fieldName: "attributes", + fieldset: { + legend: { + text: "Accessibility (optional)", + classes: "govuk-fieldset__legend--s" + } + }, + items: [ + { text: "Wheelchair accessible", value: "wheelchairAccessible" } + ] + }, fetchContext()) }} + {% endcall %} +
+