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
@ -179,41 +256,41 @@ const PlanningView: React.FunctionComponent<CategoryViewProps> = (props) => {
</i> </i>
</div> </div>
<LogicalDataEntry <LogicalDataEntry
title="Is the building inside a Flood Zone?" title="Is the building inside a Flood Zone?"
slug="planning_live_application" slug="planning_live_application"
value={null} value={null}
disabled={true} disabled={true}
tooltip={"the GLA official description: \"All areas with more than a 1 in 1,000 annual probability of either river or sea flooding.\""} tooltip={"the GLA official description: \"All areas with more than a 1 in 1,000 annual probability of either river or sea flooding.\""}
/> />
<button className={`map-switcher-inline ${flood}-state btn btn-outline btn-outline-dark ${darkLightTheme}`} onClick={floodSwitchOnClick}> <button className={`map-switcher-inline ${flood}-state btn btn-outline btn-outline-dark ${darkLightTheme}`} onClick={floodSwitchOnClick}>
{(flood === 'enabled')? 'Click to hide Flood Zones' : 'Click to see Flood Zones mapped'} {(flood === 'enabled')? 'Click to hide Flood Zones' : 'Click to see Flood Zones mapped'}
</button> </button>
<LogicalDataEntry <LogicalDataEntry
title="Is the building in a Housing Zone?" title="Is the building in a Housing Zone?"
slug="planning_live_application" slug="planning_live_application"
value={null} value={null}
disabled={true} disabled={true}
tooltip={"the GLA official description: \"Housing zones are areas funded by the Mayor and government to attract developers and relevant partners to build new homes.\""} tooltip={"the GLA official description: \"Housing zones are areas funded by the Mayor and government to attract developers and relevant partners to build new homes.\""}
/> />
<button className={`map-switcher-inline ${housing}-state btn btn-outline btn-outline-dark ${darkLightTheme}`} onClick={housingSwitchOnClick}> <button className={`map-switcher-inline ${housing}-state btn btn-outline btn-outline-dark ${darkLightTheme}`} onClick={housingSwitchOnClick}>
{(housing === 'enabled')? 'Click to hide Housing Zones' : 'Click to see Housing Zones mapped'} {(housing === 'enabled')? 'Click to hide Housing Zones' : 'Click to see Housing Zones mapped'}
</button> </button>
<LogicalDataEntry <LogicalDataEntry
title="Is the building in a Creative Enterprise Zone?" title="Is the building in a Creative Enterprise Zone?"
slug="planning_live_application" slug="planning_live_application"
value={null} value={null}
disabled={true} disabled={true}
tooltip={"GLA official description: \"Creative Enterprise Zones are a new Mayoral initiative to designate areas of London where artists and creative businesses can find permanent affordable space to work; are supported to start-up and grow; and where local people are helped to learn creative sector skills and find new jobs.\""} tooltip={"GLA official description: \"Creative Enterprise Zones are a new Mayoral initiative to designate areas of London where artists and creative businesses can find permanent affordable space to work; are supported to start-up and grow; and where local people are helped to learn creative sector skills and find new jobs.\""}
/> />
<button className={`map-switcher-inline ${creative}-state btn btn-outline btn-outline-dark ${darkLightTheme}`} onClick={creativeSwitchOnClick}> <button className={`map-switcher-inline ${creative}-state btn btn-outline btn-outline-dark ${darkLightTheme}`} onClick={creativeSwitchOnClick}>
{(creative === 'enabled')? 'Click to hide Creative Enterprise Zones' : 'Click to see Creative Enterprise Zones'} {(creative === 'enabled')? 'Click to hide Creative Enterprise Zones' : 'Click to see Creative Enterprise Zones'}
</button> </button>
<LogicalDataEntry <LogicalDataEntry
title="Is the building within a Protected Vista?" title="Is the building within a Protected Vista?"
slug="planning_live_application" slug="planning_live_application"
value={null} value={null}
disabled={true} disabled={true}
tooltip={"GLA official description: \"The Protected Vistas are established in the London Plan with more detailed guidance provided in the London View Management Framework (LVMF). The London Plan seeks to protect the significant views which help to define London, including the panoramas, linear views and townscape views in this layer.\""} tooltip={"GLA official description: \"The Protected Vistas are established in the London Plan with more detailed guidance provided in the London View Management Framework (LVMF). The London Plan seeks to protect the significant views which help to define London, including the panoramas, linear views and townscape views in this layer.\""}
/> />
<button className={`map-switcher-inline ${vista}-state btn btn-outline btn-outline-dark ${darkLightTheme}`} onClick={vistaSwitchOnClick}> <button className={`map-switcher-inline ${vista}-state btn btn-outline btn-outline-dark ${darkLightTheme}`} onClick={vistaSwitchOnClick}>
{(vista === 'enabled')? 'Click to hide Protected Vistas' : 'Click to see Protected Vistas'} {(vista === 'enabled')? 'Click to hide Protected Vistas' : 'Click to see Protected Vistas'}

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

@ -12,4 +12,9 @@ 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_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

@ -12,4 +12,9 @@ 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_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

@ -4,4 +4,11 @@ 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;