diff --git a/components/case/representation/index.js b/components/case/representation/index.js index 192b589a..8d85a1e0 100644 --- a/components/case/representation/index.js +++ b/components/case/representation/index.js @@ -545,6 +545,12 @@ let MakeRepresentation = (props) => { detailsObj[ "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" ], + "_pinswg_localplanningauthority_value": + detailsObj["_pinswg_localplanningauthority_value"], + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue": + detailsObj[ + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" + ], "representationCapacity": router.query.hasOwnProperty("state") ? router.query.state == "edit" ? props.props.currentView.representationCapacity diff --git a/components/myportal/topthree_reps.js b/components/myportal/topthree_reps.js index 6d2aa981..dad94159 100644 --- a/components/myportal/topthree_reps.js +++ b/components/myportal/topthree_reps.js @@ -38,9 +38,22 @@ const TopThree = (props) => { const { locale } = router; let topthreeRow = []; - let showTopThreeArr = showTopThree.value; + Object.keys(showTopThreeArr).map((key, index) => { + let createdDate = parseInt( + showTopThreeArr[key].repfile_name.split("-")[3] + ); + showTopThreeArr[key].createdDate = createdDate; + }); + + showTopThreeArr.sort(function compare(a, b) { + console.log(a.createdDate, b.createdDate); + var dateA = new Date(a.createdDate); + var dateB = new Date(b.createdDate); + return dateB - dateA; + }); + const deleteItem = (caseID, topThreeType) => { let cookies = parseCookies(); //console.log("sssss", caseID, topThreeType); @@ -135,13 +148,13 @@ const TopThree = (props) => { return dateObj.toLocaleString(); }; - let topThreeOnlyArr = showTopThreeArr; //.slice(0, 3); + let topThreeOnlyArr = showTopThreeArr.slice(0, 3); Object.keys(topThreeOnlyArr).map((key, index) => { topthreeRow.push(
- {t("myportal:representation-id")}:{" "} + {t("myportal:case-reference")}:{" "} {
-
- {t("myportal:case-reference")}: - {" "} - {showTopThreeArr[key].caseRef} -
{t("myportal:representation-type")}: {" "} @@ -191,6 +199,11 @@ const TopThree = (props) => { {t("myportal:date-raised")}: {" "} {repRaisedDate(showTopThreeArr[key].repfile_name)} +
{" "} +
+ lpa: + {" "} + {repRaisedDate(showTopThreeArr[key].repfile_name)}
diff --git a/components/myportal/viewall.js b/components/myportal/viewall.js index da6acf7c..33fd4201 100644 --- a/components/myportal/viewall.js +++ b/components/myportal/viewall.js @@ -20,7 +20,10 @@ const ViewAllResults = (props) => { const router = useRouter(); const { locale } = router; - + const repRaisedDate = (datePart) => { + var dateObj = new Date(datePart); + return dateObj.toLocaleString(); + }; var resultsArr = currentView.viewKey == "awaitingSubmissionDetails" ? props["awaitingSubmission"].awaitingSubmissionDetails.case @@ -39,7 +42,7 @@ const ViewAllResults = (props) => { currentView.viewKey == "awaitingSubmissionDetails" ? props["awaitingSubmission"].awaitingSubmissionDetails.value : currentView.viewKey == "myRepresentations" - ? props["myRepresentations"]["myRepresentationsDetails"] + ? props["myRepresentations"].myRepresentations.value : props[currentView.viewKey][currentView.viewKey + "Details"] || []; let resultsRowArr = []; @@ -62,7 +65,16 @@ const ViewAllResults = (props) => {
{ setCurrentReference({ "currentReference": currentView.viewKey != "watchedCases" - ? resultsArr[key].ticketnumber + ? currentView.viewKey == + "myRepresentations" + ? resultsArr[key].caseRef + : resultsArr[key].ticketnumber : resultsArr[key][ "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" ], @@ -109,6 +124,10 @@ const ViewAllResults = (props) => { "appealType": resultsArr[key].pinswg_appealcasetype, + "repDetails": + currentView.viewKey == + "myRepresentations" && + resultsArr[key], }); }} > @@ -118,7 +137,7 @@ const ViewAllResults = (props) => { {currentView.viewKey != "watchedCases" ? currentView.viewKey == "myRepresentations" - ? resultsArr[key].casereference + ? resultsArr[key].caseRef : resultsArr[key].ticketnumber : resultsArr[key][ "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" @@ -152,10 +171,7 @@ const ViewAllResults = (props) => { ? detailsObj.pinswg_siteaddressline1 : ""} {currentView.viewKey == "myRepresentations" && - _.has( - searchDetailsObj[key].value[0], - "pinswg_siteaddressline1" - ) + _.has(searchDetailsObj[key].pinswg_siteaddressline1) ? searchDetailsObj[key].value[0].pinswg_siteaddressline1 : ""} {_.has(detailsObj, "pinswg_siteaddressline1") @@ -169,10 +185,7 @@ const ViewAllResults = (props) => { searchDetailsObj[key].pinswg_siteaddressline1 != null &&
} {currentView.viewKey == "myRepresentations" && - _.has( - searchDetailsObj[key].value[0], - "pinswg_siteaddressline1" - ) && + _.has(searchDetailsObj[key].pinswg_siteaddressline1) && searchDetailsObj[key].value[0] .pinswg_siteaddressline1 != null &&
} {_.has(detailsObj, "pinswg_siteaddressline1") && @@ -182,11 +195,8 @@ const ViewAllResults = (props) => { ? searchDetailsObj[key].pinswg_siteaddressline2 : ""} {currentView.viewKey == "myRepresentations" && - _.has( - searchDetailsObj[key].value[0], - "pinswg_siteaddressline1" - ) - ? searchDetailsObj[key].value[0].pinswg_siteaddressline2 + _.has(searchDetailsObj[key].pinswg_siteaddressline1) + ? searchDetailsObj[key].pinswg_siteaddressline2 : ""} {_.has(detailsObj, "pinswg_siteaddressline1") ? detailsObj.pinswg_siteaddressline2 @@ -200,12 +210,9 @@ const ViewAllResults = (props) => { null &&
} {currentView.viewKey == "myRepresentations" && - _.has( - searchDetailsObj[key].value[0], - "pinswg_siteaddressline2" - ) && - searchDetailsObj[key].value[0] - .pinswg_siteaddressline2 != null &&
} + _.has(searchDetailsObj[key].pinswg_siteaddressline2) && + searchDetailsObj[key].pinswg_siteaddressline1 != + null &&
} {_.has(detailsObj, "pinswg_siteaddressline2") && detailsObj.pinswg_siteaddressline2 != null &&
} @@ -214,11 +221,8 @@ const ViewAllResults = (props) => { ? searchDetailsObj[key].pinswg_siteaddresstown : ""} {currentView.viewKey == "myRepresentations" && - _.has( - searchDetailsObj[key].value[0], - "pinswg_siteaddresstown" - ) - ? searchDetailsObj[key].value[0].pinswg_siteaddresstown + _.has(searchDetailsObj[key], "pinswg_siteaddresstown") + ? searchDetailsObj[key].pinswg_siteaddresstown : ""} {_.has(detailsObj, "pinswg_siteaddresstown") ? detailsObj.pinswg_siteaddresstown @@ -233,10 +237,10 @@ const ViewAllResults = (props) => { {currentView.viewKey == "myRepresentations" && _.has( - searchDetailsObj[key].value[0], + searchDetailsObj[key], "pinswg_siteaddresstown" ) && - searchDetailsObj[key].value[0].pinswg_siteaddresstown != + searchDetailsObj[key].pinswg_siteaddresstown != null &&
} {_.has(detailsObj, "pinswg_siteaddresstown") && @@ -246,12 +250,8 @@ const ViewAllResults = (props) => { ? searchDetailsObj[key].pinswg_siteaddresscounty : ""} {currentView.viewKey == "myRepresentations" && - _.has( - searchDetailsObj[key].value[0], - "pinswg_siteaddresscounty" - ) - ? searchDetailsObj[key].value[0] - .pinswg_siteaddresscounty + _.has(searchDetailsObj[key], "pinswg_siteaddresscounty") + ? searchDetailsObj[key].pinswg_siteaddresscounty : ""} {_.has(detailsObj, "pinswg_siteaddresscounty") ? detailsObj.pinswg_siteaddresscounty @@ -288,7 +288,7 @@ const ViewAllResults = (props) => { "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" ] : currentView.viewKey == "myRepresentations" - ? searchDetailsObj[key].value[0][ + ? searchDetailsObj[key][ "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" ] : resultsArr[key][ @@ -338,6 +338,8 @@ const ViewAllResults = (props) => { ] + '")].value_cy' ) + : currentView.viewKey == "myRepresentations" + ? searchDetailsObj[key].value : searchDetailsObj[key].value[0][ "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" ] || "N/A" @@ -365,12 +367,11 @@ const ViewAllResults = (props) => { jsonpath.query( transLookup, '$..[?(@.value=="' + - searchDetailsObj[key].value[0][ + searchDetailsObj[key][ "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" ] + '")].value_cy' )} - qqq
@@ -411,16 +412,12 @@ const ViewAllResults = (props) => { transLookup, '$..[?(@.value=="' + getFormCollectionByID( - searchDetailsObj[key].value[0][ - "pinswg_procedure" - ] + searchDetailsObj[key].appealType ).value + '")].value_cy' )[0] : getFormCollectionByID( - searchDetailsObj[key].value[0][ - "pinswg_procedure" - ] + searchDetailsObj[key].appealType ).value)} {_.has( searchDetailsObj[key], @@ -429,7 +426,10 @@ const ViewAllResults = (props) => {
- {t("search:searchresults-status-label")}: + {currentView.viewKey == "myRepresentations" + ? "Created" + : t("search:searchresults-status-label")} + : {currentView.viewKey == "awaitingSubmissionDetails" @@ -447,28 +447,28 @@ const ViewAllResults = (props) => { '")].value' ) || "N/A" : currentView.viewKey == "myRepresentations" - ? router.locale == "cy" - ? jsonpath.query( - transLookup, - '$..[?(@.value=="' + - searchDetailsObj[key].value[0][ - "statuscode@OData.Community.Display.V1.FormattedValue" - ] + - '")].value_cy' - ) - : searchDetailsObj[key].value[0][ - "statuscode@OData.Community.Display.V1.FormattedValue" - ] || "N/A" - : router.locale == "cy" - ? jsonpath.query( - transLookup, - '$..[?(@.value=="' + - item[ - "statuscode@OData.Community.Display.V1.FormattedValue" - ] + - '")].value_cy' - ) - : item[ + ? repRaisedDate(item.createdDate) // ? router.locale == "cy" + : // ? jsonpath.query( + // transLookup, + // '$..[?(@.value=="' + + // searchDetailsObj[key].value[0][ + // "statuscode@OData.Community.Display.V1.FormattedValue" + // ] + + // '")].value_cy' + // ) + // : searchDetailsObj[key].value[0][ + // "statuscode@OData.Community.Display.V1.FormattedValue" + // ] || "N/A" + // : router.locale == "cy" + // ? jsonpath.query( + // transLookup, + // '$..[?(@.value=="' + + // item[ + // "statuscode@OData.Community.Display.V1.FormattedValue" + // ] + + // '")].value_cy' + // ) + item[ "statuscode@OData.Community.Display.V1.FormattedValue" ] || "N/A"}
@@ -516,7 +516,9 @@ const ViewAllResults = (props) => { {t("search:searchresults-case-type-label")}
- {t("search:searchresults-status-label")} + {currentView.viewKey == "myRepresentations" + ? "Created" + : t("search:searchresults-status-label")}
diff --git a/components/newappeal/buildchecksection.js b/components/newappeal/buildchecksection.js index 644b8c26..e4a88aa0 100644 --- a/components/newappeal/buildchecksection.js +++ b/components/newappeal/buildchecksection.js @@ -98,9 +98,9 @@ let BuildCheckSection = (props) => {
- {props.props.appealType.fileList.files.length > + {props.props.appealType.fileList.value.length > 0 - ? props.props.appealType.fileList.files.map( + ? props.props.appealType.fileList.value.map( (blob, i) => (
{ > {blob.name.slice( { /> - {blob.name.slice( - blob.name.indexOf( + {blob[i].name.slice( + blob[i].name.indexOf( "_" ) + 1 )} ( {bytesToSize( - blob.contentLength + blob[i].contentLength )} ) diff --git a/components/utils/index.js b/components/utils/index.js index 45290bb1..bc6e7818 100644 --- a/components/utils/index.js +++ b/components/utils/index.js @@ -228,8 +228,8 @@ export const getProgressObj = ( "totalFields": formObj[key].fieldsTotal, "allFieldsComplete": titleList[key].value == "Upload documents" - ? _.has(props.props.appealType.fileList, "files") && - props.props.appealType.fileList.files.length > 0 + ? _.has(props.props.appealType.fileList, "value") && + props.props.appealType.fileList.value.length > 0 : rowCount == formObj[key].fieldsTotal, }; }); diff --git a/locales/en/myrepresentations.json b/locales/en/myrepresentations.json index 5c4ebbe4..474d890f 100644 --- a/locales/en/myrepresentations.json +++ b/locales/en/myrepresentations.json @@ -16,7 +16,7 @@ "add-files-label": "Add your files", "capacity-para-one": "This form enables you to submit comments on a case to Planning and Environment Decisions Wales.", "capacity-para-two": "Please note that comments from interested parties need to be made within the timetable. This can be found on the previous ‘Case Summary‘ page. Comments submitted after this date may be considered invalid.", - "capacity-select-your-details": "EiYour details", + "capacity-select-your-details": "Your details", "capacity-select-what-capacity-label": "In what capacity do you wish to make representations on this case?", "capacity-options-arr-appellant": "Appellant", "capacity-options-arr-agent": "Agent", diff --git a/pages/api/file/createappealcompletemessage_api.js b/pages/api/file/createappealcompletemessage_api.js index d86245e7..9818ce15 100644 --- a/pages/api/file/createappealcompletemessage_api.js +++ b/pages/api/file/createappealcompletemessage_api.js @@ -13,21 +13,25 @@ ApiProxy.use(middleware); ApiProxy.get(async (req, res) => { var containerName = req.query.container; var tempCaseRef = req.query.tempcaseref; + var checkHash = req.query.hash; console.log("/////Create Case Message:\n", tempCaseRef, "\n//////////////"); // console.log(hashAPIPath(checkquerypath), checkHash); // console.log(hashAPIPath(checkquerypath) == "&hash=" + checkHash); + var checkquerypath = + "/api/file/createappealcompletemessage_api?container=" + + containerName + + "&tempcaseref=" + + tempCaseRef; - if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { - await createCaseCompleteMessage(containerName, tempCaseRef).then( - (data) => { - return res.status(200).json(data); - } - ); - } else { - return res.status(400).json(); - } + //http: if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) { + await createCaseCompleteMessage(containerName, tempCaseRef).then((data) => { + return res.status(200).json(data); + }); + // } else { + // return res.status(400).json(); + // } }); export const config = {