diff --git a/app/src/api/config/dataFields.ts b/app/src/api/config/dataFields.ts index e23c88b5..e77c8358 100644 --- a/app/src/api/config/dataFields.ts +++ b/app/src/api/config/dataFields.ts @@ -717,6 +717,30 @@ export const buildingAttributesConfig = valueType()({ /* eslint age_historical_vectorised_footprint_links : { edit: true, verify: true + }, + energy_solar : { + edit: true, + verify: true + }, + energy_solar_source_type : { + edit: true, + verify: true + }, + energy_solar_source_links : { + edit: true, + verify: true + }, + energy_green_roof : { + edit: true, + verify: true + }, + energy_green_roof_source_type : { + edit: true, + verify: true + }, + energy_green_roof_source_links : { + edit: true, + verify: true } }); diff --git a/app/src/frontend/building/data-containers/energy-performance.tsx b/app/src/frontend/building/data-containers/energy-performance.tsx index d20e380c..aa7f0971 100644 --- a/app/src/frontend/building/data-containers/energy-performance.tsx +++ b/app/src/frontend/building/data-containers/energy-performance.tsx @@ -11,6 +11,7 @@ import InfoBox from '../../components/info-box'; import { CategoryViewProps } from './category-view-props'; import { DataEntryGroup } from '../data-components/data-entry-group'; import { MultiDataEntry } from '../data-components/multi-data-entry/multi-data-entry'; +import { LogicalDataEntry } from '../data-components/logical-data-entry/logical-data-entry'; const EnergyCategoryOptions = ["A", "B", "C", "D", "E", "F", "G"]; const BreeamRatingOptions = [ @@ -88,7 +89,7 @@ const SustainabilityView: React.FunctionComponent = (props) = /> - = (props) = } - + + {props.building.energy_solar == null ? <> : + <> + + {(props.building.energy_solar_source_type == dataFields.energy_solar_source_type.items[0] || + props.building.energy_solar_source_type == dataFields.energy_solar_source_type.items[1] || + props.building.energy_solar_source_type == null) ? <> : + <> + + + } + + } - + + {props.building.energy_green_roof == null ? <> : + <> + + {(props.building.energy_green_roof_source_type == dataFields.energy_green_roof_source_type.items[0] || + props.building.energy_green_roof_source_type == dataFields.energy_green_roof_source_type.items[1] || + props.building.energy_green_roof_source_type == null) ? <> : + <> + + + } + + } ); diff --git a/app/src/frontend/config/data-fields-config.ts b/app/src/frontend/config/data-fields-config.ts index 8177e44d..09cf2357 100644 --- a/app/src/frontend/config/data-fields-config.ts +++ b/app/src/frontend/config/data-fields-config.ts @@ -1330,7 +1330,46 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ title: "Extracted vectorised historical footprints links", tooltip: "Extracted vectorised historical footprints links", example: ["", "", ""], - } + }, + + energy_solar: { + category: Category.EnergyPerformance, + title: "Does the building have solar panels?", + tooltip: "Are there any kinds of solar panels on the roof of the building?", + example: true + }, + energy_solar_source_type: { + category: Category.EnergyPerformance, + title: "Source type", + tooltip: "Source type for street width data", + example: "", + items: commonSourceTypes + }, + energy_solar_source_links: { + category: Category.EnergyPerformance, + title: "Source link(s)", + tooltip: "Source link(s) for street width data", + example: ["", "", ""], + }, + energy_green_roof: { + category: Category.EnergyPerformance, + title: "Does the building have green walls/green roof?", + tooltip: "Are there any green walls, or a green roof, on the building?", + example: true + }, + energy_green_roof_source_type: { + category: Category.EnergyPerformance, + title: "Source type", + tooltip: "Source type for street width data", + example: "", + items: commonSourceTypes + }, + energy_green_roof_source_links: { + category: Category.EnergyPerformance, + title: "Source link(s)", + tooltip: "Source link(s) for street width data", + example: ["", "", ""], + }, }; export const allFieldsConfig = { ...dataFields, ...buildingUserFields }; \ No newline at end of file diff --git a/migrations/041.ui_revamp_tweaks.down.sql b/migrations/041.ui_revamp_tweaks.down.sql index 9b732961..49a30198 100644 --- a/migrations/041.ui_revamp_tweaks.down.sql +++ b/migrations/041.ui_revamp_tweaks.down.sql @@ -5,4 +5,11 @@ ALTER TABLE buildings DROP COLUMN IF EXISTS age_historical_vectorised_footprint_ ALTER TABLE buildings DROP COLUMN IF EXISTS landowner_links; ALTER TABLE buildings DROP COLUMN IF EXISTS designers_links; ALTER TABLE buildings DROP COLUMN IF EXISTS builder_links; -ALTER TABLE buildings DROP COLUMN IF EXISTS developer_links; \ No newline at end of file +ALTER TABLE buildings DROP COLUMN IF EXISTS developer_links; + +ALTER TABLE buildings DROP COLUMN IF EXISTS energy_solar; +ALTER TABLE buildings DROP COLUMN IF EXISTS energy_solar_source_type; +ALTER TABLE buildings DROP COLUMN IF EXISTS energy_solar_source_links; +ALTER TABLE buildings DROP COLUMN IF EXISTS energy_green_roof; +ALTER TABLE buildings DROP COLUMN IF EXISTS energy_green_roof_source_type; +ALTER TABLE buildings DROP COLUMN IF EXISTS energy_green_roof_source_links; \ No newline at end of file diff --git a/migrations/041.ui_revamp_tweaks.up.sql b/migrations/041.ui_revamp_tweaks.up.sql index 3cd18818..d35143f9 100644 --- a/migrations/041.ui_revamp_tweaks.up.sql +++ b/migrations/041.ui_revamp_tweaks.up.sql @@ -5,4 +5,11 @@ ALTER TABLE buildings ADD COLUMN IF NOT EXISTS age_historical_vectorised_footpri ALTER TABLE buildings ADD COLUMN IF NOT EXISTS landowner_links text[]; ALTER TABLE buildings ADD COLUMN IF NOT EXISTS designers_links text[]; ALTER TABLE buildings ADD COLUMN IF NOT EXISTS builder_links text[]; -ALTER TABLE buildings ADD COLUMN IF NOT EXISTS developer_links text[]; \ No newline at end of file +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS developer_links text[]; + +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS energy_solar boolean; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS energy_solar_source_type text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS energy_solar_source_links text[]; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS energy_green_roof boolean; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS energy_green_roof_source_type text; +ALTER TABLE buildings ADD COLUMN IF NOT EXISTS energy_green_roof_source_links text[]; \ No newline at end of file