Add fields to Materials section

This commit is contained in:
Mike Simpson 2023-07-27 15:48:01 +01:00
parent 3d6113fb0d
commit b326551d30
5 changed files with 300 additions and 1 deletions

View File

@ -349,6 +349,44 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
edit: true, edit: true,
verify: true, verify: true,
}, },
construction_external_wall: {
edit: true,
verify: true,
},
construction_external_wall_source_type: {
edit: true,
verify: true,
},
construction_external_wall_source_links: {
edit: true,
verify: true,
},
construction_internal_wall: {
edit: true,
verify: true,
},
construction_internal_wall_source_type: {
edit: true,
verify: true,
},
construction_internal_wall_source_links: {
edit: true,
verify: true,
},
construction_ground_floor: {
edit: true,
verify: true,
},
construction_ground_floor_source_type: {
edit: true,
verify: true,
},
construction_ground_floor_source_links: {
edit: true,
verify: true,
},
planning_portal_link: { planning_portal_link: {
edit: true, edit: true,
verify: true, verify: true,

View File

@ -242,6 +242,150 @@ const ConstructionView: React.FunctionComponent<CategoryViewProps> = (props) =>
verified_count={props.building.verified.construction_core_material} verified_count={props.building.verified.construction_core_material}
/> />
<hr/> <hr/>
<SelectDataEntry
title={dataFields.construction_external_wall.title}
slug="construction_external_wall"
value={props.building.construction_external_wall}
tooltip={dataFields.construction_external_wall.tooltip}
options={dataFields.construction_external_wall.items}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
/>
<Verification
slug="construction_external_wall"
allow_verify={props.user !== undefined && props.building.construction_external_wall !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("construction_external_wall")}
user_verified_as={props.user_verified.construction_external_wall}
verified_count={props.building.verified.construction_external_wall}
/>
<SelectDataEntry
title={dataFields.construction_external_wall_source_type.title}
slug="construction_external_wall_source_type"
value={props.building.construction_external_wall_source_type}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.construction_external_wall_source_type.tooltip}
placeholder={dataFields.construction_external_wall_source_type.example}
options={dataFields.construction_external_wall_source_type.items}
/>
{(props.building.construction_external_wall_source_type == commonSourceTypes[0] ||
props.building.construction_external_wall_source_type == commonSourceTypes[1] ||
props.building.construction_external_wall_source_type == null) ? <></> :
<>
<MultiDataEntry
title={dataFields.construction_external_wall_source_links.title}
slug="construction_external_wall_source_links"
value={props.building.construction_external_wall_source_links}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.construction_external_wall_source_links.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
<hr/>
<SelectDataEntry
title={dataFields.construction_internal_wall.title}
slug="construction_internal_wall"
value={props.building.construction_internal_wall}
tooltip={dataFields.construction_internal_wall.tooltip}
options={dataFields.construction_internal_wall.items}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
/>
<Verification
slug="construction_internal_wall"
allow_verify={props.user !== undefined && props.building.construction_internal_wall !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("construction_internal_wall")}
user_verified_as={props.user_verified.construction_internal_wall}
verified_count={props.building.verified.construction_internal_wall}
/>
<SelectDataEntry
title={dataFields.construction_internal_wall_source_type.title}
slug="construction_internal_wall_source_type"
value={props.building.construction_internal_wall_source_type}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.construction_internal_wall_source_type.tooltip}
placeholder={dataFields.construction_internal_wall_source_type.example}
options={dataFields.construction_internal_wall_source_type.items}
/>
{(props.building.construction_internal_wall_source_type == commonSourceTypes[0] ||
props.building.construction_internal_wall_source_type == commonSourceTypes[1] ||
props.building.construction_internal_wall_source_type == null) ? <></> :
<>
<MultiDataEntry
title={dataFields.construction_internal_wall_source_links.title}
slug="construction_internal_wall_source_links"
value={props.building.construction_internal_wall_source_links}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.construction_internal_wall_source_links.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
<hr/>
<SelectDataEntry
title={dataFields.construction_ground_floor.title}
slug="construction_ground_floor"
value={props.building.construction_ground_floor}
tooltip={dataFields.construction_ground_floor.tooltip}
options={dataFields.construction_ground_floor.items}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
/>
<Verification
slug="construction_ground_floor"
allow_verify={props.user !== undefined && props.building.construction_ground_floor !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("construction_ground_floor")}
user_verified_as={props.user_verified.construction_ground_floor}
verified_count={props.building.verified.construction_ground_floor}
/>
<SelectDataEntry
title={dataFields.construction_ground_floor_source_type.title}
slug="construction_ground_floor_source_type"
value={props.building.construction_ground_floor_source_type}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.construction_ground_floor_source_type.tooltip}
placeholder={dataFields.construction_ground_floor_source_type.example}
options={dataFields.construction_ground_floor_source_type.items}
/>
{(props.building.construction_ground_floor_source_type == commonSourceTypes[0] ||
props.building.construction_ground_floor_source_type == commonSourceTypes[1] ||
props.building.construction_ground_floor_source_type == null) ? <></> :
<>
<MultiDataEntry
title={dataFields.construction_ground_floor_source_links.title}
slug="construction_ground_floor_source_links"
value={props.building.construction_ground_floor_source_links}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.construction_ground_floor_source_links.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
<hr/>
<SelectDataEntry <SelectDataEntry
title={dataFields.construction_roof_covering.title} title={dataFields.construction_roof_covering.title}
slug="construction_roof_covering" slug="construction_roof_covering"

View File

@ -766,6 +766,99 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
tooltip: "URL(s) for roof shape data source(s)", tooltip: "URL(s) for roof shape data source(s)",
example: ["", "", ""], example: ["", "", ""],
}, },
construction_internal_wall: {
category: Category.Construction,
title: "What is the main internal wall material thought to be?",
tooltip: '',
example: "",
items: [
'Brick',
'Stone',
'Concrete blocks',
'Concrete slabs/panels',
'Wood',
'Metal',
'Adobe/Earth',
'Glass',
'Plastic',
'Stucco on light framing',
'Vegetative (straw, matting etc)',
'Cement based boards',
]
},
construction_internal_wall_source_type: {
category: Category.Construction,
title: "Source type",
tooltip: "Source of internal wall data",
example: "",
items: commonSourceTypes
},
construction_internal_wall_source_links: {
category: Category.Construction,
title: "Source links",
tooltip: "URL(s) for internal wall data source(s)",
example: ["", "", ""],
},
construction_external_wall: {
category: Category.Construction,
title: "What is the main external wall material thought to be?",
tooltip: '',
example: "",
items: [
'Brick',
'Stone',
'Concrete blocks',
'Concrete slabs/panels',
'Wood',
'Metal',
'Adobe/Earth',
'Glass',
'Plastic',
'Stucco on light framing',
'Vegetative (straw, matting etc)',
'Cement based boards',
]
},
construction_external_wall_source_type: {
category: Category.Construction,
title: "Source type",
tooltip: "Source of external wall data",
example: "",
items: commonSourceTypes
},
construction_external_wall_source_links: {
category: Category.Construction,
title: "Source links",
tooltip: "URL(s) for external wall data source(s)",
example: ["", "", ""],
},
construction_ground_floor: {
category: Category.Construction,
title: "What is the main ground floor material thought to be?",
tooltip: '',
example: "",
items: [
'Masonry',
'Earthen',
'Concrete',
'Wood',
'Metal',
'Other',
]
},
construction_ground_floor_source_type: {
category: Category.Construction,
title: "Source type",
tooltip: "Source of ground floor material data",
example: "",
items: commonSourceTypes
},
construction_ground_floor_source_links: {
category: Category.Construction,
title: "Source links",
tooltip: "URL(s) for ground floor material data source(s)",
example: ["", "", ""],
},
sust_breeam_rating: { sust_breeam_rating: {
category: Category.EnergyPerformance, category: Category.EnergyPerformance,

View File

@ -21,3 +21,15 @@ ALTER TABLE buildings DROP COLUMN IF EXISTS construction_decorative_features;
ALTER TABLE buildings DROP COLUMN IF EXISTS construction_decorative_feature_materials; ALTER TABLE buildings DROP COLUMN IF EXISTS construction_decorative_feature_materials;
ALTER TABLE buildings DROP COLUMN IF EXISTS construction_decorative_feature_source_type; ALTER TABLE buildings DROP COLUMN IF EXISTS construction_decorative_feature_source_type;
ALTER TABLE buildings DROP COLUMN IF EXISTS construction_decorative_feature_source_links; ALTER TABLE buildings DROP COLUMN IF EXISTS construction_decorative_feature_source_links;
ALTER TABLE buildings DROP COLUMN IF EXISTS construction_internal_wall;
ALTER TABLE buildings DROP COLUMN IF EXISTS construction_internal_wall_source_type;
ALTER TABLE buildings DROP COLUMN IF EXISTS construction_internal_wall_source_links;
ALTER TABLE buildings DROP COLUMN IF EXISTS construction_external_wall;
ALTER TABLE buildings DROP COLUMN IF EXISTS construction_external_wall_source_type;
ALTER TABLE buildings DROP COLUMN IF EXISTS construction_external_wall_source_links;
ALTER TABLE buildings DROP COLUMN IF EXISTS construction_ground_floor;
ALTER TABLE buildings DROP COLUMN IF EXISTS construction_ground_floor_source_type;
ALTER TABLE buildings DROP COLUMN IF EXISTS construction_ground_floor_source_links;

View File

@ -21,3 +21,15 @@ ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_decorative_features
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_decorative_feature_materials text; ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_decorative_feature_materials text;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_decorative_feature_source_type text; ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_decorative_feature_source_type text;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_decorative_feature_source_links text[]; ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_decorative_feature_source_links text[];
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_internal_wall text;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_internal_wall_source_type text;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_internal_wall_source_links text[];
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_external_wall text;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_external_wall_source_type text;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_external_wall_source_links text[];
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_ground_floor text;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_ground_floor_source_type text;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_ground_floor_source_links text[];