From f25c7bb7df01b6d3055a4429ad8a48546ab3f73a Mon Sep 17 00:00:00 2001 From: Dana Lambert Date: Wed, 1 Dec 2021 09:48:06 +1300 Subject: [PATCH] Display additional region information on summary step --- .../src/components/steps/summary/SummaryContent.js | 12 ++++++++++++ frontend/src/repository/LocationRepository.js | 10 ++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/steps/summary/SummaryContent.js b/frontend/src/components/steps/summary/SummaryContent.js index 41b256e..c0f28ec 100644 --- a/frontend/src/components/steps/summary/SummaryContent.js +++ b/frontend/src/components/steps/summary/SummaryContent.js @@ -3,6 +3,7 @@ import Accordion from '@mui/material/Accordion'; import AccordionSummary from '@mui/material/AccordionSummary'; import AccordionDetails from '@mui/material/AccordionDetails'; import Typography from '@mui/material/Typography'; +import Box from '@mui/material/Box'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import SummaryTable from './SummaryTable' @@ -51,6 +52,14 @@ export default function SummaryContent(props) { createData('Zone Refined Variant', (props.filters.zone && props.filters.zone.refined_variant) ?? "") ]; + const regionInformation = () => { + if (locationDetails.in_chch) { + return Your location falls within the ecosystem type covered by the Christchurch Council ecosystem maps - further information can be obtained from Ōtautahi/Christchurch ecosystems map. + } else if (locationDetails.in_auckland) { + return "Your location falls within the ecosystem type covered by the Auckland Council Tiaki Tāmaki Makaurau Conservation map - further information can be obtained from tiaki Tāmaki Makaurau conservation Auckland + } + } + return (
Please review your choices presented below: @@ -62,6 +71,9 @@ export default function SummaryContent(props) { + + {regionInformation()} + diff --git a/frontend/src/repository/LocationRepository.js b/frontend/src/repository/LocationRepository.js index f8a7487..aa63193 100644 --- a/frontend/src/repository/LocationRepository.js +++ b/frontend/src/repository/LocationRepository.js @@ -11,21 +11,27 @@ const LocationRepsostory = { return API.get(`/ecologicaldistrict/`, { params: filters }); }, + getRegionDetails(filters) { + return API.get(`/region/`, { params: filters }); + }, + getPropertyDetails(filters) { return API.get(`/address/`, { params: filters }); }, async getLocationData(filters) { - const [soilDetails, ecologicalDistrictDetails, propertyDetails] = await Promise.all([ + const [soilDetails, ecologicalDistrictDetails, propertyDetails, regionDetails] = await Promise.all([ this.getSoilDetails(filters), this.getEcologicalDistrictDetails(filters), - this.getPropertyDetails(filters) + this.getPropertyDetails(filters), + this.getRegionDetails(filters) ]); let locationData = {}; locationData = soilDetails.status === 200 ? Object.assign(locationData, soilDetails.data[0]) : locationData; locationData = ecologicalDistrictDetails.status === 200 ? Object.assign(locationData, ecologicalDistrictDetails.data[0]) : locationData; locationData = propertyDetails.status === 200 ? Object.assign(locationData, propertyDetails.data) : locationData; + locationData = regionDetails.status === 200 ? Object.assign(locationData, regionDetails.data) : locationData; return locationData }