diff --git a/components/case/representation/index.js b/components/case/representation/index.js index bf5bb5af..de82acfb 100644 --- a/components/case/representation/index.js +++ b/components/case/representation/index.js @@ -34,6 +34,8 @@ let MakeRepresentation = (props) => { const [clearRepForm, setClearRepForm] = useState(false); const [savingStatus, setSavingStatus] = useState(false); + const [finaliseAppealProcess, setFinaliseAppealProcess] = useState(false); + //const [questionnaireCount, setQuestionnaireCount] = useState(0); const { data: session } = useSession(); @@ -879,7 +881,6 @@ let MakeRepresentation = (props) => { }; const onHandleSubmit = (values) => { - window.scrollTo({ top: 0, behavior: "smooth" }); values = setRepFileName(values); //console.log("onHandleSubmit form values - ", JSON.stringify(values)); @@ -1014,6 +1015,7 @@ let MakeRepresentation = (props) => { setRepresentationSubmit(true); } } + window.scrollTo({ top: 0, behavior: "smooth" }); } else { if (currentView.representationSubmit == true) { console.log("capacity", currentView.representationCapacity); @@ -1034,18 +1036,22 @@ let MakeRepresentation = (props) => { // Object.assign(values, { // "filesList": buildFileArray, // })), - console.log( - "====================== rep lpa payload:\n", - JSON.stringify(values) - ); + // console.log( + // "====================== rep lpa payload:\n", + // JSON.stringify(values) + // ); + setFinaliseAppealProcess(true); generateRepPDF( values, props.props.accountDetails.containerID, currentView.caseReference.currentReference - ); - uploadRepresentationFiles(values); - setRepresentationSubmit(true); - setRepresentationSubmitConfirmation(true); + ).then((data) => { + console.log(data); + data.status == "success" && + (uploadRepresentationFiles(values), + setRepresentationSubmit(true), + setRepresentationSubmitConfirmation(true)); + }); } else { console.log("not updated"); } @@ -1148,6 +1154,8 @@ let MakeRepresentation = (props) => { showQuestionnaireSection={showQuestionnaireSection} props={props} questionnaireCount={questionnaireCount} + finaliseAppealProcess={finaliseAppealProcess} + setFinaliseAppealProcess={setFinaliseAppealProcess} /> ) : ( <> diff --git a/components/case/representation/representationCompleteSubmit.js b/components/case/representation/representationCompleteSubmit.js index 9208d995..57cf569c 100644 --- a/components/case/representation/representationCompleteSubmit.js +++ b/components/case/representation/representationCompleteSubmit.js @@ -29,6 +29,7 @@ const RepCompleteSubmit = (props) => { setShowQuestionnaireSection, showQuestionnaireSection, questionnaireCount, + finaliseAppealProcess, } = props; const { acceptedFiles, getRootProps, getInputProps } = useDropzone(); const files = acceptedFiles.map((file) => ( @@ -473,72 +474,83 @@ const RepCompleteSubmit = (props) => { )}

-
-
-
- { - setConfirmSections( - !confirmSections - ); - }} - /> - -
+ {finaliseAppealProcess ? ( +
+

+ Finalising your representation + submission +

+

+ Currenly uploading files and finalising + your representation submission +

+

+ Please wait +

+ ) : ( + <> +
+
+
+ { + setConfirmSections( + !confirmSections + ); + }} + /> + +
+
+
- {/* */} -
-
-
-
- - {/* { - setRepresentationSubmit(false); - }} - className="govuk-button" - > - {t("common:continue-button")} - */} - - setSubmitBack()} - className="govuk-link" - > - {t("case:summary-back-button-label")} - -
+
+
+ + setSubmitBack()} + className="govuk-link" + > + {t( + "case:summary-back-button-label" + )} + +
+
+ + )}