From 94220d6ecee693188468713d35c411386ecf7b64 Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Thu, 6 Jun 2024 21:45:04 +0200 Subject: [PATCH] chore: split residential unit List component schemas into six options (#3250) --- .../@planx/components/Checklist/Public.tsx | 1 - .../src/@planx/components/List/Editor.tsx | 24 +- .../@planx/components/List/Public/Context.tsx | 10 +- .../@planx/components/List/Public/Fields.tsx | 7 +- .../components/List/Public/index.test.tsx | 2 +- .../@planx/components/List/Public/index.tsx | 4 +- .../List/schemas/ResidentialUnits.ts | 73 ------ .../List/schemas/ResidentialUnits/Existing.ts | 72 ++++++ .../List/schemas/ResidentialUnits/GLA/New.ts | 211 ++++++++++++++++++ .../schemas/ResidentialUnits/GLA/Rebuilt.ts | 211 ++++++++++++++++++ .../schemas/ResidentialUnits/GLA/Removed.ts | 200 +++++++++++++++++ .../schemas/ResidentialUnits/GLA/Retained.ts | 200 +++++++++++++++++ .../List/schemas/ResidentialUnits/Proposed.ts | 72 ++++++ .../components/Flow/components/Node.tsx | 2 +- 14 files changed, 1002 insertions(+), 87 deletions(-) delete mode 100644 editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits.ts create mode 100644 editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/Existing.ts create mode 100644 editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/GLA/New.ts create mode 100644 editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/GLA/Rebuilt.ts create mode 100644 editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/GLA/Removed.ts create mode 100644 editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/GLA/Retained.ts create mode 100644 editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/Proposed.ts diff --git a/editor.planx.uk/src/@planx/components/Checklist/Public.tsx b/editor.planx.uk/src/@planx/components/Checklist/Public.tsx index 11e5c86ecf..768bc86f73 100644 --- a/editor.planx.uk/src/@planx/components/Checklist/Public.tsx +++ b/editor.planx.uk/src/@planx/components/Checklist/Public.tsx @@ -7,7 +7,6 @@ import Card from "@planx/components/shared/Preview/Card"; import CardHeader from "@planx/components/shared/Preview/CardHeader"; import { getIn, useFormik } from "formik"; import React, { useState } from "react"; -import InputLegend from "ui/editor/InputLegend"; import { ExpandableList, ExpandableListItem } from "ui/public/ExpandableList"; import FormWrapper from "ui/public/FormWrapper"; import FullWidthWrapper from "ui/public/FullWidthWrapper"; diff --git a/editor.planx.uk/src/@planx/components/List/Editor.tsx b/editor.planx.uk/src/@planx/components/List/Editor.tsx index bd1f6340f8..b7c4019628 100644 --- a/editor.planx.uk/src/@planx/components/List/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/List/Editor.tsx @@ -13,15 +13,33 @@ import InputRowLabel from "ui/shared/InputRowLabel"; import { EditorProps, ICONS, InternalNotes, MoreInformation } from "../ui"; import { List, parseContent } from "./model"; -import { ResidentialUnits } from "./schemas/ResidentialUnits"; +import { ResidentialUnitsExisting } from "./schemas/ResidentialUnits/Existing"; +import { ResidentialUnitsGLANew } from "./schemas/ResidentialUnits/GLA/New"; +import { ResidentialUnitsGLARebuilt } from "./schemas/ResidentialUnits/GLA/Rebuilt"; +import { ResidentialUnitsGLARemoved } from "./schemas/ResidentialUnits/GLA/Removed"; +import { ResidentialUnitsGLARetained } from "./schemas/ResidentialUnits/GLA/Retained"; +import { ResidentialUnitsProposed } from "./schemas/ResidentialUnits/Proposed"; import { Zoo } from "./schemas/Zoo"; type Props = EditorProps; export const SCHEMAS = [ - { name: "Residential Units (alpha)", schema: ResidentialUnits }, + { name: "Residential units - Existing", schema: ResidentialUnitsExisting }, + { name: "Residential units - Proposed", schema: ResidentialUnitsProposed }, + { name: "Residential units (GLA) - New", schema: ResidentialUnitsGLANew }, + { + name: "Residential units (GLA) - Rebuilt", + schema: ResidentialUnitsGLARebuilt, + }, + { + name: "Residentail units (GLA) - Removed", + schema: ResidentialUnitsGLARemoved, + }, + { + name: "Residential units (GLA) - Retained", + schema: ResidentialUnitsGLARetained, + }, { name: "Zoo (test)", schema: Zoo }, - // TODO: Residential units (GLA) ]; function ListComponent(props: Props) { diff --git a/editor.planx.uk/src/@planx/components/List/Public/Context.tsx b/editor.planx.uk/src/@planx/components/List/Public/Context.tsx index 6bdb461dd8..8ea9e68ddf 100644 --- a/editor.planx.uk/src/@planx/components/List/Public/Context.tsx +++ b/editor.planx.uk/src/@planx/components/List/Public/Context.tsx @@ -139,8 +139,16 @@ export const ListProvider: React.FC = (props) => { const flattenedPassportData = flatten(defaultPassportData); // basic example of general summary stats we can add onSubmit + let sumIdenticalUnits = 0; + defaultPassportData[`${props.fn}`].map( + (item) => (sumIdenticalUnits += parseInt(item?.identicalUnits)), + ); const summaries = { - [`${props.fn}.count`]: defaultPassportData[`${props.fn}`].length, + [`${props.fn}.total.listItems`]: + defaultPassportData[`${props.fn}`].length, + ...(sumIdenticalUnits > 0 && { + [`${props.fn}.total.units`]: sumIdenticalUnits, + }), }; handleSubmit?.({ diff --git a/editor.planx.uk/src/@planx/components/List/Public/Fields.tsx b/editor.planx.uk/src/@planx/components/List/Public/Fields.tsx index 36d0812e05..de3ee22acd 100644 --- a/editor.planx.uk/src/@planx/components/List/Public/Fields.tsx +++ b/editor.planx.uk/src/@planx/components/List/Public/Fields.tsx @@ -108,12 +108,9 @@ export const NumberFieldInput: React.FC> = ({ ); }; -export const RadioFieldInput: React.FC> = ({ - id, - data, - required, -}) => { +export const RadioFieldInput: React.FC> = (props) => { const { formik, activeIndex } = useListContext(); + const { id, data, required } = props; return ( diff --git a/editor.planx.uk/src/@planx/components/List/Public/index.test.tsx b/editor.planx.uk/src/@planx/components/List/Public/index.test.tsx index 83073e6250..ee007bca9d 100644 --- a/editor.planx.uk/src/@planx/components/List/Public/index.test.tsx +++ b/editor.planx.uk/src/@planx/components/List/Public/index.test.tsx @@ -43,7 +43,7 @@ const mockPayload = { "mockFn.two.email": "richard.parker@pi.com", "mockFn.two.name": "Richard Parker", "mockFn.two.size": "Medium", - "mockFn.count": 2, + "mockFn.total.listItems": 2, }, }; diff --git a/editor.planx.uk/src/@planx/components/List/Public/index.tsx b/editor.planx.uk/src/@planx/components/List/Public/index.tsx index 99b8cfc99c..39ebbd2389 100644 --- a/editor.planx.uk/src/@planx/components/List/Public/index.tsx +++ b/editor.planx.uk/src/@planx/components/List/Public/index.tsx @@ -170,7 +170,7 @@ const Root = () => { @@ -181,7 +181,7 @@ const Root = () => { sx={{ width: "100%" }} data-testid="list-add-button" > - + Add a new {schema.type.toLowerCase()} description + + Add another {schema.type.toLowerCase()} description diff --git a/editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits.ts b/editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits.ts deleted file mode 100644 index 27268f8d46..0000000000 --- a/editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { Schema } from "../model"; - -export const ResidentialUnits: Schema = { - type: "Residential Units", - fields: [ - { - type: "question", - data: { - title: "What type of change are you making?", - fn: "changeType", - options: [ - { id: "proposed", data: { text: "Proposed" } }, - { id: "existing", data: { text: "Existing" } }, - ], - }, - }, - { - type: "question", - unique: true, - data: { - title: "What is the tenure type?", - fn: "tenureType", - options: [ - { id: "marketHousing", data: { text: "Market housing" } }, - { - id: "socialAffordableRent", - data: { text: "Social and affordable rent" }, - }, - { - id: "affordableHomeOwnership", - data: { text: "Affordable home ownership" }, - }, - { id: "starterHome", data: { text: "Starter homes" } }, - { id: "selfBuild", data: { text: "Self build" } }, - ], - }, - }, - { - type: "question", - data: { - title: "What is the unit type?", - fn: "unitType", - options: [ - { id: "houses", data: { text: "Houses" } }, - { id: "flats", data: { text: "Flats" } }, - { id: "bedsits", data: { text: "Bedsits" } }, - { id: "starterHome", data: { text: "Starter homes" } }, - { id: "shelteredHousing", data: { text: "Sheltered housing" } }, - { id: "clusteredFlats", data: { text: "Clustered flats" } }, - { id: "other", data: { text: "Other" } }, - ], - }, - }, - { - type: "number", - data: { - title: "How many bedrooms are there?", - fn: "numberBedrooms", - allowNegatives: false, - }, - }, - { - type: "number", - data: { - title: - "How many residential units does the description above apply to?", - fn: "numberIdenticalUnits", - allowNegatives: false, - }, - }, - ], - min: 1, -} as const; diff --git a/editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/Existing.ts b/editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/Existing.ts new file mode 100644 index 0000000000..f7f7c5ac86 --- /dev/null +++ b/editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/Existing.ts @@ -0,0 +1,72 @@ +import { Schema } from "../../model"; + +export const ResidentialUnitsExisting: Schema = { + type: "Existing residential unit", + fields: [ + { + type: "question", + data: { + title: "What best describes the tenure of this unit?", + fn: "tenure", + options: [ + { id: "MH", data: { text: "Market housing", val: "MH" } }, + { + id: "SAIR", + data: { text: "Social, affordable or interim rent", val: "SAIR" }, + }, + { + id: "AHO", + data: { text: "Affordable home ownership", val: "AHO" }, + }, + { id: "SH", data: { text: "Starter homes", val: "SH" } }, + { + id: "selfCustomBuild", + data: { + text: "Self-build and custom build", + val: "selfCustomBuild", + }, + }, + { id: "other", data: { text: "Other", val: "other" } }, + ], + }, + }, + { + type: "question", + data: { + title: "What best describes the type of this unit?", + fn: "type", + options: [ + { id: "house", data: { text: "House", val: "house" } }, + { + id: "flat", + data: { text: "Flat, apartment or maisonette", val: "flat" }, + }, + { + id: "sheltered", + data: { text: "Sheltered housing", val: "sheltered" }, + }, + { id: "studio", data: { text: "Studio or bedsit", val: "studio" } }, + { id: "cluster", data: { text: "Cluster flat", val: "cluster" } }, + { id: "other", data: { text: "Other", val: "other" } }, + ], + }, + }, + { + type: "number", + data: { + title: "How many bedrooms does this unit have?", + fn: "bedrooms", + allowNegatives: false, + }, + }, + { + type: "number", + data: { + title: "How many identical units does the description above apply to?", + fn: "identicalUnits", + allowNegatives: false, + }, + }, + ], + min: 1, +} as const; diff --git a/editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/GLA/New.ts b/editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/GLA/New.ts new file mode 100644 index 0000000000..bb662e6135 --- /dev/null +++ b/editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/GLA/New.ts @@ -0,0 +1,211 @@ +import { Schema } from "@planx/components/List/model"; + +export const ResidentialUnitsGLANew: Schema = { + type: "New built residential unit", + fields: [ + { + type: "number", + data: { + title: "What is the number of habitable rooms of this unit?", + fn: "habitable", + allowNegatives: false, + }, + }, + { + type: "number", + data: { + title: "What is the number of bedrooms of this unit?", + fn: "bedrooms", + allowNegatives: false, + }, + }, + { + type: "question", + data: { + title: "Which best describes the tenure of this unit?", + fn: "tenure", + options: [ + { id: "LAR", data: { text: "London Affordable Rent" } }, + { + id: "AR", + data: { text: "Affordable rent (not at LAR benchmark rents)" }, + }, + { id: "SR", data: { text: "Social rent" } }, + { id: "LRR", data: { text: "London Living Rent" } }, + { id: "sharedEquity", data: { text: "Shared equity" } }, + { id: "LSO", data: { text: "London Shared Ownership" } }, + { id: "DMS", data: { text: "Discount market sale" } }, + { id: "DMR", data: { text: "Discount market rent" } }, + { + id: "DMRLLR", + data: { + text: "Discount market rent (charged at London Living Rents)", + }, + }, + { id: "marketForRent", data: { text: "Market for rent" } }, + { id: "SH", data: { text: "Starter homes" } }, + { + id: "selfCustomBuild", + data: { text: "Self-build and custom build" }, + }, + { id: "marketForSale", data: { text: "Market for sale" } }, + { id: "other", data: { text: "Other" } }, + ], + }, + }, + // { + // type: "checklist", // @todo + // data: { + // title: "Is this unit compliant with any of the following?", + // fn: "compliance", + // options: [ + // { + // id: "m42", + // data: { text: "Part M4(2) of the Building Regulations 2010" }, + // }, + // { + // id: "m432a", + // data: { text: "Part M4(3)(2a) of the Building Regulations 2010" }, + // }, + // { + // id: "m432b", + // data: { text: "Part M4(3)(2b) of the Building Regulations 2010" }, + // }, + // { id: "none", data: { text: "None of these" } }, + // ], + // }, + // }, + { + type: "question", + data: { + title: + "Is this unit compliant with Part M4(2) of the Building Regulations 2010?", + fn: "complianceM42", // compliance.m42 + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "question", + data: { + title: + "Is this unit compliant with Part M4(3)(2a) of the Building Regulations 2010?", + fn: "complianceM432a", // compliance.m432a + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "question", + data: { + title: + "Is this unit compliant with Part M4(3)(2b) of the Building Regulations 2010?", + fn: "complianceM432b", // compliance.m432b + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "question", + data: { + title: "What best describes the type of this unit?", + fn: "type", + options: [ + { id: "terraced", data: { text: "Terraced home" } }, + { id: "semiDetached", data: { text: "Semi detached home" } }, + { id: "detached", data: { text: "Detached home" } }, + { id: "flat", data: { text: "Flat/apartment or maisonette" } }, + { id: "LW", data: { text: "Live/work unit" } }, + { id: "cluster", data: { text: "Cluster flat" } }, + { id: "studio", data: { text: "Studio or bedsit" } }, + { id: "coLiving", data: { text: "Co living unit" } }, + { id: "hostel", data: { text: "Hostel room" } }, + { id: "HMO", data: { text: "HMO" } }, + { id: "student", data: { text: "Student accomodation" } }, + { id: "other", data: { text: "Other" } }, + ], + }, + }, + { + type: "question", + data: { + title: "What best describes the provider of this unit?", + fn: "provider", + options: [ + { id: "private", data: { text: "Private" } }, + { id: "privateRented", data: { text: "Private rented sector" } }, + { id: "HA", data: { text: "Housing association" } }, + { id: "LA", data: { text: "Local authority" } }, + { id: "publicAuthority", data: { text: "Other public authority" } }, + { id: "councilDelivery", data: { text: "Council delivery company" } }, + { + id: "councilBuildToRent", + data: { text: "Council delivered build to rent" }, + }, + { + id: "affordableHousing", + data: { text: "Other affordable housing provider" }, + }, + { id: "selfBuild", data: { text: "Self-build" } }, + ], + }, + }, + { + type: "question", + data: { + title: "Is this unit built on garden land?", + fn: "garden", + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "number", + data: { + title: "What is the Gross Internal Floor Area (GIA) of this unit?", + units: "m²", + fn: "area", + allowNegatives: false, + }, + }, + { + type: "question", + data: { + title: "Will this unit provide sheltered accommodation?", + fn: "sheltered", + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "question", + data: { + title: "Is this unit specifically designed for older people?", + fn: "olderPersons", + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "number", + data: { + title: "How many identical units does the description above apply to?", + fn: "identicalUnits", + allowNegatives: false, + }, + }, + ], + min: 1, +} as const; diff --git a/editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/GLA/Rebuilt.ts b/editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/GLA/Rebuilt.ts new file mode 100644 index 0000000000..8535119b8e --- /dev/null +++ b/editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/GLA/Rebuilt.ts @@ -0,0 +1,211 @@ +import { Schema } from "@planx/components/List/model"; + +export const ResidentialUnitsGLARebuilt: Schema = { + type: "Rebuilt residential unit", + fields: [ + { + type: "number", + data: { + title: "What is the number of habitable rooms of this unit?", + fn: "habitable", + allowNegatives: false, + }, + }, + { + type: "number", + data: { + title: "What is the number of bedrooms of this unit?", + fn: "bedrooms", + allowNegatives: false, + }, + }, + { + type: "question", + data: { + title: "Which best describes the tenure of this unit?", + fn: "tenure", + options: [ + { id: "LAR", data: { text: "London Affordable Rent" } }, + { + id: "AR", + data: { text: "Affordable rent (not at LAR benchmark rents)" }, + }, + { id: "SR", data: { text: "Social rent" } }, + { id: "LRR", data: { text: "London Living Rent" } }, + { id: "sharedEquity", data: { text: "Shared equity" } }, + { id: "LSO", data: { text: "London Shared Ownership" } }, + { id: "DMS", data: { text: "Discount market sale" } }, + { id: "DMR", data: { text: "Discount market rent" } }, + { + id: "DMRLLR", + data: { + text: "Discount market rent (charged at London Living Rents)", + }, + }, + { id: "marketForRent", data: { text: "Market for rent" } }, + { id: "SH", data: { text: "Starter homes" } }, + { + id: "selfCustomBuild", + data: { text: "Self-build and custom build" }, + }, + { id: "marketForSale", data: { text: "Market for sale" } }, + { id: "other", data: { text: "Other" } }, + ], + }, + }, + // { + // type: "checklist", // @todo + // data: { + // title: "Is this unit compliant with any of the following?", + // fn: "compliance", + // options: [ + // { + // id: "m42", + // data: { text: "Part M4(2) of the Building Regulations 2010" }, + // }, + // { + // id: "m432a", + // data: { text: "Part M4(3)(2a) of the Building Regulations 2010" }, + // }, + // { + // id: "m432b", + // data: { text: "Part M4(3)(2b) of the Building Regulations 2010" }, + // }, + // { id: "none", data: { text: "None of these" } }, + // ], + // }, + // }, + { + type: "question", + data: { + title: + "Is this unit compliant with Part M4(2) of the Building Regulations 2010?", + fn: "complianceM42", // compliance.m42 + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "question", + data: { + title: + "Is this unit compliant with Part M4(3)(2a) of the Building Regulations 2010?", + fn: "complianceM432a", // compliance.m432a + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "question", + data: { + title: + "Is this unit compliant with Part M4(3)(2b) of the Building Regulations 2010?", + fn: "complianceM432b", // compliance.m432b + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "question", + data: { + title: "What best describes the type of this unit?", + fn: "type", + options: [ + { id: "terraced", data: { text: "Terraced home" } }, + { id: "semiDetached", data: { text: "Semi detached home" } }, + { id: "detached", data: { text: "Detached home" } }, + { id: "flat", data: { text: "Flat/apartment or maisonette" } }, + { id: "LW", data: { text: "Live/work unit" } }, + { id: "cluster", data: { text: "Cluster flat" } }, + { id: "studio", data: { text: "Studio or bedsit" } }, + { id: "coLiving", data: { text: "Co living unit" } }, + { id: "hostel", data: { text: "Hostel room" } }, + { id: "HMO", data: { text: "HMO" } }, + { id: "student", data: { text: "Student accomodation" } }, + { id: "other", data: { text: "Other" } }, + ], + }, + }, + { + type: "question", + data: { + title: "What best describes the provider of this unit?", + fn: "provider", + options: [ + { id: "private", data: { text: "Private" } }, + { id: "privateRented", data: { text: "Private rented sector" } }, + { id: "HA", data: { text: "Housing association" } }, + { id: "LA", data: { text: "Local authority" } }, + { id: "publicAuthority", data: { text: "Other public authority" } }, + { id: "councilDelivery", data: { text: "Council delivery company" } }, + { + id: "councilBuildToRent", + data: { text: "Council delivered build to rent" }, + }, + { + id: "affordableHousing", + data: { text: "Other affordable housing provider" }, + }, + { id: "selfBuild", data: { text: "Self-build" } }, + ], + }, + }, + { + type: "question", + data: { + title: "Is this unit built on garden land?", + fn: "garden", + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "number", + data: { + title: "What is the Gross Internal Floor Area (GIA) of this unit?", + units: "m²", + fn: "area", + allowNegatives: false, + }, + }, + { + type: "question", + data: { + title: "Will this unit provide sheltered accommodation?", + fn: "sheltered", + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "question", + data: { + title: "Is this unit specifically designed for older people?", + fn: "olderPersons", + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "number", + data: { + title: "How many identical units does the description above apply to?", + fn: "identicalUnits", + allowNegatives: false, + }, + }, + ], + min: 1, +} as const; diff --git a/editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/GLA/Removed.ts b/editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/GLA/Removed.ts new file mode 100644 index 0000000000..bd618a4c6d --- /dev/null +++ b/editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/GLA/Removed.ts @@ -0,0 +1,200 @@ +import { Schema } from "@planx/components/List/model"; + +export const ResidentialUnitsGLARemoved: Schema = { + type: "Removed residential unit", + fields: [ + { + type: "number", + data: { + title: "What is the number of habitable rooms of this unit?", + fn: "habitable", + allowNegatives: false, + }, + }, + { + type: "number", + data: { + title: "What is the number of bedrooms of this unit?", + fn: "bedrooms", + allowNegatives: false, + }, + }, + { + type: "question", + data: { + title: "Which best describes the tenure of this unit?", + fn: "tenure", + options: [ + { id: "LAR", data: { text: "London Affordable Rent" } }, + { + id: "AR", + data: { text: "Affordable rent (not at LAR benchmark rents)" }, + }, + { id: "SR", data: { text: "Social rent" } }, + { id: "LRR", data: { text: "London Living Rent" } }, + { id: "sharedEquity", data: { text: "Shared equity" } }, + { id: "LSO", data: { text: "London Shared Ownership" } }, + { id: "DMS", data: { text: "Discount market sale" } }, + { id: "DMR", data: { text: "Discount market rent" } }, + { + id: "DMRLLR", + data: { + text: "Discount market rent (charged at London Living Rents)", + }, + }, + { id: "marketForRent", data: { text: "Market for rent" } }, + { id: "SH", data: { text: "Starter homes" } }, + { + id: "selfCustomBuild", + data: { text: "Self-build and custom build" }, + }, + { id: "marketForSale", data: { text: "Market for sale" } }, + { id: "other", data: { text: "Other" } }, + ], + }, + }, + // { + // type: "checklist", // @todo + // data: { + // title: "Is this unit compliant with any of the following?", + // fn: "compliance", + // options: [ + // { + // id: "m42", + // data: { text: "Part M4(2) of the Building Regulations 2010" }, + // }, + // { + // id: "m432a", + // data: { text: "Part M4(3)(2a) of the Building Regulations 2010" }, + // }, + // { + // id: "m432b", + // data: { text: "Part M4(3)(2b) of the Building Regulations 2010" }, + // }, + // { id: "none", data: { text: "None of these" } }, + // ], + // }, + // }, + { + type: "question", + data: { + title: + "Is this unit compliant with Part M4(2) of the Building Regulations 2010?", + fn: "complianceM42", // compliance.m42 + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "question", + data: { + title: + "Is this unit compliant with Part M4(3)(2a) of the Building Regulations 2010?", + fn: "complianceM432a", // compliance.m432a + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "question", + data: { + title: + "Is this unit compliant with Part M4(3)(2b) of the Building Regulations 2010?", + fn: "complianceM432b", // compliance.m432b + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "question", + data: { + title: "What best describes the type of this unit?", + fn: "type", + options: [ + { id: "terraced", data: { text: "Terraced home" } }, + { id: "semiDetached", data: { text: "Semi detached home" } }, + { id: "detached", data: { text: "Detached home" } }, + { id: "flat", data: { text: "Flat/apartment or maisonette" } }, + { id: "LW", data: { text: "Live/work unit" } }, + { id: "cluster", data: { text: "Cluster flat" } }, + { id: "studio", data: { text: "Studio or bedsit" } }, + { id: "coLiving", data: { text: "Co living unit" } }, + { id: "hostel", data: { text: "Hostel room" } }, + { id: "HMO", data: { text: "HMO" } }, + { id: "student", data: { text: "Student accomodation" } }, + { id: "other", data: { text: "Other" } }, + ], + }, + }, + { + type: "question", + data: { + title: "What best describes the provider of this unit?", + fn: "provider", + options: [ + { id: "private", data: { text: "Private" } }, + { id: "privateRented", data: { text: "Private rented sector" } }, + { id: "HA", data: { text: "Housing association" } }, + { id: "LA", data: { text: "Local authority" } }, + { id: "publicAuthority", data: { text: "Other public authority" } }, + { id: "councilDelivery", data: { text: "Council delivery company" } }, + { + id: "councilBuildToRent", + data: { text: "Council delivered build to rent" }, + }, + { + id: "affordableHousing", + data: { text: "Other affordable housing provider" }, + }, + { id: "selfBuild", data: { text: "Self-build" } }, + ], + }, + }, + { + type: "number", + data: { + title: "What is the Gross Internal Floor Area (GIA) of this unit?", + units: "m²", + fn: "area", + allowNegatives: false, + }, + }, + { + type: "question", + data: { + title: "Will this unit provide sheltered accommodation?", + fn: "sheltered", + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "question", + data: { + title: "Is this unit specifically designed for older people?", + fn: "olderPersons", + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "number", + data: { + title: "How many identical units does the description above apply to?", + fn: "identicalUnits", + allowNegatives: false, + }, + }, + ], + min: 1, +} as const; diff --git a/editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/GLA/Retained.ts b/editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/GLA/Retained.ts new file mode 100644 index 0000000000..28d3edb867 --- /dev/null +++ b/editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/GLA/Retained.ts @@ -0,0 +1,200 @@ +import { Schema } from "@planx/components/List/model"; + +export const ResidentialUnitsGLARetained: Schema = { + type: "Retained residential unit", + fields: [ + { + type: "number", + data: { + title: "What is the number of habitable rooms of this unit?", + fn: "habitable", + allowNegatives: false, + }, + }, + { + type: "number", + data: { + title: "What is the number of bedrooms of this unit?", + fn: "bedrooms", + allowNegatives: false, + }, + }, + { + type: "question", + data: { + title: "Which best describes the tenure of this unit?", + fn: "tenure", + options: [ + { id: "LAR", data: { text: "London Affordable Rent" } }, + { + id: "AR", + data: { text: "Affordable rent (not at LAR benchmark rents)" }, + }, + { id: "SR", data: { text: "Social rent" } }, + { id: "LRR", data: { text: "London Living Rent" } }, + { id: "sharedEquity", data: { text: "Shared equity" } }, + { id: "LSO", data: { text: "London Shared Ownership" } }, + { id: "DMS", data: { text: "Discount market sale" } }, + { id: "DMR", data: { text: "Discount market rent" } }, + { + id: "DMRLLR", + data: { + text: "Discount market rent (charged at London Living Rents)", + }, + }, + { id: "marketForRent", data: { text: "Market for rent" } }, + { id: "SH", data: { text: "Starter homes" } }, + { + id: "selfCustomBuild", + data: { text: "Self-build and custom build" }, + }, + { id: "marketForSale", data: { text: "Market for sale" } }, + { id: "other", data: { text: "Other" } }, + ], + }, + }, + // { + // type: "checklist", // @todo + // data: { + // title: "Is this unit compliant with any of the following?", + // fn: "compliance", + // options: [ + // { + // id: "m42", + // data: { text: "Part M4(2) of the Building Regulations 2010" }, + // }, + // { + // id: "m432a", + // data: { text: "Part M4(3)(2a) of the Building Regulations 2010" }, + // }, + // { + // id: "m432b", + // data: { text: "Part M4(3)(2b) of the Building Regulations 2010" }, + // }, + // { id: "none", data: { text: "None of these" } }, + // ], + // }, + // }, + { + type: "question", + data: { + title: + "Is this unit compliant with Part M4(2) of the Building Regulations 2010?", + fn: "complianceM42", // compliance.m42 + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "question", + data: { + title: + "Is this unit compliant with Part M4(3)(2a) of the Building Regulations 2010?", + fn: "complianceM432a", // compliance.m432a + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "question", + data: { + title: + "Is this unit compliant with Part M4(3)(2b) of the Building Regulations 2010?", + fn: "complianceM432b", // compliance.m432b + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "question", + data: { + title: "What best describes the type of this unit?", + fn: "type", + options: [ + { id: "terraced", data: { text: "Terraced home" } }, + { id: "semiDetached", data: { text: "Semi detached home" } }, + { id: "detached", data: { text: "Detached home" } }, + { id: "flat", data: { text: "Flat/apartment or maisonette" } }, + { id: "LW", data: { text: "Live/work unit" } }, + { id: "cluster", data: { text: "Cluster flat" } }, + { id: "studio", data: { text: "Studio or bedsit" } }, + { id: "coLiving", data: { text: "Co living unit" } }, + { id: "hostel", data: { text: "Hostel room" } }, + { id: "HMO", data: { text: "HMO" } }, + { id: "student", data: { text: "Student accomodation" } }, + { id: "other", data: { text: "Other" } }, + ], + }, + }, + { + type: "question", + data: { + title: "What best describes the provider of this unit?", + fn: "provider", + options: [ + { id: "private", data: { text: "Private" } }, + { id: "privateRented", data: { text: "Private rented sector" } }, + { id: "HA", data: { text: "Housing association" } }, + { id: "LA", data: { text: "Local authority" } }, + { id: "publicAuthority", data: { text: "Other public authority" } }, + { id: "councilDelivery", data: { text: "Council delivery company" } }, + { + id: "councilBuildToRent", + data: { text: "Council delivered build to rent" }, + }, + { + id: "affordableHousing", + data: { text: "Other affordable housing provider" }, + }, + { id: "selfBuild", data: { text: "Self-build" } }, + ], + }, + }, + { + type: "number", + data: { + title: "What is the Gross Internal Floor Area (GIA) of this unit?", + units: "m²", + fn: "area", + allowNegatives: false, + }, + }, + { + type: "question", + data: { + title: "Will this unit provide sheltered accommodation?", + fn: "sheltered", + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "question", + data: { + title: "Is this unit specifically designed for older people?", + fn: "olderPersons", + options: [ + { id: "true", data: { text: "Yes" } }, + { id: "false", data: { text: "No" } }, + ], + }, + }, + { + type: "number", + data: { + title: "How many identical units does the description above apply to?", + fn: "identicalUnits", + allowNegatives: false, + }, + }, + ], + min: 1, +} as const; diff --git a/editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/Proposed.ts b/editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/Proposed.ts new file mode 100644 index 0000000000..9e713d03d4 --- /dev/null +++ b/editor.planx.uk/src/@planx/components/List/schemas/ResidentialUnits/Proposed.ts @@ -0,0 +1,72 @@ +import { Schema } from "../../model"; + +export const ResidentialUnitsProposed: Schema = { + type: "Proposed residential unit", + fields: [ + { + type: "question", + data: { + title: "What best describes the tenure of this unit?", + fn: "tenure", + options: [ + { id: "MH", data: { text: "Market housing", val: "MH" } }, + { + id: "SAIR", + data: { text: "Social, affordable or interim rent", val: "SAIR" }, + }, + { + id: "AHO", + data: { text: "Affordable home ownership", val: "AHO" }, + }, + { id: "SH", data: { text: "Starter homes", val: "SH" } }, + { + id: "selfCustomBuild", + data: { + text: "Self-build and custom build", + val: "selfCustomBuild", + }, + }, + { id: "other", data: { text: "Other", val: "other" } }, + ], + }, + }, + { + type: "question", + data: { + title: "What best describes the type of this unit?", + fn: "type", + options: [ + { id: "house", data: { text: "House", val: "house" } }, + { + id: "flat", + data: { text: "Flat, apartment or maisonette", val: "flat" }, + }, + { + id: "sheltered", + data: { text: "Sheltered housing", val: "sheltered" }, + }, + { id: "studio", data: { text: "Studio or bedsit", val: "studio" } }, + { id: "cluster", data: { text: "Cluster flat", val: "cluster" } }, + { id: "other", data: { text: "Other", val: "other" } }, + ], + }, + }, + { + type: "number", + data: { + title: "How many bedrooms will this unit have?", + fn: "bedrooms", + allowNegatives: false, + }, + }, + { + type: "number", + data: { + title: "How many identical units will the description above apply to?", + fn: "identicalUnits", + allowNegatives: false, + }, + }, + ], + min: 1, +} as const; diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Node.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Node.tsx index d5deb6cdff..e7600a7cc1 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Node.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Node.tsx @@ -65,7 +65,7 @@ const Node: React.FC = (props) => { case TYPES.FindProperty: return ; case TYPES.List: - return ; + return ; case TYPES.NextSteps: return ; case TYPES.Notice: