set up current_landuse_source like date_source

This commit is contained in:
Ed Chalstrey 2022-05-12 16:30:55 +01:00
parent 694335cf3b
commit b46f637911
2 changed files with 129 additions and 69 deletions

View File

@ -14,7 +14,12 @@ import Verification from '../data-components/verification';
/** /**
* Use view/edit section * Use view/edit section
*/ */
const UseView: React.FunctionComponent<CategoryViewProps> = (props) => ( const UseView: React.FunctionComponent<CategoryViewProps> = (props) => {
if (props.building.current_landuse_source == "Expert/personal knowledge of building" ||
props.building.current_landuse_source == "Online streetview image" ||
props.building.current_landuse_source == null
){
return (
<Fragment> <Fragment>
<InfoBox msg="93% of properties in UK are dwellings so we have set this as the default colour. Can you help us colour-in all non-residential and mixed use buildings, and verify residential buildings too?"></InfoBox> <InfoBox msg="93% of properties in UK are dwellings so we have set this as the default colour. Can you help us colour-in all non-residential and mixed use buildings, and verify residential buildings too?"></InfoBox>
<MultiDataEntry <MultiDataEntry
@ -62,15 +67,60 @@ const UseView: React.FunctionComponent<CategoryViewProps> = (props) => (
onChange={props.onChange} onChange={props.onChange}
tooltip={dataFields.current_landuse_source.tooltip} tooltip={dataFields.current_landuse_source.tooltip}
placeholder="" placeholder=""
options={[ options={dataFields.current_landuse_source.items}
"Expert/personal knowledge of building", />
"Online streetview image", </Fragment>
"Open planning authority dataset", );
"Open property tax dataset", };
"Open housing dataset", return (
"Open address dataset", <Fragment>
"Other" <InfoBox msg="93% of properties in UK are dwellings so we have set this as the default colour. Can you help us colour-in all non-residential and mixed use buildings, and verify residential buildings too?"></InfoBox>
]} <MultiDataEntry
title={dataFields.current_landuse_group.title}
slug="current_landuse_group"
value={props.building.current_landuse_group}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
confirmOnEnter={true}
tooltip={dataFields.current_landuse_group.tooltip}
placeholder="Type new land use group here"
copyable={true}
autofill={true}
showAllOptionsOnEmpty={true}
/>
<Verification
slug="current_landuse_group"
allow_verify={props.user !== undefined && props.building.current_landuse_group !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("current_landuse_group")}
user_verified_as={props.user_verified.current_landuse_group && props.user_verified.current_landuse_group.join(", ")}
verified_count={props.building.verified.current_landuse_group}
/>
{
props.mode != 'view' &&
<InfoBox msg="Land use order, shown below, is automatically derived from the land use groups"></InfoBox>
}
<DataEntry
title={dataFields.current_landuse_order.title}
tooltip={dataFields.current_landuse_order.tooltip}
slug="current_landuse_order"
value={props.building.current_landuse_order}
mode={props.mode}
disabled={true}
copy={props.copy}
onChange={props.onChange}
/>
<SelectDataEntry
title={dataFields.current_landuse_source.title}
slug="current_landuse_source"
value={props.building.current_landuse_source}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.current_landuse_source.tooltip}
placeholder=""
options={dataFields.current_landuse_source.items}
/> />
<MultiDataEntry <MultiDataEntry
title={dataFields.current_landuse_link.title} title={dataFields.current_landuse_link.title}
@ -85,6 +135,7 @@ const UseView: React.FunctionComponent<CategoryViewProps> = (props) => (
/> />
</Fragment> </Fragment>
); );
};
const UseContainer = withCopyEdit(UseView); const UseContainer = withCopyEdit(UseView);
export default UseContainer; export default UseContainer;

View File

@ -198,6 +198,15 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
title: "Source of information", title: "Source of information",
tooltip: "Source for the current land use", tooltip: "Source for the current land use",
example: "", example: "",
items: [
"Expert/personal knowledge of building",
"Online streetview image",
"Open planning authority dataset",
"Open property tax dataset",
"Open housing dataset",
"Open address dataset",
"Other"
],
}, },
current_landuse_source_detail: { current_landuse_source_detail: {
category: Category.LandUse, category: Category.LandUse,