import _ from "lodash";
import useTranslation from "next-translate/useTranslation";
import { useRouter } from "next/router";
import { useDropzone } from "react-dropzone";
import RepComplete from "./representationComplete";
import RepLPAQuestionnaireCheck_s78 from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_s78";
import RepLPAQuestionnaireCheck_enforcement from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_enforcement";
import {
getFormCollectionByID,
getThumbnailIconByExtension,
bytesToSize,
} from "../../utils";
const RepCompleteSubmit = (props) => {
let { t } = useTranslation();
const router = useRouter();
const { locale } = router;
const {
formObj,
appellantApplicantRepresentationArr,
setRepresentationCapacity,
setRepresentationSubmit,
currentView,
setSubmitBack,
setRepresentationSubmitConfirmation,
setRepresentationMessageSent,
setRepresentationReset,
} = props;
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
const files = acceptedFiles.map((file) => (
{file.path} - {file.size} bytes
));
const repFormData = formObj.representationForm.values;
const repDate = new Date();
let day = repDate.getDate();
let month = repDate.getMonth() + 1;
let year = repDate.getFullYear();
let time = repDate.getTime();
let repType = "";
switch (repFormData.representationCapacity) {
case t("myrepresentations:capacity-options-arr-appellant"):
repType = "APPELLANT";
break;
case t("myrepresentations:capacity-options-arr-agent"):
repType = "AGENT";
break;
case t("myrepresentations:capacity-options-arr-interested"):
repType = "IP";
break;
case "Land Owner":
repType = "LO";
break;
case "lpa":
repType = "LPA";
break;
default:
// code block
}
Object.assign(repFormData, {
"repfile_name": repFormData.hasOwnProperty("repfile_name")
? repFormData.repfile_name
: year +
"-" +
month +
"-" +
day +
"-" +
time +
"-" +
repType +
"-REP" +
"_" +
props.props.props.accountDetails.accountDetails.lastname,
"pinswg_name": props.props.currentView.caseReference.currentReference,
"containerID": props.props.props.accountDetails.containerID,
"appealType": props.props.currentView.caseReference.appealType,
"incidentID": props.props.currentView.caseReference.incidentid,
"caseRef": props.props.currentView.caseReference.currentReference,
});
console.log("///////// repFormData:", repFormData);
const whichQuestionnaireCheck = () => {
{
switch (currentView.caseReference.appealType) {
case 846040000:
return (
);
break;
case 846040005:
return (
);
break;
default:
return <>hello>;
break;
}
}
};
return (
<>
{currentView.representationSubmitConfirmation == true ? (
) : (
{" "}
{t(
"myrepresentations:rep-check-submit-heading"
)}
{t(
"myrepresentations:rep-check-your-rep-heading"
)}
{_.has(
repFormData,
"representationOnBehalfOf"
) && (
<>
{repFormData.representationOnBehalfOf ==
"Yes" && (
)}
>
)}
{whichQuestionnaireCheck()}
{t(
"myrepresentations:rep-check-tandc-para-one"
)}
{t(
"myrepresentations:rep-check-tandc-para-two"
)}
{t(
"myrepresentations:rep-check-tandc-para-three"
)}
{/* */}
)}
>
);
};
export default RepCompleteSubmit;