From f13493ac4614f606075fe3a2e62bb0b95356d3fd Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Wed, 4 Aug 2021 09:29:28 +0100 Subject: [PATCH] added representation, case flows --- components/breadcrumbs.js | 26 +- components/case.js | 17 +- components/case/representation/index.js | 473 ++++++++++++++++++++++ components/case/summary.js | 121 ++++-- components/footer.js | 239 +++++++---- components/header.js | 13 +- components/loading.js | 2 +- components/myportal/awaitingsubmission.js | 1 + components/myportal/mycases.js | 5 +- components/myportal/myrepresentations.js | 1 + components/myportal/topthree.js | 72 +++- components/myportal/viewall.js | 39 +- components/myportal/watchedcases.js | 5 +- components/newappeal/createCase.js | 55 ++- components/representation.js | 38 ++ components/search/searchresults.js | 35 +- components/searchresults.js | 18 +- i18n.json | 3 + locales/en/common.json | 2 +- package.json | 3 +- pages/404.js | 45 +- pages/advancedsearch.js | 34 -- pages/api/lookups/awaitingSubmission.js | 111 +++++ pages/api/lookups/myCases.js | 104 ++++- pages/api/lookups/myRepresentations.js | 116 ++++++ pages/api/lookups/watchedCases.js | 116 ++++++ pages/case.js | 71 ++-- pages/index.js | 23 -- pages/myportal/index.js | 6 + pages/newappeal/[appealtypes].js | 8 +- pages/newappeal/index.js | 12 +- pages/representation.js | 83 ++++ pages/searchresults.js | 37 +- pages/viewall.js | 22 - store/currentView/action.js | 8 + store/currentView/reducer.js | 6 + styles/sass/welshgov/_application.scss | 301 +++++++++++++- 37 files changed, 1928 insertions(+), 343 deletions(-) create mode 100644 components/case/representation/index.js create mode 100644 components/representation.js create mode 100644 pages/representation.js diff --git a/components/breadcrumbs.js b/components/breadcrumbs.js index 7252cf66..77b5e190 100644 --- a/components/breadcrumbs.js +++ b/components/breadcrumbs.js @@ -167,7 +167,31 @@ const Breadcrumbs = (props) => {
  • - Case Reference: CAS-00010-J9W6L5 + Case Reference:{" "} + { + props.props.currentView.caseReference + .currentReference + } +
  • + + ) : ( + "" + )} + {router.pathname == "/representation" ? ( + <> +
  • + + + My Portal + + +
  • +
  • + Make representation for:{" "} + { + props.props.currentView.caseReference + .currentReference + }
  • ) : ( diff --git a/components/case.js b/components/case.js index b55d1f58..4984fd98 100644 --- a/components/case.js +++ b/components/case.js @@ -5,7 +5,7 @@ import useTranslation from "next-translate/useTranslation"; import Summary from "./case/summary"; import Documents from "./case/documents"; -export default function CaseSummary({ children, pages }) { +const CaseSummary = (props) => { let { t } = useTranslation(); const router = useRouter(); @@ -19,10 +19,21 @@ export default function CaseSummary({ children, pages }) { >
    - +
    ); -} +}; + +export default CaseSummary; diff --git a/components/case/representation/index.js b/components/case/representation/index.js new file mode 100644 index 00000000..63e3b895 --- /dev/null +++ b/components/case/representation/index.js @@ -0,0 +1,473 @@ +import Link from "next/link"; +import { useRouter } from "next/router"; +import useTranslation from "next-translate/useTranslation"; +import jsonpath from "jsonpath"; +import _ from "lodash"; +import { Field, FieldArray, reduxForm, formValueSelector } from "redux-form"; +import { connect } from "react-redux"; +import { useDropzone } from "react-dropzone"; + +const MakeRepresentation = (props) => { + let { t } = useTranslation(); + const { acceptedFiles, getRootProps, getInputProps } = useDropzone(); + + const files = acceptedFiles.map((file) => ( +
  • + {file.path} - {file.size} bytes +
  • + )); + + const router = useRouter(); + const { locale } = router; + const { + caseReference, + myCases, + myRepresentations, + watchedCases, + awaitingSubmission, + searchResultsObj, + currentType, + } = props; + const formObj = props.props.form; + let setCaseQueryObj = props[currentType]; + var casesObj = {}; + + currentType == "searchResultsObj" + ? (casesObj = jsonpath.query( + setCaseQueryObj, + '$..[?(@.title=="' + caseReference + '")]' + )) + : (casesObj = jsonpath.query( + setCaseQueryObj, + '$..[?(@.reference=="' + caseReference + '")]' + )); + + casesObj = Object.assign({}, ...casesObj); + + const RenderRepresentationCapacity = ({ + datafieldname, + name, + label, + id, + errorMsg, + options, + input: { onChange, value }, + meta: { touched, error }, + ...custom + }) => { + return ( + <> +
    +
    + + + + {touched && error && ( + + + Error: + {" "} + {errorMsg} + + )} +
    + {Object.keys(options).map((key, index) => ( +
    + + +
    + ))} +
    +
    +
    + + ); + }; + + const { name, label } = props; + const capacityOptionsArr = [ + "Appellant", + "Agent", + "Interested Party / Person", + "Land Owner", + ]; + const required = (value) => (value ? undefined : "Required"); + + const RenderPickList = ({ + datafieldname, + name, + label, + input, + meta: { touched, errorStr }, + }) => { + const dropdownObj = ["Final Comments", "Other", "Proof of Evidence"]; + + return ( +
    + + + {touched && errorStr && {errorStr}} +
    + ); + }; + + const RenderTextfield = ({ + id, + rows, + datafieldname, + name, + label, + input, + errorMsg, + type, + className, + meta: { touched, error }, + ...custom + }) => { + return ( + <> + + {touched && error && ( + + Error:{" "} + {errorMsg} + + )} + + + ); + }; + + return ( +
    +
    +
    +

    + Make a representation +

    + +
    +
    +
    + Appeal Reference +
    +
    + {currentType == "searchResultsObj" + ? casesObj.title + : casesObj.reference} +
    +
    +
    +
    + {t("case:summary-applicant-label")} +
    +
    + {casesObj.appellantApplicant || ""} +
    +
    +
    +
    + {t("case:summary-agent-label")} +
    +
    + Mr A Agent +
    +
    +
    +
    + {t("case:summary-site-address-label")} +
    +
    + {casesObj.address1 || ""} +
    + {casesObj.town || ""} + +
    + {casesObj.postcode || ""} +
    +
    +
    +
    +
    +
    +
    +
    +

    Your details

    + +
    +
    +
    +
    +
    + + Continue + +
    +
    +
    +
    +
    +
    +
    +

    Representation

    + +
    + + +
    +
    +
    +
    +
    +
    +

    + You can enter your comments in the space + provided or attach a separate document. +

    +
    +
    + My comments are set out in:* +
    +
    +
    + + +
    +
    +
    +