From 57a9af6407ecdf62bab8a90a83db849ad0fc7d75 Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Tue, 26 Jul 2022 08:29:33 +0200 Subject: [PATCH 01/21] fix: adjust CSV rows to include sessionId & payment/send references (#1031) --- .../@planx/components/Send/uniform/index.ts | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/Send/uniform/index.ts b/editor.planx.uk/src/@planx/components/Send/uniform/index.ts index c11b3ba256..76bde08949 100644 --- a/editor.planx.uk/src/@planx/components/Send/uniform/index.ts +++ b/editor.planx.uk/src/@planx/components/Send/uniform/index.ts @@ -89,8 +89,32 @@ export function makeCsvData( }); }); - // concat into single list, each object will be row in CSV - return formattedSummary + // gather key reference fields, these will be first rows of CSV + const references: { question: string; responses: any }[] = [ + { + question: "Planning Application Reference", // match language used on Confirmation page + responses: sessionId, + }, + ]; + + // check if the passport has payment or submission ids, add them as reference rows if exist + const conditionalKeys = [ + "application.fee.reference.govPay", + "bopsId", + "idoxSubmissionId", + ]; + conditionalKeys.forEach((key) => { + if (passport.data?.[key]) { + references.push({ + question: key, + responses: passport.data?.[key], + }); + } + }); + + // concat data sections into single list, each object will be row in CSV + return references + .concat(formattedSummary) .concat(bopsData["proposal_details"] || []) .concat(formattedFiles); } From e721cd36f1e995b3801129c615d7ebe39da74032 Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Tue, 26 Jul 2022 08:34:52 +0200 Subject: [PATCH 02/21] fix: Review page shows all DrawBoundary data (map and/or plan) and file gets correct BOPS tag (#1030) --- .../Send/bops/__tests__/files.test.ts | 6 ++-- .../src/@planx/components/Send/bops/index.ts | 4 ++- .../components/shared/Preview/SummaryList.tsx | 33 +++++++++---------- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/Send/bops/__tests__/files.test.ts b/editor.planx.uk/src/@planx/components/Send/bops/__tests__/files.test.ts index 2293bfc352..1a5b634bae 100644 --- a/editor.planx.uk/src/@planx/components/Send/bops/__tests__/files.test.ts +++ b/editor.planx.uk/src/@planx/components/Send/bops/__tests__/files.test.ts @@ -75,15 +75,15 @@ describe("It extracts tags for", () => { PASSPORT_UPLOAD_KEY === "proposal.drawing.locationPlan" ? PASSPORT_UPLOAD_KEY : "key changed unexpectedly!", - tags: ["Proposed", /*"Drawing", "Location",*/ "Plan"], + tags: ["Proposed", /*"Drawing",*/ "Site", "Plan"], }, "Existing site plan": { key: "property.drawing.sitePlan", - tags: ["Existing", /*"Drawing",*/ "Site", "Plan"], + tags: ["Existing", /*"Drawing", "Site",*/ "Plan"], // "Site" is reserved for red-line drawings ONLY! }, "Proposed site plan": { key: "proposal.drawing.sitePlan", - tags: ["Proposed", /*"Drawing",*/ "Site", "Plan"], + tags: ["Proposed", /*"Drawing", "Site",*/ "Plan"], }, "Existing floor plan": { key: "property.drawing.floorPlan", diff --git a/editor.planx.uk/src/@planx/components/Send/bops/index.ts b/editor.planx.uk/src/@planx/components/Send/bops/index.ts index 5606643f94..d2cab1809f 100644 --- a/editor.planx.uk/src/@planx/components/Send/bops/index.ts +++ b/editor.planx.uk/src/@planx/components/Send/bops/index.ts @@ -460,7 +460,8 @@ export const extractTagsFromPassportKey = (passportKey: string) => { tags.push("Existing"); } - if (splitKey.includes("sitePlan")) { + if (splitKey.includes("locationPlan")) { + // "locationPlan" is DrawBoundary's passport key tags.push("Site"); tags.push("Plan"); } else if (splitKey.includes("roofPlan")) { @@ -492,6 +493,7 @@ export const extractTagsFromPassportKey = (passportKey: string) => { } else if (passportKey.includes("construction.invoice")) { tags.push("Construction Invoice"); } else if (splitKey.some((x) => x.endsWith("Plan"))) { + // eg "sitePlan" tags.push("Plan"); } diff --git a/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx b/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx index 0b8cbb486a..b96ecfe40f 100644 --- a/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx +++ b/editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx @@ -242,33 +242,28 @@ function DateInput(props: ComponentProps) { } function DrawBoundary(props: ComponentProps) { - const { latitude, longitude } = props.passport.data?._address; + // check if the user drew a boundary, uploaded a file, or both (or neither if props.node.data?.hideFileUpload is triggered "on") + const geodata = props.userData?.data?.[props.node.data?.dataFieldBoundary]; + const locationPlan = props.userData?.data?.[PASSPORT_UPLOAD_KEY]; - // check if the user drew a boundary, - // if they didn't then check that there's an uploaded boundary file - const data = props.userData?.data?.[props.node.data?.dataFieldBoundary] - ? props.userData.data![props.node.data.dataFieldBoundary] - : props.userData?.data?.[PASSPORT_UPLOAD_KEY] - ? props.userData.data![PASSPORT_UPLOAD_KEY] - : undefined; - - if (!data && !props.node.data?.hideFileUpload) { + if (!geodata && !locationPlan && !props.node.data?.hideFileUpload) { // XXX: we always expect to have data, this is for temporary debugging console.error(props); - throw Error("boundary geojson or file expected but not found"); + throw Error( + "Site boundary geojson or location plan file expected, but not found" + ); } return ( <>
Site boundary
- {!data && props.node.data?.hideFileUpload ? ( - "Skipped" - ) : typeof data === "string" ? ( - + {locationPlan && ( + Your uploaded location plan - ) : ( + )} + {geodata && ( <>

A static map displaying the site boundary that you drew. @@ -276,7 +271,7 @@ function DrawBoundary(props: ComponentProps) { {/* @ts-ignore */} )} + {!locationPlan && + !geodata && + props.node.data?.hideFileUpload && + "Not provided"}

); From 9ad5536759fdb25f326e665eeac4fc9714c4f91f Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Tue, 26 Jul 2022 09:12:28 +0200 Subject: [PATCH 03/21] chore: remove Uniform feature flag (#1027) --- .../src/@planx/components/Send/Editor.tsx | 25 ++++++++----------- editor.planx.uk/src/lib/featureFlags.ts | 2 +- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/Send/Editor.tsx b/editor.planx.uk/src/@planx/components/Send/Editor.tsx index 73f7a08a7c..32ba0268fd 100644 --- a/editor.planx.uk/src/@planx/components/Send/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/Send/Editor.tsx @@ -1,5 +1,4 @@ import { useFormik } from "formik"; -import { hasFeatureFlag } from "lib/featureFlags"; import React from "react"; import Input from "ui/Input"; import InputRow from "ui/InputRow"; @@ -24,20 +23,16 @@ const SendComponent: React.FC = (props) => { }, }); - // only show radio buttons if we have support > 1 destination - let options: { value: string; label: string }[] = []; - if (hasFeatureFlag("SEND_TO_UNIFORM")) { - options = [ - { - value: "bops", - label: "BOPS", - }, - { - value: "uniform", - label: "Uniform", - }, - ]; - } + let options: { value: string; label: string }[] = [ + { + value: "bops", + label: "BOPS", + }, + { + value: "uniform", + label: "Uniform", + }, + ]; return (