diff --git a/src/app/components/portfolio/Toolbar.tsx b/src/app/components/portfolio/Toolbar.tsx index 6dddaa9..5d4d52c 100644 --- a/src/app/components/portfolio/Toolbar.tsx +++ b/src/app/components/portfolio/Toolbar.tsx @@ -69,13 +69,13 @@ export function Toolbar({ portfolioId, scenarios }: ToolbarProps) { Summary - Measures - + */} Condition: {room.room_info.overall_condition_of_the_room} )} - {room.room_info?.does_the_room_have_any_defects && ( -
- Defects: {room.room_info.does_the_room_have_any_defects} + {room.room_info?.does_the_room_have_any_defects === "Yes" && ( +
+ +
+
Defect reported
+ {room.room_info?.description_of_defect && ( +
+ {room.room_info.description_of_defect} +
+ )} +
)} - {room.room_info?.ventilation_info - ?.are_there_any_visible_or_reported_signs_of_damp_mould_or_excessive_condensation_within_the_room !== - undefined && ( -
- Damp/Mould:{" "} - {room.room_info.ventilation_info - .are_there_any_visible_or_reported_signs_of_damp_mould_or_excessive_condensation_within_the_room - ? "Yes" - : "No"} + {room.room_info?.ventilation_info?.location_of_any_damp_or_mould && ( +
+ + + Damp/Mould Location: {room.room_info.ventilation_info.location_of_any_damp_or_mould} + + (Severity: Average) + +
)} {room.room_info?.windows_info?.condition_of_the_windows && ( @@ -202,6 +212,43 @@ export default function ConditionReport({ const areaPerPerson = totalFloorArea / occupantsToUse; const hasSufficientSpace = (occupantsToUse <= maxOccupants) && (areaPerPerson >= 20); + // Category 1 Hazard structural + const frontElevation = conditionReport.access_and_elevations?.external_elevation_front?.external_elevation; + +const elevationEntries: [string, any][] = [ + ["Front Elevation", frontElevation], + ["Back Elevation", conditionReport.access_and_elevations?.external_elevation_back?.external_elevation], + ["Gable One", conditionReport.access_and_elevations?.external_elevation_gable_one?.external_elevation], + ["Gable Two", conditionReport.access_and_elevations?.external_elevation_gable_two?.external_elevation], +]; + +// If a wall inherits front elevation, use the front's data +const applyFrontDefaults = (label: string, elevationKey: string): [string, any] => { + const section = conditionReport.access_and_elevations?.[elevationKey]; + if (section?.do_all_answers_for_the_front_elevation_apply_to_this_wall) { + return [label, frontElevation]; + } + return [label, section?.external_elevation ?? null]; +}; + +const allElevations: [string, any][] = [ + ["Front Elevation", frontElevation], + applyFrontDefaults("Back Elevation", "external_elevation_back"), + applyFrontDefaults("Gable One", "external_elevation_gable_one"), + applyFrontDefaults("Gable Two", "external_elevation_gable_two"), +]; + +const elevationsWithIssues = allElevations.filter(([_, elevation]) => + elevation && + ( + elevation.does_any_structural_defect_need_resolving_before_retrofit === true || + elevation.are_there_any_signs_of_water_penetration_caused_by_failed_rainwater_goods_or_pipework === true || + elevation.are_there_any_visible_signs_of_movement === true || + elevation.are_there_any_visible_signs_of_cracking_to_the_existing_external_finish === true + ) +); + + return (
@@ -209,44 +256,54 @@ export default function ConditionReport({ Decent Homes Checklist - 0} - roomsWithIssues={roomsWithDamp} - /> - - - - - - 0 + ? "Structural issues identified" + : "No major structural issues identified" + } + passed={elevationsWithIssues.length === 0} + alert={elevationsWithIssues.length > 0} + roomsWithIssues={elevationsWithIssues} + /> + 0} + roomsWithIssues={roomsWithDamp} + /> + + + + + +