Merge pull request #881 from colouring-cities/update-planning

Update planning section
This commit is contained in:
Ed Chalstrey 2022-07-25 11:47:39 +01:00 committed by GitHub
commit 2cb1538038
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 84 additions and 15 deletions

View File

@ -178,16 +178,20 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
verify: true,
},
planning_in_list: {
edit: false,
edit: true,
verify: true,
},
planning_list_id: {
edit: false,
edit: true,
verify: true,
},
planning_list_cat: {
edit: false,
edit: true,
verify: true,
},
planning_list_grade: {
edit: false,
edit: true,
verify: true,
},
planning_heritage_at_risk_id: {
edit: true,
@ -233,6 +237,10 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
edit: true,
verify: true,
},
planning_nhle_link: {
edit: true,
verify: true,
},
sust_breeam_rating: {
edit: true,
verify: true,

View File

@ -2,6 +2,7 @@ import React, { Fragment } from 'react';
import InfoBox from '../../components/info-box';
import { dataFields } from '../../config/data-fields-config';
import { MultiDataEntry } from '../data-components/multi-data-entry/multi-data-entry';
import CheckboxDataEntry from '../data-components/checkbox-data-entry';
import DataEntry from '../data-components/data-entry';
import { DataEntryGroup } from '../data-components/data-entry-group';
@ -41,7 +42,7 @@ const PlanningView: React.FunctionComponent<CategoryViewProps> = (props) => (
title="Is a planning application live for this site?"
slug="planning_live_application"
value={null}
disabled={true}
disabled={false}
/>
<CheckboxDataEntry
title={dataFields.planning_demolition_proposed.title}
@ -50,19 +51,19 @@ const PlanningView: React.FunctionComponent<CategoryViewProps> = (props) => (
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
disabled={true}
disabled={false}
/>
<CheckboxDataEntry
title="Has this application recently been been approved/refused?"
slug="planning_recent_outcome"
value={null}
disabled={true}
disabled={false}
/>
<CheckboxDataEntry
title="Has the work been carried out?"
slug="planning_carried_out"
value={null}
disabled={true}
disabled={false}
/>
<InfoBox msg="For historical planning applications see Planning Portal link" />
{/*
@ -75,7 +76,7 @@ const PlanningView: React.FunctionComponent<CategoryViewProps> = (props) => (
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
disabled={true}
disabled={false}
/>
<DataEntry
title={dataFields.planning_demolition_history.title}
@ -84,7 +85,7 @@ const PlanningView: React.FunctionComponent<CategoryViewProps> = (props) => (
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
disabled={true}
disabled={false}
/>
*/}
</DataEntryGroup>
@ -127,25 +128,61 @@ const PlanningView: React.FunctionComponent<CategoryViewProps> = (props) => (
slug="planning_in_list"
value={props.building.planning_in_list}
mode={props.mode}
disabled={true}
disabled={false}
copy={props.copy}
onChange={props.onChange}
/>
<Verification
slug="planning_in_list"
allow_verify={props.user !== undefined && props.building.planning_in_list !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("planning_in_list")}
user_verified_as={props.user_verified.planning_in_list}
verified_count={props.building.verified.planning_in_list}
/>
<MultiDataEntry
title={dataFields.planning_nhle_link.title}
slug="planning_nhle_link"
value={props.building.planning_nhle_link}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.planning_nhle_link.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
<Verification
slug="planning_nhle_link"
allow_verify={props.user !== undefined && props.building.planning_nhle_link !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("planning_nhle_link")}
user_verified_as={props.user_verified.planning_nhle_link}
verified_count={props.building.verified.planning_nhle_link}
/>
<DataEntry
title={dataFields.planning_list_id.title}
slug="planning_list_id"
value={props.building.planning_list_id}
mode={props.mode}
disabled={true}
disabled={false}
copy={props.copy}
onChange={props.onChange}
/>
<Verification
slug="planning_list_id"
allow_verify={props.user !== undefined && props.building.planning_list_id !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("planning_list_id")}
user_verified_as={props.user_verified.planning_list_id}
verified_count={props.building.verified.planning_list_id}
/>
<SelectDataEntry
title={dataFields.planning_list_cat.title}
slug="planning_list_cat"
value={props.building.planning_list_cat}
mode={props.mode}
disabled={true}
disabled={false}
copy={props.copy}
onChange={props.onChange}
options={[
@ -156,12 +193,20 @@ const PlanningView: React.FunctionComponent<CategoryViewProps> = (props) => (
"None"
]}
/>
<Verification
slug="planning_list_cat"
allow_verify={props.user !== undefined && props.building.planning_list_cat !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("planning_list_cat")}
user_verified_as={props.user_verified.planning_list_cat}
verified_count={props.building.verified.planning_list_cat}
/>
<SelectDataEntry
title={dataFields.planning_list_grade.title}
slug="planning_list_grade"
value={props.building.planning_list_grade}
mode={props.mode}
disabled={true}
disabled={false}
copy={props.copy}
onChange={props.onChange}
options={[
@ -171,6 +216,14 @@ const PlanningView: React.FunctionComponent<CategoryViewProps> = (props) => (
"None"
]}
/>
<Verification
slug="planning_list_grade"
allow_verify={props.user !== undefined && props.building.planning_list_grade !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("planning_list_grade")}
user_verified_as={props.user_verified.planning_list_grade}
verified_count={props.building.verified.planning_list_grade}
/>
<DataEntry
title={dataFields.planning_heritage_at_risk_id.title}
slug="planning_heritage_at_risk_id"

View File

@ -460,10 +460,16 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
},
planning_in_list: {
category: Category.Planning,
title: "Is listed on the National Heritage List for England?",
title: "Is it listed on the National Heritage List for England?",
example: true,
//tooltip: ,
},
planning_nhle_link: {
category: Category.Planning,
title: "NHLE list entry link",
tooltip: "URL for National Heritage List for England entry",
example: ["", "", ""],
},
planning_list_id: {
category: Category.Planning,
title: "National Heritage List for England list id",

View File

@ -0,0 +1 @@
ALTER TABLE buildings DROP COLUMN IF EXISTS planning_nhle_link;

View File

@ -0,0 +1 @@
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_nhle_link text[];