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 { useState, useEffect } from "react";
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 [confirmSections, setConfirmSections] = useState(false);
const repFormData = formObj.representationForm.values;
// const repDate = new Date();
// let day = repDate.getDate();
// let month = repDate.getMonth() + 1;
// let year = repDate.getFullYear();
// let repType = "";
// switch (repFormData.representationCapacity) {
// case t("myrepresentations:capacity-options-arr-appellant"):
// repType = "APP";
// 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 +
// "-" +
// repDate.getHours() +
// repDate.getMinutes() +
// repDate.getSeconds() +
// "_" +
// repType +
// "_" +
// props.props.props.accountDetails.accountDetails.lastname +
// "_" +
// props.props.props.accountDetails.accountDetails.firstname,
// "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:
case 846040001:
case 846040006:
case 846040025:
case 846040004:
case 846040018:
case 846040003:
case 846040009:
case 846040008:
return (
);
break;
case 846040005:
case 846040006:
case 846040007:
return (
);
break;
default:
return <>>;
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;