Activate fields in Planning Section

- Year of Completion #1197
- Incomplete/missing data #1198
This commit is contained in:
Mike Simpson 2023-06-29 16:54:17 +01:00
parent 1e41cc2e11
commit 9b73dd5e62
6 changed files with 187 additions and 50 deletions

View File

@ -285,6 +285,14 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
edit: true, edit: true,
verify: true, verify: true,
}, },
planning_crowdsourced_site_completion_source_type: {
edit: true,
verify: true,
},
planning_crowdsourced_site_completion_source_links: {
edit: true,
verify: true,
},
planning_crowdsourced_planning_id: { planning_crowdsourced_planning_id: {
edit: true, edit: true,
verify: true, verify: true,
@ -333,6 +341,14 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
edit: true, edit: true,
verify: true, verify: true,
}, },
planning_missing_data: {
edit: true,
verify: true,
},
planning_missing_data_links: {
edit: true,
verify: true,
},
sust_breeam_rating: { sust_breeam_rating: {
edit: true, edit: true,
verify: true, verify: true,

View File

@ -65,6 +65,8 @@ const PlanningView: React.FunctionComponent<CategoryViewProps> = (props) => {
} }
const { flood, floodSwitchOnClick, housing, housingSwitchOnClick, creative, creativeSwitchOnClick, vista, vistaSwitchOnClick, parcel, parcelSwitchOnClick, conservation, conservationSwitchOnClick, darkLightTheme } = useDisplayPreferences(); const { flood, floodSwitchOnClick, housing, housingSwitchOnClick, creative, creativeSwitchOnClick, vista, vistaSwitchOnClick, parcel, parcelSwitchOnClick, conservation, conservationSwitchOnClick, darkLightTheme } = useDisplayPreferences();
const communityLinkUrl = `/${props.mode}/${Category.Community}/${props.building.building_id}`; const communityLinkUrl = `/${props.mode}/${Category.Community}/${props.building.building_id}`;
const currentYear = new Date().getFullYear();
return ( return (
<Fragment> <Fragment>
<DataEntryGroup name="Current planning applications" collapsed={true} > <DataEntryGroup name="Current planning applications" collapsed={true} >
@ -88,36 +90,111 @@ const PlanningView: React.FunctionComponent<CategoryViewProps> = (props) => {
} }
</DataEntryGroup> </DataEntryGroup>
<DataEntryGroup name="Year of completion" collapsed={true} > <DataEntryGroup name="Year of completion" collapsed={true} >
<DataEntry <LogicalDataEntry
title="Was the building completed?" slug='planning_crowdsourced_site_completion_status'
slug="" title={dataFields.planning_crowdsourced_site_completion_status.title}
value="" tooltip={dataFields.planning_crowdsourced_site_completion_status.tooltip}
mode='view' value={props.building.planning_crowdsourced_site_completion_status}
tooltip='Coming Soon' copy={props.copy}
onChange={props.onChange}
mode={props.mode}
/> />
<DataEntry <Verification
title="Year of completion" slug="planning_crowdsourced_site_completion_status"
slug="" allow_verify={props.user !== undefined && props.building.planning_crowdsourced_site_completion_status !== null && !props.edited}
value="" onVerify={props.onVerify}
mode='view' user_verified={props.user_verified.hasOwnProperty("planning_crowdsourced_site_completion_status")}
tooltip='Coming Soon' user_verified_as={props.user_verified.planning_crowdsourced_site_completion_status}
verified_count={props.building.verified.planning_crowdsourced_site_completion_status}
/> />
{props.building.planning_crowdsourced_site_completion_status == null ? <></> :
<>
<NumericDataEntry
title={dataFields.planning_crowdsourced_site_completion_year.title}
slug="planning_crowdsourced_site_completion_year"
value={props.building.planning_crowdsourced_site_completion_year}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
step={1}
min={1}
max={currentYear}
tooltip={dataFields.planning_crowdsourced_site_completion_year.tooltip}
/>
<Verification
slug="planning_crowdsourced_site_completion_year"
allow_verify={props.user !== undefined && props.building.planning_crowdsourced_site_completion_year !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("planning_crowdsourced_site_completion_year")}
user_verified_as={props.user_verified.planning_crowdsourced_site_completion_year}
verified_count={props.building.verified.planning_crowdsourced_site_completion_year}
/>
<SelectDataEntry
title={dataFields.planning_crowdsourced_site_completion_source_type.title}
slug="planning_crowdsourced_site_completion_source_type"
value={props.building.planning_crowdsourced_site_completion_source_type}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.planning_crowdsourced_site_completion_source_type.tooltip}
options={dataFields.planning_crowdsourced_site_completion_source_type.items}
placeholder={dataFields.planning_crowdsourced_site_completion_source_type.example}
/>
{(props.building.planning_crowdsourced_site_completion_source_type == dataFields.planning_crowdsourced_site_completion_source_type.items[0] ||
props.building.planning_crowdsourced_site_completion_source_type == dataFields.planning_crowdsourced_site_completion_source_type.items[1] ||
props.building.planning_crowdsourced_site_completion_source_type == null) ? <></> :
<>
<MultiDataEntry
title={dataFields.planning_crowdsourced_site_completion_source_links.title}
slug="planning_crowdsourced_site_completion_source_links"
value={props.building.planning_crowdsourced_site_completion_source_links}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.planning_crowdsourced_site_completion_source_links.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
</>
}
</DataEntryGroup> </DataEntryGroup>
<DataEntryGroup name="Incomplete/missing data" collapsed={true} > <DataEntryGroup name="Incomplete/missing data" collapsed={true} >
<DataEntry <LogicalDataEntry
title="Is information on a planning application relating to this building missing?" slug='planning_missing_data'
slug="" title={dataFields.planning_missing_data.title}
value="" tooltip={dataFields.planning_missing_data.tooltip}
mode='view' value={props.building.planning_missing_data}
tooltip='Coming Soon' copy={props.copy}
onChange={props.onChange}
mode={props.mode}
/> />
<DataEntry <Verification
title="Link (to correct data)" slug="planning_missing_data"
slug="" allow_verify={props.user !== undefined && props.building.planning_missing_data !== null && !props.edited}
value="" onVerify={props.onVerify}
mode='view' user_verified={props.user_verified.hasOwnProperty("planning_missing_data")}
tooltip='Coming Soon' user_verified_as={props.user_verified.planning_missing_data}
verified_count={props.building.verified.planning_missing_data}
/> />
{props.building.planning_missing_data == null ? <></> :
<>
<MultiDataEntry
title={dataFields.planning_missing_data_links.title}
slug="planning_missing_data_links"
value={props.building.planning_missing_data_links}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.planning_missing_data_links.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
<InfoBox> <InfoBox>
If you feel there are incorrect or missing data relating to this building please contact: If you feel there are incorrect or missing data relating to this building please contact:
planningdata@London.gov.uk planningdata@London.gov.uk

View File

@ -695,13 +695,26 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
category: Category.Planning, category: Category.Planning,
title: "Has the work on this site been completed?", title: "Has the work on this site been completed?",
example: true, example: true,
//tooltip: , tooltip: "Has the work on this site been completed?",
}, },
planning_crowdsourced_site_completion_year: { planning_crowdsourced_site_completion_year: {
category: Category.Planning, category: Category.Planning,
title: "Year of completion if known", title: "Year of completion (best estimate)",
example: 2022, example: 2022,
//tooltip: , tooltip: "Year of completion, if known",
},
planning_crowdsourced_site_completion_source_type: {
category: Category.Team,
title: "Source type",
tooltip: "Source type for work complete data",
example: "",
items: commonSourceTypes
},
planning_crowdsourced_site_completion_source_links: {
category: Category.Team,
title: "Source links",
tooltip: "URL(s) for work complete data",
example: ["", "", ""],
}, },
planning_crowdsourced_planning_id: { planning_crowdsourced_planning_id: {
category: Category.Planning, category: Category.Planning,
@ -775,6 +788,20 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
example: true, example: true,
//tooltip: , //tooltip: ,
}, },
planning_missing_data: {
category: Category.Planning,
title: "Is information on a planning application relating to this building missing?",
tooltip: "Is information on a planning application relating to this building missing?",
example: true,
},
planning_missing_data_links: {
category: Category.Team,
title: "Source links",
tooltip: "URL(s) for missing planning information",
example: ["", "", ""],
},
is_domestic: { is_domestic: {
category: Category.Team, category: Category.Team,
title: "Is the building a home/residential building?", title: "Is the building a home/residential building?",

View File

@ -13,3 +13,8 @@ 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;
ALTER TABLE buildings DROP COLUMN IF EXISTS energy_green_roof_source_type; ALTER TABLE buildings DROP COLUMN IF EXISTS energy_green_roof_source_type;
ALTER TABLE buildings DROP COLUMN IF EXISTS energy_green_roof_source_links; ALTER TABLE buildings DROP COLUMN IF EXISTS energy_green_roof_source_links;
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_crowdsourced_site_completion_source_type;
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_crowdsourced_site_completion_source_links;
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_missing_data;
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_missing_data_links;

View File

@ -13,3 +13,8 @@ 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 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_type text;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS energy_green_roof_source_links text[]; ALTER TABLE buildings ADD COLUMN IF NOT EXISTS energy_green_roof_source_links text[];
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_crowdsourced_site_completion_source_type text;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_crowdsourced_site_completion_source_links text[];
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_missing_data boolean;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_missing_data_links text[];

View File

@ -5,3 +5,10 @@ ALTER TABLE buildings DROP COLUMN IF EXISTS context_flats_garden;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS context_front_garden boolean; ALTER TABLE buildings ADD COLUMN IF NOT EXISTS context_front_garden boolean;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS context_back_garden boolean; ALTER TABLE buildings ADD COLUMN IF NOT EXISTS context_back_garden boolean;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS context_flats_garden boolean; ALTER TABLE buildings ADD COLUMN IF NOT EXISTS context_flats_garden boolean;
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_crowdsourced_site_completion_status;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_crowdsourced_site_completion_status boolean;
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_crowdsourced_site_completion_year;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_crowdsourced_site_completion_year smallint;