From 46582d761ce2bb81075cbed4f81973561a21f7bb Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Thu, 2 May 2024 16:19:46 +0100 Subject: [PATCH] fixes for rep complete queue --- actions/azurestorage.js | 21 ++- actions/index.js | 10 +- .../representation/representationComplete.js | 4 +- .../representationCompleteSubmit.js | 54 ++++++- components/newappeal/buildchecksection.js | 136 ++++++++++-------- .../api/file/createrepcompletemessage_api.js | 9 +- styles/sass/welshgov/_application.scss | 23 +++ 7 files changed, 190 insertions(+), 67 deletions(-) diff --git a/actions/azurestorage.js b/actions/azurestorage.js index b405ae99..f27c8336 100644 --- a/actions/azurestorage.js +++ b/actions/azurestorage.js @@ -1141,7 +1141,8 @@ export const createCaseCompleteMessage = async ( export const createRepCompleteMessage = async ( containerName, - caseReference + caseReference, + filename ) => { const whichQueue = "pedw-submitted-representations"; const queueToken = await createQueueSas(whichQueue); @@ -1153,9 +1154,23 @@ export const createRepCompleteMessage = async ( const message = { containerName: containerName, caseref: caseReference, - reppath: endpointURL + "/" + containerName + "/" + caseReference + "/", + reppath: + endpointURL + + "/" + + containerName + + "/" + + caseReference + + "/" + + filename, filespath: - endpointURL + "/" + containerName + "/" + caseReference + "/files", + endpointURL + + "/" + + containerName + + "/" + + caseReference + + "/" + + filename + + "/files", }; const sendMessageResponse = await queueServiceClient diff --git a/actions/index.js b/actions/index.js index 6d2f9205..28b413e9 100644 --- a/actions/index.js +++ b/actions/index.js @@ -1774,12 +1774,18 @@ export const sendCaseCompleteMessageProxy = async ( }); }; -export const sendRepCompleteMessage = async (containerID, caseReference) => { +export const sendRepCompleteMessage = async ( + containerID, + caseReference, + fileName +) => { var queryUrl = "/api/file/createrepcompletemessage_api?container=" + containerID + "&tempcaseref=" + - caseReference; + caseReference + + "&repid=" + + fileName; var config = { method: "get", diff --git a/components/case/representation/representationComplete.js b/components/case/representation/representationComplete.js index d1dc6abb..3ec645de 100644 --- a/components/case/representation/representationComplete.js +++ b/components/case/representation/representationComplete.js @@ -21,6 +21,7 @@ const RepComplete = (props) => { setSubmitBack, setRepresentationSubmitConfirmation, setRepresentationMessageSent, + repFormData, } = props; const { acceptedFiles, getRootProps, getInputProps } = useDropzone(); const files = acceptedFiles.map((file) => ( @@ -46,7 +47,8 @@ const RepComplete = (props) => { props.props.currentView.representationMessageSent != true && (sendRepCompleteMessage( props.props.props.props.accountDetails.containerID, - props.props.currentView.caseReference.currentReference + props.props.currentView.caseReference.currentReference, + props.repFormData.repfile_name ), sendEmail(templateId, emailAddress, personalisation, reference), setRepresentationMessageSent(true)); diff --git a/components/case/representation/representationCompleteSubmit.js b/components/case/representation/representationCompleteSubmit.js index e1b95610..3c81baed 100644 --- a/components/case/representation/representationCompleteSubmit.js +++ b/components/case/representation/representationCompleteSubmit.js @@ -37,7 +37,58 @@ const RepCompleteSubmit = (props) => { const repFormData = formObj.representationForm.values; - console.log("///////// formObj:", formObj); + 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 = () => { { @@ -72,6 +123,7 @@ const RepCompleteSubmit = (props) => { <> {currentView.representationSubmitConfirmation == true ? ( { }); const [confirmSections, setConfirmSections] = useState(false); + const [finaliseAppealProcess, setFinaliseAppealProcess] = useState(false); const FieldsTranslations = (label) => { const router = useRouter(); @@ -135,6 +136,10 @@ let BuildCheckSection = (props) => { props.appealType.caseReference.ticketnumber ); }) + .then((data) => { + setFinaliseAppealProcess(true); + return data; + }) .then((data) => { console.log("have sent comple message :", data); setCurrentSection(9999); @@ -221,68 +226,85 @@ let BuildCheckSection = (props) => { - -
-
-
-
- { - setConfirmSections(!confirmSections); - }} - /> -
-
-

- {t( - "newappeal:new-appeal-check-confirm-paragraph-one" - )} -

-
-
-

- {t( - "newappeal:new-appeal-check-confirm-paragraph-two" - )}{" "} - + { + finaliseAppeal(); + }} > - {t( - "newappeal:new-appeal-check-confirm-paragraph-two-link" - )} - -

-
-
-
- { - finaliseAppeal(); - }} - > - {t("newappeal:submit-appeal-button")} - -
+ {t("newappeal:submit-appeal-button")} + + + + )} ); diff --git a/pages/api/file/createrepcompletemessage_api.js b/pages/api/file/createrepcompletemessage_api.js index 1edfb765..99509a49 100644 --- a/pages/api/file/createrepcompletemessage_api.js +++ b/pages/api/file/createrepcompletemessage_api.js @@ -13,6 +13,7 @@ ApiProxy.use(middleware); ApiProxy.get(async (req, res) => { var containerName = req.query.container; var tempCaseRef = req.query.tempcaseref; + var filename = req.query.repid; console.log( "/////Create Rep complete Message:\n", @@ -24,9 +25,11 @@ ApiProxy.get(async (req, res) => { // console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); //if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { - await createRepCompleteMessage(containerName, tempCaseRef).then((data) => { - return res.status(200).json(data); - }); + await createRepCompleteMessage(containerName, tempCaseRef, filename).then( + (data) => { + return res.status(200).json(data); + } + ); // } else { // return res.status(400).json(); // } diff --git a/styles/sass/welshgov/_application.scss b/styles/sass/welshgov/_application.scss index 82c3f0ac..ee1fb809 100644 --- a/styles/sass/welshgov/_application.scss +++ b/styles/sass/welshgov/_application.scss @@ -2474,4 +2474,27 @@ fade { margin-top: 32px; padding-top: 4px !important; } +} + +.textloading:after { + overflow: hidden; + display: inline-block; + vertical-align: bottom; + -webkit-animation: ellipsis steps(4, end) 900ms infinite; + animation: ellipsis steps(4, end) 900ms infinite; + content: "\2026"; + /* ascii code for the ellipsis character */ + width: 0px; +} + +@keyframes ellipsis { + to { + width: 40px; + } +} + +@-webkit-keyframes ellipsis { + to { + width: 40px; + } } \ No newline at end of file