Display additional region information on summary step
This commit is contained in:
parent
a22b1dfb38
commit
f25c7bb7df
2 changed files with 20 additions and 2 deletions
|
@ -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 <Typography variant='body2'>Your location falls within the ecosystem type covered by the Christchurch Council ecosystem maps - further information can be obtained from <a href="https://ccc.govt.nz/environment/land/ecosystem-map" target="blank" >Ōtautahi/Christchurch ecosystems map</a>.</Typography>
|
||||
} else if (locationDetails.in_auckland) {
|
||||
return <Typography variant='body2'>"Your location falls within the ecosystem type covered by the Auckland Council Tiaki Tāmaki Makaurau Conservation map - further information can be obtained from <a href="https://www.tiakitamakimakaurau.nz/conservation-map/" target="blank" >tiaki Tāmaki Makaurau conservation Auckland</a></Typography>
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='summary-content'>
|
||||
<Typography mb={2} mt={2} >Please review your choices presented below: </Typography>
|
||||
|
@ -62,6 +71,9 @@ export default function SummaryContent(props) {
|
|||
</AccordionSummary>
|
||||
<AccordionDetails>
|
||||
<SummaryTable rows={locationData} />
|
||||
<Box ml={2} mt={2}>
|
||||
{regionInformation()}
|
||||
</Box>
|
||||
</AccordionDetails>
|
||||
</Accordion>
|
||||
<Accordion expanded={expanded === 'panel2'} onChange={handleChange('panel2')} >
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue