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 (
<>
>
);
};
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 || ""}
Representation
You can enter your comments in the space
provided or attach a separate document.
{" "}
);
};
const mapStateToProps = (state) => {
return {
search: state.search,
searchResultsObj: state.searchResultsObj,
formData: state.formData,
appealType: state.appealType,
//form: state.form,
};
};
const mapDispatchToProps = (dispatch) => {
return {};
};
const selector = formValueSelector("representationForm");
export default connect(
mapStateToProps,
mapDispatchToProps
)(
reduxForm({
form: "representationForm",
destroyOnUnmount: false,
})(MakeRepresentation)
);