import Link from "next/link";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import { connect } from "react-redux";
import { Field, reduxForm, formValueSelector } from "redux-form";
import {
RenderPickList,
RenderTextfield,
RenderRadioList,
RenderMultiline,
RenderCondtionalRadioList,
RenderLPACondtionalRadioList,
FileUploadField,
RenderRichMultiline,
RenderDatePicker,
} from "./representationElements";
import {
setRepresentationCapacity,
setRepresentationSubmit,
} from "../../../store/currentView/action";
import { useDropzone } from "react-dropzone";
import { select } from "xpath";
let RepLPA = (props) => {
let { t } = useTranslation();
const router = useRouter();
const { locale } = router;
const {
formObj,
appellantApplicantRepresentationArr,
setRepresentationCapacity,
setRepresentationSubmit,
currentView,
procedureTypeValue,
onBehalfOfLPA,
} = props;
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
const files = acceptedFiles.map((file) => (
{file.path} - {file.size} bytes
));
const required = (value) => (value ? undefined : "Required");
return (
Questionnaire from an LPA
{/*
*/}
{props.representationTypeValue}
{props.procedureTypeValue}
{console.log(props)}
typeof props.representationTypeValue == "undefined"
{props.representationTypeValue != "Questionnaire" ? (
<>
You can enter your comments in the space
provided or attach a separate document.
>
) : (
<>
>
)}
{" "}
);
};
const selector = formValueSelector("representationForm"); // <-- same as form name
RepLPA = connect((state) => {
const representationTypeValue = selector(state, "representationType");
const procedureTypeValue = selector(state, "procedureType");
return {
procedureTypeValue,
representationTypeValue,
};
})(RepLPA);
const mapStateToProps = (state, props) => {
console.log();
return {
initialValues: {
onBehalfOfLPA:
props.props.props.accountDetails.accountDetails[
"pinswg_contact_associatedlpa@OData.Community.Display.V1.FormattedValue"
],
},
};
};
export default connect(mapStateToProps)(
reduxForm({
form: "representationForm",
enableReinitialize: true,
destroyOnUnmount: false,
})(RepLPA)
);