diff --git a/integration_tests/e2e/viewLocations/index.cy.ts b/integration_tests/e2e/viewLocations/index.cy.ts index b80609a8..88547e8a 100644 --- a/integration_tests/e2e/viewLocations/index.cy.ts +++ b/integration_tests/e2e/viewLocations/index.cy.ts @@ -29,7 +29,9 @@ context('View Locations Index', () => { cy.task('stubManageUsersMe') cy.task('stubManageUsersMeCaseloads') cy.task('stubLocationsConstantsAccommodationType') + cy.task('stubLocationsConstantsConvertedCellType') cy.task('stubLocationsConstantsDeactivatedReason') + cy.task('stubLocationsConstantsLocationType') cy.task('stubLocationsConstantsSpecialistCellType') cy.task('stubLocationsConstantsUsedForType') cy.task('stubLocationsLocationsResidentialSummary') diff --git a/integration_tests/e2e/viewLocations/show.cy.ts b/integration_tests/e2e/viewLocations/show.cy.ts index 915a9a76..a7f2d864 100644 --- a/integration_tests/e2e/viewLocations/show.cy.ts +++ b/integration_tests/e2e/viewLocations/show.cy.ts @@ -63,7 +63,9 @@ context('View Locations Show', () => { cy.task('stubManageUsersMe') cy.task('stubManageUsersMeCaseloads') cy.task('stubLocationsConstantsAccommodationType') + cy.task('stubLocationsConstantsConvertedCellType') cy.task('stubLocationsConstantsDeactivatedReason') + cy.task('stubLocationsConstantsLocationType') cy.task('stubLocationsConstantsSpecialistCellType') cy.task('stubLocationsConstantsUsedForType') }) @@ -181,11 +183,27 @@ context('View Locations Show', () => { detailsRows += 1 } - viewLocationsShowPage - .locationDetailsRows() - .eq(detailsRows) - .find('.govuk-summary-list__key') - .contains('Accommodation type') + if (location.status !== 'NON_RESIDENTIAL') { + if (location.locationType === 'CELL') { + viewLocationsShowPage + .locationDetailsRows() + .eq(detailsRows) + .find('.govuk-summary-list__key') + .contains('Cell type') + } else { + viewLocationsShowPage + .locationDetailsRows() + .eq(detailsRows) + .find('.govuk-summary-list__key') + .contains('Accommodation type') + } + } else { + viewLocationsShowPage + .locationDetailsRows() + .eq(detailsRows) + .find('.govuk-summary-list__key') + .contains('Non-residential room') + } viewLocationsShowPage .locationDetailsRows() .eq(detailsRows) @@ -207,17 +225,19 @@ context('View Locations Show', () => { detailsRows += 1 } - viewLocationsShowPage - .locationDetailsRows() - .eq(detailsRows) - .find('.govuk-summary-list__key') - .contains('Last updated') - viewLocationsShowPage - .locationDetailsRows() - .eq(detailsRows) - .find('.govuk-summary-list__value') - .contains('Today by john smith') - detailsRows += 1 + if (!location.leafLevel) { + viewLocationsShowPage + .locationDetailsRows() + .eq(detailsRows) + .find('.govuk-summary-list__key') + .contains('Last updated') + viewLocationsShowPage + .locationDetailsRows() + .eq(detailsRows) + .find('.govuk-summary-list__value') + .contains('Today by john smith') + detailsRows += 1 + } viewLocationsShowPage.locationDetailsRows().should('have.length', detailsRows) @@ -407,10 +427,10 @@ context('View Locations Show', () => { locationType: 'CELL', permanentlyInactive: false, accommodationTypes: ['TEST_TYPE'], - specialistCellTypes: [], + specialistCellTypes: ['TEST_TYPE'], usedFor: [], status: 'ACTIVE', - convertedCellType: 'OFFICE', + convertedCellType: 'TEST_TYPE', active: true, deactivatedByParent: false, deactivatedReason: 'TEST_TYPE', diff --git a/integration_tests/mockApis/locationsApi.ts b/integration_tests/mockApis/locationsApi.ts index 32c8b338..413cddbc 100644 --- a/integration_tests/mockApis/locationsApi.ts +++ b/integration_tests/mockApis/locationsApi.ts @@ -19,6 +19,23 @@ const stubLocationsConstantsAccommodationType = () => }, }) +const stubLocationsConstantsConvertedCellType = () => + stubFor({ + request: { + method: 'GET', + urlPattern: '/locations-api/constants/converted-cell-type', + }, + response: { + status: 200, + headers: { + 'Content-Type': 'application/json;charset=UTF-8', + }, + jsonBody: { + deactivatedReasons: [{ key: 'TEST_TYPE', description: 'Test type' }], + }, + }, + }) + const stubLocationsConstantsDeactivatedReason = () => stubFor({ request: { @@ -36,6 +53,80 @@ const stubLocationsConstantsDeactivatedReason = () => }, }) +const stubLocationsConstantsLocationType = () => + stubFor({ + request: { + method: 'GET', + urlPattern: '/locations-api/constants/location-type', + }, + response: { + status: 200, + headers: { + 'Content-Type': 'application/json;charset=UTF-8', + }, + jsonBody: { + locationTypes: [ + { key: 'WING', description: 'Wing' }, + { key: 'LANDING', description: 'Landing' }, + { key: 'SPUR', description: 'Spur' }, + { key: 'CELL', description: 'Cell' }, + { key: 'ROOM', description: 'Room' }, + ], + }, + }, + }) + +const stubLocationsConstantsNonResidentialUsageType = () => + stubFor({ + request: { + method: 'GET', + urlPattern: '/locations-api/constants/non-residential-usage-type', + }, + response: { + status: 200, + headers: { + 'Content-Type': 'application/json;charset=UTF-8', + }, + jsonBody: { + nonResidentialUsageTypes: [{ key: 'TEST_TYPE', description: 'Test type' }], + }, + }, + }) + +const stubLocationsConstantsResidentialAttributeType = () => + stubFor({ + request: { + method: 'GET', + urlPattern: '/locations-api/constants/residential-attribute-type', + }, + response: { + status: 200, + headers: { + 'Content-Type': 'application/json;charset=UTF-8', + }, + jsonBody: { + residentialAttributeTypes: [{ key: 'TEST_TYPE', description: 'Test type' }], + }, + }, + }) + +const stubLocationsConstantsResidentialHousingType = () => + stubFor({ + request: { + method: 'GET', + urlPattern: '/locations-api/constants/residential-housing-type', + }, + response: { + status: 200, + headers: { + 'Content-Type': 'application/json;charset=UTF-8', + }, + jsonBody: { + residentialHousingTypes: [{ key: 'TEST_TYPE', description: 'Test type' }], + }, + }, + }) + const stubLocationsConstantsSpecialistCellType = () => stubFor({ request: { @@ -144,7 +235,12 @@ const stubLocationsLocationsResidentialSummaryForLocation = ({ export default { stubLocationsConstantsAccommodationType, + stubLocationsConstantsConvertedCellType, stubLocationsConstantsDeactivatedReason, + stubLocationsConstantsLocationType, + stubLocationsConstantsNonResidentialUsageType, + stubLocationsConstantsResidentialAttributeType, + stubLocationsConstantsResidentialHousingType, stubLocationsConstantsSpecialistCellType, stubLocationsConstantsUsedForType, stubLocationsLocationsResidentialSummary, diff --git a/server/data/locationsApiClient.ts b/server/data/locationsApiClient.ts index f7a234ce..a6d86c2f 100644 --- a/server/data/locationsApiClient.ts +++ b/server/data/locationsApiClient.ts @@ -95,11 +95,44 @@ export default class LocationsApiClient extends BaseApiClient { requestType: 'get', options: { cacheDuration: 86_400 }, }), + getConvertedCellTypes: this.apiCall<{ convertedCellTypes: { key: string; description: string }[] }, null>({ + path: '/constants/converted-cell-type', + requestType: 'get', + options: { cacheDuration: 86_400 }, + }), getDeactivatedReasons: this.apiCall<{ deactivatedReasons: { key: string; description: string }[] }, null>({ path: '/constants/deactivated-reason', requestType: 'get', options: { cacheDuration: 86_400 }, }), + getLocationTypes: this.apiCall<{ locationTypes: { key: string; description: string }[] }, null>({ + path: '/constants/location-type', + requestType: 'get', + options: { cacheDuration: 86_400 }, + }), + getNonResidentialUsageTypes: this.apiCall< + { nonResidentialUsageTypes: { key: string; description: string }[] }, + null + >({ + path: '/constants/non-residential-usage-type', + requestType: 'get', + options: { cacheDuration: 86_400 }, + }), + getResidentialAttributeTypes: this.apiCall< + { residentialAttributeTypes: { key: string; description: string }[] }, + null + >({ + path: '/constants/residential-attribute-type', + requestType: 'get', + options: { cacheDuration: 86_400 }, + }), + getResidentialHousingTypes: this.apiCall<{ residentialHousingTypes: { key: string; description: string }[] }, null>( + { + path: '/constants/residential-housing-type', + requestType: 'get', + options: { cacheDuration: 86_400 }, + }, + ), getSpecialistCellTypes: this.apiCall<{ specialistCellTypes: { key: string; description: string }[] }, null>({ path: '/constants/specialist-cell-type', requestType: 'get', diff --git a/server/decorators/location.test.ts b/server/decorators/location.test.ts index 2f2b0af6..c18aa667 100644 --- a/server/decorators/location.test.ts +++ b/server/decorators/location.test.ts @@ -3,38 +3,79 @@ import decorateLocation from './location' import ManageUsersService from '../services/manageUsersService' import LocationsService from '../services/locationsService' +const manageUsersService = { + getUser: (_token: string, username: string) => { + return { name: `Resolved ${username}` } + }, +} as unknown as ManageUsersService + +const locationsService = { + getAccommodationType: (_token: string, type: string) => `Resolved ${type}`, + getConvertedCellType: (_token: string, type: string) => `Resolved ${type}`, + getDeactivatedReason: (_token: string, type: string) => `Resolved ${type}`, + getLocationType: (_token: string, type: string) => `Resolved ${type}`, + getSpecialistCellType: (_token: string, type: string) => `Resolved ${type}`, + getUsedForType: (_token: string, type: string) => `Resolved ${type}`, +} as unknown as LocationsService + describe('decorateLocation', () => { - it('populates accommodationTypes', async () => { - const location = LocationFactory.build({ - accommodationTypes: ['TYPE1', 'TYPE2'], - deactivatedBy: 'DEACTIVATE_USER', - deactivatedReason: 'DEACTIVATED', - lastModifiedBy: 'MODIFIED_USER', - specialistCellTypes: ['TYPE1', 'TYPE2'], - usedFor: ['TYPE1', 'TYPE2'], - }) - const decoratedLocation = await decorateLocation({ - location, - systemToken: 'token', - userToken: 'token', - manageUsersService: { - getUser: (_token: string, username: string) => { - return { name: `Resolved ${username}` } - }, - } as unknown as ManageUsersService, - locationsService: { - getAccommodationType: (_token: string, type: string) => `Resolved ${type}`, - getDeactivatedReason: (_token: string, type: string) => `Resolved ${type}`, - getSpecialistCellType: (_token: string, type: string) => `Resolved ${type}`, - getUsedForType: (_token: string, type: string) => `Resolved ${type}`, - } as unknown as LocationsService, + describe('when limited = false', () => { + it('decorates all of the fields', async () => { + const location = LocationFactory.build({ + accommodationTypes: ['TYPE1', 'TYPE2'], + deactivatedBy: 'DEACTIVATE_USER', + deactivatedReason: 'DEACTIVATED', + lastModifiedBy: 'MODIFIED_USER', + specialistCellTypes: ['TYPE1', 'TYPE2'], + usedFor: ['TYPE1', 'TYPE2'], + }) + const decoratedLocation = await decorateLocation({ + location, + systemToken: 'token', + userToken: 'token', + manageUsersService, + locationsService, + limited: false, + }) + + expect(decoratedLocation.accommodationTypes).toEqual(location.accommodationTypes.map(s => `Resolved ${s}`)) + expect(decoratedLocation.convertedCellType).toEqual(`Resolved ${location.convertedCellType}`) + expect(decoratedLocation.deactivatedBy).toEqual(`Resolved ${location.deactivatedBy}`) + expect(decoratedLocation.deactivatedReason).toEqual(`Resolved ${location.deactivatedReason}`) + expect(decoratedLocation.lastModifiedBy).toEqual(`Resolved ${location.lastModifiedBy}`) + expect(decoratedLocation.locationType).toEqual(`Resolved ${location.locationType}`) + expect(decoratedLocation.specialistCellTypes).toEqual(location.specialistCellTypes.map(s => `Resolved ${s}`)) + expect(decoratedLocation.usedFor).toEqual(location.usedFor.map(s => `Resolved ${s}`)) }) + }) + + describe('when limited = true', () => { + it('only decorates the expected fields', async () => { + const location = LocationFactory.build({ + accommodationTypes: ['TYPE1', 'TYPE2'], + deactivatedBy: 'DEACTIVATE_USER', + deactivatedReason: 'DEACTIVATED', + lastModifiedBy: 'MODIFIED_USER', + specialistCellTypes: ['TYPE1', 'TYPE2'], + usedFor: ['TYPE1', 'TYPE2'], + }) + const decoratedLocation = await decorateLocation({ + location, + systemToken: 'token', + userToken: 'token', + manageUsersService, + locationsService, + limited: true, + }) - expect(decoratedLocation.accommodationTypes).toEqual(location.accommodationTypes.map(s => `Resolved ${s}`)) - expect(decoratedLocation.deactivatedBy).toEqual(`Resolved ${location.deactivatedBy}`) - expect(decoratedLocation.deactivatedReason).toEqual(`Resolved ${location.deactivatedReason}`) - expect(decoratedLocation.lastModifiedBy).toEqual(`Resolved ${location.lastModifiedBy}`) - expect(decoratedLocation.usedFor).toEqual(location.usedFor.map(s => `Resolved ${s}`)) - expect(decoratedLocation.specialistCellTypes).toEqual(location.specialistCellTypes.map(s => `Resolved ${s}`)) + expect(decoratedLocation.accommodationTypes).toEqual(location.accommodationTypes.map(s => `Resolved ${s}`)) + expect(decoratedLocation.convertedCellType).toEqual(location.convertedCellType) + expect(decoratedLocation.deactivatedBy).toEqual(location.deactivatedBy) + expect(decoratedLocation.deactivatedReason).toEqual(location.deactivatedReason) + expect(decoratedLocation.lastModifiedBy).toEqual(location.lastModifiedBy) + expect(decoratedLocation.locationType).toEqual(`Resolved ${location.locationType}`) + expect(decoratedLocation.specialistCellTypes).toEqual(location.specialistCellTypes.map(s => `Resolved ${s}`)) + expect(decoratedLocation.usedFor).toEqual(location.usedFor.map(s => `Resolved ${s}`)) + }) }) }) diff --git a/server/decorators/location.ts b/server/decorators/location.ts index 3dfd7efc..a725dc45 100644 --- a/server/decorators/location.ts +++ b/server/decorators/location.ts @@ -1,6 +1,7 @@ import { Location } from '../data/locationsApiClient' import LocationsService from '../services/locationsService' import ManageUsersService from '../services/manageUsersService' +import logger from '../../logger' export default async function decorateLocation({ location, @@ -17,11 +18,17 @@ export default async function decorateLocation({ locationsService: LocationsService limited?: boolean }) { + logger.debug(`decorate location: ${JSON.stringify(location)}`) + return { ...location, accommodationTypes: await Promise.all( location.accommodationTypes.map(a => locationsService.getAccommodationType(systemToken, a)), ), + convertedCellType: + location.convertedCellType && !limited + ? await locationsService.getConvertedCellType(systemToken, location.convertedCellType) + : location.convertedCellType, deactivatedBy: location.deactivatedBy && !limited ? (await manageUsersService.getUser(userToken, location.deactivatedBy))?.name || location.deactivatedBy @@ -34,6 +41,7 @@ export default async function decorateLocation({ location.lastModifiedBy && !limited ? (await manageUsersService.getUser(userToken, location.lastModifiedBy))?.name || location.lastModifiedBy : location.lastModifiedBy, + locationType: await locationsService.getLocationType(systemToken, location.locationType), specialistCellTypes: await Promise.all( location.specialistCellTypes.map(a => locationsService.getSpecialistCellType(systemToken, a)), ), diff --git a/server/middleware/populateResidentialSummary.ts b/server/middleware/populateResidentialSummary.ts index 4d1bd213..6fd3793a 100644 --- a/server/middleware/populateResidentialSummary.ts +++ b/server/middleware/populateResidentialSummary.ts @@ -5,6 +5,49 @@ import { Location } from '../data/locationsApiClient' import formatDaysAgo from '../formatters/formatDaysAgo' import decorateLocation from '../decorators/location' +const ignoredAccommodationTypes = ['Care and separation', 'Healthcare inpatients', 'Other', 'Unknown'] + +type LocationDetails = { key: { text?: string; html?: string }; value: { text?: string; html?: string } }[] + +function getLocationDetails(location: Location) { + const details: LocationDetails = [{ key: { text: 'Location' }, value: { text: location.pathHierarchy } }] + + if (!location.leafLevel) { + details.push({ key: { text: 'Local name' }, value: { text: location.localName } }) + } + + if (location.status === 'NON_RESIDENTIAL') { + details.push({ key: { text: 'Non-residential room' }, value: { text: location.convertedCellType } }) + } else if (location.locationType === 'Cell') { + details.push({ + key: { text: 'Cell type' }, + value: { text: location.specialistCellTypes.join('
') }, + }) + } else { + if (location.accommodationTypes.filter(type => !ignoredAccommodationTypes.includes(type)).length) { + details.push({ + key: { text: 'Accommodation type' }, + value: { html: location.accommodationTypes.join('
') }, + }) + } + + if (location.accommodationTypes.includes('Normal accommodation') && location.usedFor.length) { + details.push({ key: { text: 'Used for' }, value: { html: location.usedFor.join('
') } }) + } + } + + if (!location.leafLevel) { + details.push({ + key: { text: 'Last updated' }, + value: { + text: `${formatDaysAgo(location.lastModifiedDate)} by ${location.lastModifiedBy}`, + }, + }) + } + + return details +} + export default function populateResidentialSummary({ authService, locationsService, @@ -19,7 +62,7 @@ export default function populateResidentialSummary({ const apiData = await locationsService.getResidentialSummary(token, prisonId, req.params.locationId) const residentialSummary: { location?: Location - locationDetails?: { key: { text: string }; value: { text?: string; html?: string } }[] + locationDetails?: LocationDetails locationHistory?: boolean // TODO: change this type when location history tab is implemented subLocationName: string subLocations: Location[] @@ -54,26 +97,7 @@ export default function populateResidentialSummary({ userToken: res.locals.user.token, }) - residentialSummary.locationDetails = [ - { key: { text: 'Location' }, value: { text: residentialSummary.location.pathHierarchy } }, - ...(!residentialSummary.location.leafLevel - ? [{ key: { text: 'Local name' }, value: { text: residentialSummary.location.localName } }] - : []), - { - key: { text: 'Accommodation type' }, - value: { html: residentialSummary.location.accommodationTypes.join('
') }, - }, - ...(residentialSummary.location.usedFor.length - ? [{ key: { text: 'Used for' }, value: { html: residentialSummary.location.usedFor.join('
') } }] - : []), - { - key: { text: 'Last updated' }, - value: { - text: `${formatDaysAgo(residentialSummary.location.lastModifiedDate)} by ${residentialSummary.location.lastModifiedBy}`, - }, - }, - ] - + residentialSummary.locationDetails = getLocationDetails(residentialSummary.location) residentialSummary.locationHistory = true if (residentialSummary.location.status !== 'NON_RESIDENTIAL') { diff --git a/server/services/locationsService.test.ts b/server/services/locationsService.test.ts index bcb5101c..19b90539 100644 --- a/server/services/locationsService.test.ts +++ b/server/services/locationsService.test.ts @@ -13,9 +13,24 @@ describe('Locations service', () => { getAccommodationTypes: jest .fn() .mockResolvedValue({ accommodationTypes: [{ key: 'KEY', description: 'description' }] }), + getConvertedCellTypes: jest + .fn() + .mockResolvedValue({ accommodationTypes: [{ key: 'KEY', description: 'description' }] }), getDeactivatedReasons: jest .fn() .mockResolvedValue({ accommodationTypes: [{ key: 'KEY', description: 'description' }] }), + getLocationTypes: jest + .fn() + .mockResolvedValue({ accommodationTypes: [{ key: 'KEY', description: 'description' }] }), + getNonResidentialUsageTypes: jest + .fn() + .mockResolvedValue({ accommodationTypes: [{ key: 'KEY', description: 'description' }] }), + getResidentialAttributeTypes: jest + .fn() + .mockResolvedValue({ accommodationTypes: [{ key: 'KEY', description: 'description' }] }), + getResidentialHousingTypes: jest + .fn() + .mockResolvedValue({ accommodationTypes: [{ key: 'KEY', description: 'description' }] }), getSpecialistCellTypes: jest .fn() .mockResolvedValue({ accommodationTypes: [{ key: 'KEY', description: 'description' }] }), @@ -60,7 +75,12 @@ describe('Locations service', () => { } testConstantDataGetter('getAccommodationTypes', 'getAccommodationType') + testConstantDataGetter('getConvertedCellTypes', 'getConvertedCellType') testConstantDataGetter('getDeactivatedReasons', 'getDeactivatedReason') + testConstantDataGetter('getLocationTypes', 'getLocationType') + testConstantDataGetter('getNonResidentialUsageTypes', 'getNonResidentialUsageType') + testConstantDataGetter('getResidentialAttributeTypes', 'getResidentialAttributeType') + testConstantDataGetter('getResidentialHousingTypes', 'getResidentialHousingType') testConstantDataGetter('getSpecialistCellTypes', 'getSpecialistCellType') testConstantDataGetter('getUsedForTypes', 'getUsedForType') diff --git a/server/services/locationsService.ts b/server/services/locationsService.ts index d59e0a42..e3746a70 100644 --- a/server/services/locationsService.ts +++ b/server/services/locationsService.ts @@ -19,19 +19,39 @@ export default class LocationsService { return (await this.getConstantDataMap(token, 'getAccommodationTypes'))[key] || 'Unknown' } + async getConvertedCellType(token: string, key: string) { + return (await this.getConstantDataMap(token, 'getConvertedCellTypes'))[key] || 'Unknown' + } + async getDeactivatedReason(token: string, key: string) { return (await this.getConstantDataMap(token, 'getDeactivatedReasons'))[key] || 'Unknown' } - async getSpecialistCellType(token: string, key: string) { - return (await this.getConstantDataMap(token, 'getSpecialistCellTypes'))[key] || 'Unknown' + async getLocationType(token: string, key: string) { + return (await this.getConstantDataMap(token, 'getLocationTypes'))[key] || 'Unknown' } - async getUsedForType(token: string, key: string) { - return (await this.getConstantDataMap(token, 'getUsedForTypes'))[key] || 'Unknown' + async getNonResidentialUsageType(token: string, key: string) { + return (await this.getConstantDataMap(token, 'getNonResidentialUsageTypes'))[key] || 'Unknown' + } + + async getResidentialAttributeType(token: string, key: string) { + return (await this.getConstantDataMap(token, 'getResidentialAttributeTypes'))[key] || 'Unknown' + } + + async getResidentialHousingType(token: string, key: string) { + return (await this.getConstantDataMap(token, 'getResidentialHousingTypes'))[key] || 'Unknown' } async getResidentialSummary(token: string, prisonId: string, locationId?: string) { return this.locationsApiClient.locations.getResidentialSummary(token, { prisonId, parentLocationId: locationId }) } + + async getSpecialistCellType(token: string, key: string) { + return (await this.getConstantDataMap(token, 'getSpecialistCellTypes'))[key] || 'Unknown' + } + + async getUsedForType(token: string, key: string) { + return (await this.getConstantDataMap(token, 'getUsedForTypes'))[key] || 'Unknown' + } } diff --git a/server/views/macros/inactiveLocationBanner.njk b/server/views/macros/inactiveLocationBanner.njk index f8498365..a1412a9d 100644 --- a/server/views/macros/inactiveLocationBanner.njk +++ b/server/views/macros/inactiveLocationBanner.njk @@ -3,7 +3,7 @@ {% macro inactiveLocationBanner(location) %} {% set locationName = location.localName or location.pathHierarchy %} - {% set locationType = location.locationType | title %} + {% set locationType = location.locationType %} {% set inactiveHtml %}

{{ locationType }} {{ locationName }} is temporarily inactive diff --git a/server/views/macros/locationDetails.njk b/server/views/macros/locationDetails.njk index a9a70645..961b4121 100644 --- a/server/views/macros/locationDetails.njk +++ b/server/views/macros/locationDetails.njk @@ -3,7 +3,7 @@ {% macro locationDetails(location, details, history) %} {% set detailsHtml %} -

{{ location.locationType | title }} details

+

{{ location.locationType }} details

{{ govukSummaryList({ rows: details, @@ -25,7 +25,7 @@ {{ govukTabs({ items: [ { - label: (location.locationType | title) + " details", + label: location.locationType + " details", id: 'location-details', panel: { html: detailsHtml diff --git a/server/views/pages/viewLocations/show.njk b/server/views/pages/viewLocations/show.njk index 43d48d78..aa967699 100644 --- a/server/views/pages/viewLocations/show.njk +++ b/server/views/pages/viewLocations/show.njk @@ -9,7 +9,7 @@ {% from "../../macros/miniSummary.njk" import miniSummary %} {% set locationName = residentialSummary.location.localName or residentialSummary.location.pathHierarchy %} -{% set locationType = residentialSummary.location.locationType | title %} +{% set locationType = residentialSummary.location.locationType %} {% set title = locationType + ' ' + locationName + ' - View and update locations' %} {% block heading %}