import useTranslation from "next-translate/useTranslation"; import { useRouter } from "next/router"; import { connect } from "react-redux"; import { Field, change, reduxForm } from "redux-form"; import { useEffect, useState } from "react"; import { bytesToSize, getThumbnailIconByExtension } from "../../utils"; import { FileUploadField, RenderCondtionalRadioList, RenderRichMultiline, shouldDisableButton } from "./representationElements"; import RepresentationTypeSelectorBlock from "./elements/RepresentationTypeSelectorBlock"; import { useDropzone } from "react-dropzone"; import { setRepresentationCapacity, setRepresentationSubmit, setFilesForRepresentations } from "../../../store/currentView/action"; const ConsultationAgent = (props) => { let { t } = useTranslation(); const router = useRouter(); const { locale } = router; const { formObj, appellantApplicantRepresentationArr, setRepresentationCapacity, setRepresentationSubmit, currentView, setRepFileName, updateRepresentation, setSavingStatus, savingStatus, setFilesForRepresentations, onRepresentationTypeChange, onTypeSelectionConfirmed } = props; const { acceptedFiles, getRootProps, getInputProps } = useDropzone(); const persistedRepresentationType = currentView?.caseReference?.repDetails?.representationType; const [typeSelectionConfirmed, setTypeSelectionConfirmed] = useState( !!persistedRepresentationType ); useEffect(() => { if (persistedRepresentationType) { setTypeSelectionConfirmed(true); } }, [persistedRepresentationType]); if (JSON.stringify(formObj) != "{}") { setRepFileName(formObj.representationForm.values); let filterFilesList = props.currentView.caseReference.hasOwnProperty( "repDetails" ) ? props.currentView.caseReference.repDetails.hasOwnProperty( "filesList" ) ? props.currentView.caseReference.repDetails.filesList.filter( function (el) { return el != null; } ) : [] : []; const files = acceptedFiles.map((file) => (
{selectedRepresentationType == "Consultation Response" ? t( "myrepresentations:enter-comment-label" ) : t( "myrepresentations:consultation-comment-label" )}
) : (
)}