diff --git a/actions/azurestorage.js b/actions/azurestorage.js index 0fa715b0..5db5aa22 100644 --- a/actions/azurestorage.js +++ b/actions/azurestorage.js @@ -673,49 +673,77 @@ export const uploadSingleFile = async ( "\n////////////////////////////" ); - let whichLocation = - files[prop][0].fieldName.indexOf("_Statement_of_Case") > 0 || - files[prop][0].fieldName.indexOf("_-_Statement_of_Case") > 0 || - files[prop][0].fieldName.indexOf("_-_Application_Form") > 0 || - files[prop][0].fieldName.indexOf("_-_Site_Ownership_Certificate") > - 0 || - files[prop][0].fieldName.indexOf("_-_Decision_Notice") > 0 || - files[prop][0].fieldName.indexOf("_-_Site_Location_Plan") > 0 || - files[prop][0].fieldName.indexOf("_-_Plans_Drawing_Documents") > - 0 || - files[prop][0].fieldName.indexOf( - "_-_Additional_Plans_Drawings_Documents" - ) > 0 || - files[prop][0].fieldName.indexOf("_-_Design_and_Access_Statement") > - 0 || - files[prop][0].fieldName.indexOf( - "_-_NSB_LPA_Additional_Documents" - ) > 0 || - files[prop][0].fieldName.indexOf("_-_LPA_Correspondence") > 0 || - files[prop][0].fieldName.indexOf("_-_LPA_Original_Permission") > - 0 || - files[prop][0].fieldName.indexOf("_-_LPA's_Registration_Letter") > - 0 || - files[prop][0].fieldName.indexOf("_-_Environmental_Statement") > - 0 || - files[prop][0].fieldName.indexOf("_-_Cost_of_Application") > 0 || - files[prop][0].fieldName.indexOf("_-_Other_Relevant_Material") > - 0 || - files[prop][0].fieldName.indexOf( - "_-_S106_Agreement_or_Unilateral_Undertaking" > 0 - ) - ? "846040000" - : files[prop][0].fieldName.indexOf("_IP_") > 0 - ? "846040005" - : files[prop][0].fieldName.indexOf("_Statement_") > 0 - ? "846040002" - : files[prop][0].fieldName.indexOf("_Questionnaire_") > 0 - ? "846040001" - : files[prop][0].fieldName.indexOf("_Comments_") > 0 - ? "846040003" - : files[prop][0].fieldName.indexOf("_Impact_") > 0 - ? "846040001" - : "846040000"; + // let whichLocation = + // files[prop][0].fieldName.indexOf("_Statement_of_Case") > 0 || + // files[prop][0].fieldName.indexOf("_-_Statement_of_Case") > 0 || + // files[prop][0].fieldName.indexOf("_-_Application_Form") > 0 || + // files[prop][0].fieldName.indexOf("_-_Site_Ownership_Certificate") > + // 0 || + // files[prop][0].fieldName.indexOf("_-_Decision_Notice") > 0 || + // files[prop][0].fieldName.indexOf("_-_Site_Location_Plan") > 0 || + // files[prop][0].fieldName.indexOf("_-_Plans_Drawing_Documents") > + // 0 || + // files[prop][0].fieldName.indexOf( + // "_-_Additional_Plans_Drawings_Documents" + // ) > 0 || + // files[prop][0].fieldName.indexOf("_-_Design_and_Access_Statement") > + // 0 || + // files[prop][0].fieldName.indexOf( + // "_-_NSB_LPA_Additional_Documents" + // ) > 0 || + // files[prop][0].fieldName.indexOf("_-_LPA_Correspondence") > 0 || + // files[prop][0].fieldName.indexOf("_-_LPA_Original_Permission") > + // 0 || + // files[prop][0].fieldName.indexOf("_-_LPA's_Registration_Letter") > + // 0 || + // files[prop][0].fieldName.indexOf("_-_Environmental_Statement") > + // 0 || + // files[prop][0].fieldName.indexOf("_-_Cost_of_Application") > 0 || + // files[prop][0].fieldName.indexOf("_-_Other_Relevant_Material") > + // 0 || + // files[prop][0].fieldName.indexOf( + // "_-_S106_Agreement_or_Unilateral_Undertaking" > 0 + // ) + // ? "846040000" + // : files[prop][0].fieldName.indexOf("_IP_") > 0 + // ? "846040005" + // : files[prop][0].fieldName.indexOf("_Statement_") > 0 + // ? "846040002" + // : files[prop][0].fieldName.indexOf("_Questionnaire_") > 0 + // ? "846040001" + // : files[prop][0].fieldName.indexOf("_Comments_") > 0 + // ? "846040003" + // : files[prop][0].fieldName.indexOf("_Impact_") > 0 + // ? "846040001" + // : "846040000"; + + const fieldName = files[prop][0].fieldName; + + // Define the patterns and corresponding values + const patternMapping = [ + { + pattern: + /_Statement_of_Case|_-_Statement_of_Case|_-_Application_Form|_-_Site_Ownership_Certificate|_-_Decision_Notice|_-_Site_Location_Plan|_-_Plans_Drawing_Documents|_-_Additional_Plans_Drawings_Documents|_-_Design_and_Access_Statement|_-_NSB_LPA_Additional_Documents|_-_LPA_Correspondence|_-_LPA_Original_Permission|_-_LPA's_Registration_Letter|_-_Environmental_Statement|_-_Cost_of_Application|_-_Other_Relevant_Material|_-_S106_Agreement_or_Unilateral_Undertaking/, + value: "846040000", + }, + { pattern: /_IP_/, value: "846040005" }, + { pattern: /_Statement_/, value: "846040002" }, + { pattern: /_Questionnaire_/, value: "846040001" }, + { pattern: /_Comments_/, value: "846040003" }, + { pattern: /_Impact_/, value: "846040001" }, + ]; + + // Find a matching pattern or fallback to default + let whichLocation = "846040000"; // Default value + + for (const { pattern, value } of patternMapping) { + if (pattern.test(fieldName)) { + whichLocation = value; + break; + } + } + + // return whichLocation; const tags = { containerid: containerName, @@ -723,6 +751,7 @@ export const uploadSingleFile = async ( documentType: files[prop][0].fieldName.split(".")[1], blobType: "RepresentationFile", ishareLocation: whichLocation, + documentLocationId: whichLocation, }; const withTags = await blockBlobClient.setTags(tags); const withMeta = await blockBlobClient.setMetadata(tags); @@ -1275,8 +1304,7 @@ export const getAllProgressBlobs = async (containerName) => { (value, index, self) => index === self.findIndex( - (t) => - t.name === value.name // Change 'id' to the property you're checking for uniqueness + (t) => t.name === value.name // Change 'id' to the property you're checking for uniqueness ) ); return unique; diff --git a/components/case/representation/index.js b/components/case/representation/index.js index f287a7b6..f4134a93 100644 --- a/components/case/representation/index.js +++ b/components/case/representation/index.js @@ -113,7 +113,7 @@ let MakeRepresentation = (props) => { const repDate = new Date(); let day = ("0" + repDate.getDate()).slice(-2); - let month = ("0" + repDate.getMonth() + 1).slice(-2); + let month = ("0" + (repDate.getMonth() + 1)).slice(-2); let year = repDate.getFullYear(); switch (values.representationCapacity) { diff --git a/components/case/representation/representationQuestionnairesCheck/representationLPAQuestionnaireCheck_s78.js b/components/case/representation/representationQuestionnairesCheck/representationLPAQuestionnaireCheck_s78.js index 9502e638..ad949d1f 100644 --- a/components/case/representation/representationQuestionnairesCheck/representationLPAQuestionnaireCheck_s78.js +++ b/components/case/representation/representationQuestionnairesCheck/representationLPAQuestionnaireCheck_s78.js @@ -16,7 +16,7 @@ let RepLPAQuestionnaireCheck_s78 = (props) => { let repFormData = formObj.representationForm.values; - repFormData = updateLinks(formObj); + repFormData = updateLinks(repFormData); return ( <> diff --git a/components/myportal/awaitingsubmissionfromblob.js b/components/myportal/awaitingsubmissionfromblob.js index d7e3629d..f4a26c87 100644 --- a/components/myportal/awaitingsubmissionfromblob.js +++ b/components/myportal/awaitingsubmissionfromblob.js @@ -159,15 +159,47 @@ const AwaitingSubmissionFromBlob = (props) => { } )} + {!showTopThreeArr[key].hasOwnProperty( + "appealComplete" + ) && ( +