Green roof & solar panels

This commit is contained in:
Mike Simpson 2023-06-29 15:21:20 +01:00
parent b44738e627
commit 1e41cc2e11
5 changed files with 180 additions and 14 deletions

View File

@ -717,6 +717,30 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* 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
}
});

View File

@ -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<CategoryViewProps> = (props) =
/>
</DataEntryGroup>
<DataEntryGroup name="Retrofit history">
<NumericDataEntry
<NumericDataEntry
slug='age_retrofit_date'
title={dataFields.age_retrofit_date.title}
value={props.building.age_retrofit_date}
@ -139,20 +140,108 @@ const SustainabilityView: React.FunctionComponent<CategoryViewProps> = (props) =
}
</DataEntryGroup>
<DataEntryGroup name="Solar panels">
<DataEntry
title="Does the building have Solar Panels?"
slug=""
value=""
mode='view'
<LogicalDataEntry
title={dataFields.energy_solar.title}
slug="energy_solar"
value={props.building.energy_solar}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.energy_solar.tooltip}
/>
<Verification
slug="energy_solar"
allow_verify={props.user !== undefined && props.building.energy_solar !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("energy_solar")}
user_verified_as={props.user_verified.energy_solar}
verified_count={props.building.verified.energy_solar}
/>
{props.building.energy_solar == null ? <></> :
<>
<SelectDataEntry
title={dataFields.energy_solar_source_type.title}
slug="energy_solar_source_type"
value={props.building.energy_solar_source_type}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.energy_solar_source_type.tooltip}
options={dataFields.energy_solar_source_type.items}
placeholder={dataFields.energy_solar_source_type.example}
/>
{(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) ? <></> :
<>
<MultiDataEntry
title={dataFields.energy_solar_source_links.title}
slug="energy_solar_source_links"
value={props.building.energy_solar_source_links}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.energy_solar_source_links.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
</>
}
</DataEntryGroup>
<DataEntryGroup name="Green walls/roof">
<DataEntry
title="Does the building have Green Walls / Green Roof"
slug=""
value=""
mode='view'
<LogicalDataEntry
title={dataFields.energy_green_roof.title}
slug="energy_green_roof"
value={props.building.energy_green_roof}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.energy_green_roof.tooltip}
/>
<Verification
slug="energy_green_roof"
allow_verify={props.user !== undefined && props.building.energy_green_roof !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("energy_green_roof")}
user_verified_as={props.user_verified.energy_green_roof}
verified_count={props.building.verified.energy_green_roof}
/>
{props.building.energy_green_roof == null ? <></> :
<>
<SelectDataEntry
title={dataFields.energy_green_roof_source_type.title}
slug="energy_green_roof_source_type"
value={props.building.energy_green_roof_source_type}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.energy_green_roof_source_type.tooltip}
options={dataFields.energy_green_roof_source_type.items}
placeholder={dataFields.energy_green_roof_source_type.example}
/>
{(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) ? <></> :
<>
<MultiDataEntry
title={dataFields.energy_green_roof_source_links.title}
slug="energy_green_roof_source_links"
value={props.building.energy_green_roof_source_links}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.energy_green_roof_source_links.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
</>
}
</DataEntryGroup>
</Fragment>
);

View File

@ -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 };

View File

@ -6,3 +6,10 @@ 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;
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;

View File

@ -6,3 +6,10 @@ 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[];
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[];