import { JSONPath as jsonpath } from "jsonpath-plus"; import useTranslation from "next-translate/useTranslation"; import { useRouter } from "next/router"; import { useDropzone } from "react-dropzone"; import { connect } from "react-redux"; import { Field, formValueSelector, reduxForm } from "redux-form"; import { getFormCollectionByID } from "../../../../components/utils"; import { FileUploadField, RenderDatePicker, RenderLPACondtionalRadioList, RenderMultiline, RenderPickList, RenderRadioList, RenderRichMultiline, RenderTextfield, } from "../representationElements"; import { setRepresentationCapacity, setRepresentationSubmit, setFilesForRepresentations, } from "../../../../store/currentView/action"; let Enforcement_Questionnaire = (props) => { let { t } = useTranslation(); const router = useRouter(); const { locale } = router; const { formObj, appellantApplicantRepresentationArr, setRepresentationCapacity, setRepresentationSubmit, currentView, procedureTypeValue, onBehalfOfLPA, showQuestionnaireSection, setFilesForRepresentations, } = props; const { acceptedFiles, getRootProps, getInputProps } = useDropzone(); const files = acceptedFiles.map((file) => (
  • {file.path} - {file.size} bytes
  • )); const required = (value) => (value ? undefined : "Required"); let setCaseDetailsObj = router.query.hasOwnProperty("state") ? router.query.state == "edit" ? props.props.myRepresentations.myRepresentations : currentView.caseReference.currentType == "watchedCases" ? props.props.watchedCases.watchedCasesDetails : props.props.searchResultsObj.searchDetailsObj : currentView.caseReference.currentType == "watchedCases" ? props.props.watchedCases.watchedCasesDetails : props.props.searchResultsObj.searchDetailsObj; var detailsObj = {}; detailsObj = jsonpath({ path: '$..[?(@ && @.pinswg_name=="' + currentView.caseReference.currentReference + '")]', json: setCaseDetailsObj, eval: true, }); let setCaseResultssObj = router.query.hasOwnProperty("state") ? router.query.state == "edit" ? props.props.myRepresentations.myRepresentations : currentView.caseReference.currentType == "watchedCases" ? props.props.watchedCases.watchedCases : props.props.searchResultsObj.searchResultsObj : currentView.caseReference.currentType == "watchedCases" ? props.props.watchedCases.watchedCases : props.props.searchResultsObj.searchResultsObj; detailsObj = detailsObj[0]; var resultsObj = {}; resultsObj = jsonpath({ path: '$..[?(@ && @.ticketnumber=="' + currentView.caseReference.currentReference + '")]', json: setCaseResultssObj, eval: true, }); resultsObj = resultsObj[0]; return ( <> {showQuestionnaireSection == 1 && (

    Enforcement Questionnaire

    {t("myrepresentations:questionnaire-hint-para")}

    {t("myrepresentations:enf-section-heading-one")}{" "}

    1. {t("myrepresentations:enf-section-question-1")}:{" "} {currentView.caseReference.currentReference}
    2. {t("myrepresentations:enf-section-question-2")}:{" "} {resultsObj.pinswg_lpareference}
    3. {t("myrepresentations:enf-section-question-3")}:{" "} {detailsObj.pinswg_siteaddressline1 + (detailsObj.pinswg_siteaddressline2 != null ? " " + detailsObj.pinswg_siteaddressline2 + " " : " ") + detailsObj.pinswg_siteaddresstown + " " + detailsObj.pinswg_siteaddresspostcode}
    4. {t("myrepresentations:s78-section-question-4")}:{" "} { getFormCollectionByID( currentView.caseReference.appealType ).value }
    {(procedureTypeValue == "Hearing" || procedureTypeValue == "Inquiry") && ( )}
    )}{" "} {showQuestionnaireSection == 2 && (

    {t("myrepresentations:enf-section-heading-two")}

    )}{" "} {showQuestionnaireSection == 3 && (

    {t("myrepresentations:enf-section-heading-three")}

    )}{" "} {showQuestionnaireSection == 4 && (

    {" "} {t("myrepresentations:enf-section-heading-four")}{" "}

    )}{" "} {showQuestionnaireSection == 5 && (

    {t("myrepresentations:enf-section-heading-five")}

    )}{" "} {showQuestionnaireSection == 6 && (

    {t("myrepresentations:enf-section-heading-six")}

    32. {t("myrepresentations:enf-section-question-31")}
    )}{" "} {showQuestionnaireSection == 7 && (

    {t("myrepresentations:s78-section-heading-five-sub")}

    {t("myrepresentations:s78-section-heading-five")}

    )}{" "} {showQuestionnaireSection == 8 && (
    {" "}
    0 // ? props.currentView.caseReference // .repDetails.filesList // : [] // : [] } setFilesForRepresentations={ setFilesForRepresentations } containerID={ props.props.props.props.accountDetails .containerID } filenamePrefix={props.props.formObj} props={props.props.props} setCurrentReference={props.setCurrentReference} />
    )} {showQuestionnaireSection == 9 && (

    {t("myrepresentations:enf-section-heading-eight")}

    {onBehalfOfLPA}
    )} ); }; //export default Enforcement_Questionnaire; const selector = formValueSelector("representationForm"); // <-- same as form name Enforcement_Questionnaire = connect((state) => { const representationTypeValue = selector(state, "representationType"); const procedureTypeValue = selector(state, "procedureType"); return { procedureTypeValue, representationTypeValue, }; })(Enforcement_Questionnaire); const mapDispatchToProps = (dispatch) => { return { updateField: (form, field, newValue) => dispatch(change(form, field, newValue)), setFilesForRepresentations: (fileList) => { dispatch(setFilesForRepresentations(fileList)); }, }; }; const mapStateToProps = (state, props) => { return { search: state.search, searchResultsObj: state.searchResultsObj, formData: state.formData, appealType: state.appealType, currentView: state.currentView, myRepresentations: state.myRepresentations, initialValues: state.currentView.caseReference.repDetails, }; }; export default connect( mapStateToProps, mapDispatchToProps )( reduxForm({ form: "representationForm", enableReinitialize: false, destroyOnUnmount: false, })(Enforcement_Questionnaire) );