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:* +
    +
    +
    + + +
    +
    +
    +