From 30ee6f02d7c9bb2a87832a1b3b35a2201200449f Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Thu, 23 May 2024 18:02:56 +0100 Subject: [PATCH] reps for dns --- actions/azurestorage.js | 6 + components/case/representation/index.js | 108 +++++++++++++----- locales/cy/myrepresentations.json | 1 + locales/en/myrepresentations.json | 1 + .../api/file/createrepcompletemessage_api.js | 13 ++- pages/api/file/generatepdf.js | 6 + 6 files changed, 103 insertions(+), 32 deletions(-) diff --git a/actions/azurestorage.js b/actions/azurestorage.js index 5f68795a..c6b100ff 100644 --- a/actions/azurestorage.js +++ b/actions/azurestorage.js @@ -426,6 +426,8 @@ export const createRepPDFBlob = async ( ? "Main Party Questionnaire" : repName.indexOf("_Comments") > 0 ? "Main Party Comments" + : repName.indexOf("_Impact") > 0 + ? "Main Party Comments" : "default"; const tags = { @@ -559,6 +561,8 @@ export const uploadFile = async (formContent, containerName, foldername) => { ? "Main Party Questionnaire" : files[prop][0].fieldName.indexOf("_Comments_") > 0 ? "Main Party Comments" + : files[prop][0].fieldName.indexOf("_Impact_") > 0 + ? "Main Party Comments" : "default"; const tags = { @@ -1277,6 +1281,8 @@ export const createRepCompleteMessage = async ( "/files", }; + console.log("======================", message, "====================="); + const sendMessageResponse = await queueServiceClient .getQueueClient(whichQueue) .sendMessage( diff --git a/components/case/representation/index.js b/components/case/representation/index.js index a332bee6..86592ec7 100644 --- a/components/case/representation/index.js +++ b/components/case/representation/index.js @@ -132,6 +132,9 @@ let MakeRepresentation = (props) => { case "Final comments": repType = "Comments"; break; + case "Local Impact Report": + repType = "Impact"; + break; case "Other": repType = "OTHER"; @@ -224,22 +227,59 @@ let MakeRepresentation = (props) => { let todaysDate = new Date(); - let startDate = new Date(detailsObj.pinswg_startdate); - let questionnaireDate = new Date( - detailsObj.pinswg_questionnaireduedate - ); - let finalCommentsDate = new Date( - detailsObj.pinswg_finalcommentsduedate - ); - let statementDueDate = new Date(detailsObj.pinswg_statementduedate); + const isDNS = currentView.caseReference.appealType == 846040011; + + let startDate; + let questionnaireDate; + let finalCommentsDate; + let statementDueDate; + + isDNS + ? ((startDate = new Date( + detailsObj.pinswg_applicationacceptedasvalid + )), + (questionnaireDate = new Date( + detailsObj.pinswg_endofrepresentationperiod + )), + (finalCommentsDate = new Date( + detailsObj.pinswg_finalcommentsduedate + )), + (statementDueDate = new Date( + detailsObj.pinswg_endofrepresentationperiod + ))) + : ((startDate = new Date(detailsObj.pinswg_startdate)), + (questionnaireDate = new Date( + detailsObj.pinswg_questionnaireduedate + )), + (finalCommentsDate = new Date( + detailsObj.pinswg_finalcommentsduedate + )), + (statementDueDate = new Date( + detailsObj.pinswg_statementduedate + ))); isLPA && currentView.caseReference.appealType != 846040019 && + currentView.caseReference.appealType != 846040011 && todaysDate >= startDate && todaysDate <= questionnaireDate && buildArr.push("Questionnaire"); - todaysDate >= startDate && + isLPA && + isDNS && + currentView.caseReference.appealType != 846040019 && + todaysDate >= startDate && + todaysDate <= questionnaireDate && + buildArr.push("Local Impact Report"); + + !isDNS && + todaysDate >= startDate && + todaysDate <= statementDueDate && + buildArr.push("Statement"); + + isDNS && + !isLPA && + todaysDate >= startDate && todaysDate <= statementDueDate && buildArr.push("Statement"); @@ -909,18 +949,29 @@ let MakeRepresentation = (props) => {

{t( "myrepresentations:timetable-title" - )} + )}{" "} + {currentView.caseReference + .appealType == + 846040011}

- {t( - "myrepresentations:questionnaire-due-label" - )} + {currentView + .caseReference + .appealType == + 846040011 + ? t( + "myrepresentations:local-impact-report" + ) + : t( + "myrepresentations:questionnaire-due-label" + )} : {" "} {formatDates( - detailsObj.pinswg_questionnaireduedate + detailsObj.pinswg_questionnaireduedate || + detailsObj.pinswg_endofrepresentationperiod )}
@@ -933,22 +984,27 @@ let MakeRepresentation = (props) => { {" "} {formatDates( detailsObj.pinswg_statementduedate || - detailsObj.pinswg_statementsduedate + detailsObj.pinswg_statementsduedate || + detailsObj.pinswg_endofrepresentationperiod )}
-
- {t( - "myrepresentations:final-comments-due-label" - )} - : - - {" "} - {formatDates( - detailsObj.pinswg_finalcommentsduedate + {currentView.caseReference + .appealType != + 846040011 && ( +
+ {t( + "myrepresentations:final-comments-due-label" )} - -
+ : + + {" "} + {formatDates( + detailsObj.pinswg_finalcommentsduedate + )} + +
+ )} {" "} diff --git a/locales/cy/myrepresentations.json b/locales/cy/myrepresentations.json index 2ed06ecb..2b181f54 100644 --- a/locales/cy/myrepresentations.json +++ b/locales/cy/myrepresentations.json @@ -3,6 +3,7 @@ "make-a-representation-for-label": "Gwnewch gynrychiolaeth ar gyfer", "timetable-title": "Amserlen", "questionnaire-due-label": "Holiadur yn ddyledus", + "local-impact-report": "Adroddiad Effaith Lleol i'w gyhoeddi", "statements-due-label": "Datganiadau yn ddyledus", "final-comments-due-label": "Sylwadau terfynol yn ddyledus", "representation-from-an-agent-heading": "Cynrychiolaeth gan Asiant", diff --git a/locales/en/myrepresentations.json b/locales/en/myrepresentations.json index cd12a018..db8423e8 100644 --- a/locales/en/myrepresentations.json +++ b/locales/en/myrepresentations.json @@ -3,6 +3,7 @@ "make-a-representation-for-label": "Make a representation for", "timetable-title": "Timetable", "questionnaire-due-label": "Questionnaire due", + "local-impact-report": "Local Impact Report due", "statements-due-label": "Statements due", "final-comments-due-label": "Final comments due", "representation-from-an-agent-heading": "Representation from an Agent", diff --git a/pages/api/file/createrepcompletemessage_api.js b/pages/api/file/createrepcompletemessage_api.js index 99509a49..7fb2d907 100644 --- a/pages/api/file/createrepcompletemessage_api.js +++ b/pages/api/file/createrepcompletemessage_api.js @@ -15,18 +15,19 @@ ApiProxy.get(async (req, res) => { var tempCaseRef = req.query.tempcaseref; var filename = req.query.repid; - console.log( - "/////Create Rep complete Message:\n", - tempCaseRef, - "\n//////////////" - ); - // console.log(hashAPIPath(checkquerypath), checkHash); // console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); //if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { await createRepCompleteMessage(containerName, tempCaseRef, filename).then( (data) => { + console.log( + "/////Create Rep complete Message:\n" + tempCaseRef, + "\n" + "insertedOn:" + data.insertedOn, + "\n" + "messageId:" + data.messageId, + "\n" + "response.status:" + data._response.status, + "\n//////////////" + ); return res.status(200).json(data); } ); diff --git a/pages/api/file/generatepdf.js b/pages/api/file/generatepdf.js index 09162aac..088f7dbe 100644 --- a/pages/api/file/generatepdf.js +++ b/pages/api/file/generatepdf.js @@ -150,6 +150,9 @@ export default async function handler(req, res) { case "Written statement": return writtenStatement_pdf(values, values.docProps.locale); break; + case "Impact": + return statement_pdf(values, values.docProps.locale); + break; case "Other": return other_pdf(values, values.docProps.locale); break; @@ -200,6 +203,9 @@ export default async function handler(req, res) { case "Final comments": repType = "Comments"; break; + case "Local Impact Report": + repType = "Impact"; + break; case "Other": repType = "OTHER";