Add source types for Core Material

This commit is contained in:
Mike Simpson 2023-07-27 16:15:38 +01:00
parent b326551d30
commit d10d2c12b7
5 changed files with 58 additions and 2 deletions

View File

@ -270,6 +270,14 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
edit: true, edit: true,
verify: true, verify: true,
}, },
construction_core_material_source_type: {
edit: true,
verify: true,
},
construction_core_material_source_links: {
edit: true,
verify: true,
},
construction_secondary_materials: { construction_secondary_materials: {
edit: false, edit: false,
}, },

View File

@ -241,6 +241,35 @@ const ConstructionView: React.FunctionComponent<CategoryViewProps> = (props) =>
user_verified_as={props.user_verified.construction_core_material} user_verified_as={props.user_verified.construction_core_material}
verified_count={props.building.verified.construction_core_material} verified_count={props.building.verified.construction_core_material}
/> />
<SelectDataEntry
title={dataFields.construction_core_material_source_type.title}
slug="construction_core_material_source_type"
value={props.building.construction_core_material_source_type}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.construction_core_material_source_type.tooltip}
placeholder={dataFields.construction_core_material_source_type.example}
options={dataFields.construction_core_material_source_type.items}
/>
{(props.building.construction_core_material_source_type == commonSourceTypes[0] ||
props.building.construction_core_material_source_type == commonSourceTypes[1] ||
props.building.construction_core_material_source_type == null) ? <></> :
<>
<MultiDataEntry
title={dataFields.construction_core_material_source_links.title}
slug="construction_core_material_source_links"
value={props.building.construction_core_material_source_links}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.construction_core_material_source_links.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
<hr/> <hr/>
<SelectDataEntry <SelectDataEntry
title={dataFields.construction_external_wall.title} title={dataFields.construction_external_wall.title}

View File

@ -591,6 +591,19 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
tooltip: "The main structural material", tooltip: "The main structural material",
example: "", example: "",
}, },
construction_core_material_source_type: {
category: Category.Construction,
title: "Source type",
tooltip: "Source of roof covering data",
example: "",
items: commonSourceTypes
},
construction_core_material_source_links: {
category: Category.Construction,
title: "Source links",
tooltip: "URL(s) for roof covering data source(s)",
example: ["", "", ""],
},
construction_secondary_materials: { construction_secondary_materials: {
category: Category.Construction, category: Category.Construction,

View File

@ -32,4 +32,7 @@ ALTER TABLE buildings DROP COLUMN IF EXISTS construction_external_wall_source_li
ALTER TABLE buildings DROP COLUMN IF EXISTS construction_ground_floor; 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_type;
ALTER TABLE buildings DROP COLUMN IF EXISTS construction_ground_floor_source_links; ALTER TABLE buildings DROP COLUMN IF EXISTS construction_ground_floor_source_links;
ALTER TABLE buildings DROP COLUMN IF EXISTS construction_core_material_source_type;
ALTER TABLE buildings DROP COLUMN IF EXISTS construction_core_material_source_links;

View File

@ -32,4 +32,7 @@ ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_external_wall_source
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_ground_floor 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_type text;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_ground_floor_source_links text[]; ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_ground_floor_source_links text[];
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_core_material_source_type text;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS construction_core_material_source_links text[];