Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new residential units, remove deprecated, update existing #3833

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions e2e/tests/ui-driven/src/helpers/userActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,13 @@ export async function answerListInput(
page.locator("h2", { hasText: "Existing residential unit type 1" }),
).toBeVisible(); // assume the default list for now
await page
.getByRole("combobox", { name: "What best describes the type" })
.getByRole("combobox", { name: "What best describes this unit?" })
.click();
await page.getByRole("option", { name: unitType }).click();

await page
.getByRole("combobox", {
name: "What best describes the tenure of this unit? ",
name: "What best describes the tenure of this unit?",
})
.click();
await page.getByRole("option", { name: tenure }).click();
Expand All @@ -349,7 +349,7 @@ export async function answerListInput(
.getByLabel("How many bedrooms does this unit have?")
.fill(numBedrooms.toString());
await page
.getByLabel("How many units of the type described above exist on the site?")
.getByLabel("Number of units of this type")
.fill(numUnits.toString());

const saveButton = page.getByTestId("save-item-button");
Expand Down
24 changes: 7 additions & 17 deletions editor.planx.uk/src/@planx/components/List/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ import { ProtectedSpaceGLA } from "./schemas/GLA/ProtectedSpace";
import { MaterialDetails } from "./schemas/Materials";
import { Parking } from "./schemas/Parking";
import { ResidentialUnitsExisting } from "./schemas/ResidentialUnits/Existing";
import { ResidentialUnitsExistingLDCE } from "./schemas/ResidentialUnits/ExistingLDCE";
import { ResidentialUnitsGLAGained } from "./schemas/ResidentialUnits/GLA/Gained";
import { ResidentialUnitsGLALost } from "./schemas/ResidentialUnits/GLA/Lost";
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 { ResidentialUnitsPreviousLDCE } from "./schemas/ResidentialUnits/PreviousLDCE";
import { ResidentialUnitsProposed } from "./schemas/ResidentialUnits/Proposed";
import { Trees } from "./schemas/Trees";
import { TreesMapFirst } from "./schemas/TreesMapFirst";
Expand All @@ -40,22 +38,14 @@ type Props = EditorProps<TYPES.List, List>;

export const SCHEMAS = [
{ 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: "Residential units (GLA) - Removed",
schema: ResidentialUnitsGLARemoved,
name: "Residential units (LDCE) - Existing",
schema: ResidentialUnitsExistingLDCE,
},
{ name: "Residential units - Proposed", schema: ResidentialUnitsProposed },
{
name: "Residential units (GLA) - Retained",
schema: ResidentialUnitsGLARetained,
name: "Residential units (LDCE) - Previous",
schema: ResidentialUnitsPreviousLDCE,
},
{
name: "Residential units (GLA) - Lost",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@ import { Schema } from "@planx/components/shared/Schema/model";
export const ResidentialUnitsExisting: Schema = {
type: "Existing residential unit type",
fields: [
{
type: "number",
data: {
title: "Number of units of this type",
description:
"This is the number of units of this type that currently exist on the site.",
fn: "identicalUnits",
allowNegatives: false,
},
},
{
type: "question",
data: {
title: "What best describes the type of this unit?",
title: "What best describes this unit?",
fn: "type",
options: [
{ id: "house", data: { text: "House", val: "house" } },
Expand Down Expand Up @@ -59,14 +69,6 @@ export const ResidentialUnitsExisting: Schema = {
allowNegatives: false,
},
},
{
type: "number",
data: {
title: "How many units of the type described above exist on the site?",
fn: "identicalUnits",
allowNegatives: false,
},
},
],
min: 1,
} as const;
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { Schema } from "@planx/components/shared/Schema/model";

export const ResidentialUnitsExistingLDCE: Schema = {
type: "Existing residential unit type",
fields: [
{
type: "number",
data: {
title: "Number of units of this type",
description:
"This is the number of units of this type that currently exist on the site.",
fn: "identicalUnits",
allowNegatives: false,
},
},
{
type: "question",
data: {
title: "What best describes this unit?",
fn: "type",
options: [
{ id: "house", data: { text: "House", val: "house" } },
{
id: "flat",
data: { text: "Flat or maisonette", val: "flat" },
},
{
id: "liveWorkUnit",
data: { text: "Live/work unit", val: "LW" },
},
{
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: "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: "number",
data: {
title: "How many bedrooms does this unit have?",
fn: "bedrooms",
allowNegatives: false,
},
},
],
min: 1,
} as const;
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@ import { Schema } from "@planx/components/shared/Schema/model";
export const ResidentialUnitsGLAGained: Schema = {
type: "Gained residential unit type",
fields: [
{
type: "number",
data: {
title: "Number of units of this type",
description:
"This is the number of units of this type that are gained.",
fn: "identicalUnits",
allowNegatives: false,
},
},
{
type: "question",
data: {
title: "What best describes the type of this unit?",
title: "What best describes this unit?",
fn: "type",
options: [
{ id: "terraced", data: { text: "Terraced home", val: "terraced" } },
Expand Down Expand Up @@ -61,7 +71,7 @@ export const ResidentialUnitsGLAGained: Schema = {
{
type: "question",
data: {
title: "Which best describes the tenure of this unit?",
title: "What best describes the tenure of this unit?",
fn: "tenure",
options: [
{ id: "LAR", data: { text: "London Affordable Rent", val: "LAR" } },
Expand Down Expand Up @@ -202,14 +212,6 @@ export const ResidentialUnitsGLAGained: Schema = {
],
},
},
{
type: "number",
data: {
title: "How many units of the type described above are gained?",
fn: "identicalUnits",
allowNegatives: false,
},
},
],
min: 1,
} as const;
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@ import { Schema } from "@planx/components/shared/Schema/model";
export const ResidentialUnitsGLALost: Schema = {
type: "Lost residential unit type",
fields: [
{
type: "number",
data: {
title: "Number of units of this type",
description: "This is the number of units of this type that are lost.",
fn: "identicalUnits",
allowNegatives: false,
},
},
{
type: "question",
data: {
title: "What best describes the type of this unit?",
title: "What best describes this unit?",
fn: "type",
options: [
{ id: "terraced", data: { text: "Terraced home", val: "terraced" } },
Expand Down Expand Up @@ -61,7 +70,7 @@ export const ResidentialUnitsGLALost: Schema = {
{
type: "question",
data: {
title: "Which best describes the tenure of this unit?",
title: "What best describes the tenure of this unit?",
fn: "tenure",
options: [
{ id: "LAR", data: { text: "London Affordable Rent", val: "LAR" } },
Expand Down Expand Up @@ -202,14 +211,6 @@ export const ResidentialUnitsGLALost: Schema = {
],
},
},
{
type: "number",
data: {
title: "How many units of the type described above are lost?",
fn: "identicalUnits",
allowNegatives: false,
},
},
],
min: 1,
} as const;
Loading
Loading