From 7cc9469b2b04170227ee612ed104821e6a28faa8 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Tue, 19 Aug 2025 12:35:00 +0100 Subject: [PATCH 1/3] added in a key to be used when right clicked on link --- components/myportal/awaitingsubmission.js | 4 +- .../myportal/awaitingsubmissionfromblob.js | 4 +- components/myportal/mycases.js | 4 +- components/myportal/myrepresentations.js | 4 +- .../myportal/myrepresentationsfromblob.js | 4 +- .../myportal/mysubmittedrepresentations.js | 4 +- components/myportal/viewall.js | 185 +++++++++--------- components/myportal/watchedcases.js | 4 +- 8 files changed, 104 insertions(+), 109 deletions(-) diff --git a/components/myportal/awaitingsubmission.js b/components/myportal/awaitingsubmission.js index ef5095df..12c4ee22 100644 --- a/components/myportal/awaitingsubmission.js +++ b/components/myportal/awaitingsubmission.js @@ -37,8 +37,8 @@ const AwaitingSubmission = (props) => { router.locale != "en" ? "/" + router.locale + - "/fymhorth/gweldpopeth" - : "/myportal/viewall" + "/fymhorth/gweldpopeth?key=awaitingSubmission" + : "/myportal/viewall?key=awaitingSubmission" } className="govuk-link--no-underline" onClick={() => { diff --git a/components/myportal/awaitingsubmissionfromblob.js b/components/myportal/awaitingsubmissionfromblob.js index 26baf861..33f9e6f4 100644 --- a/components/myportal/awaitingsubmissionfromblob.js +++ b/components/myportal/awaitingsubmissionfromblob.js @@ -354,8 +354,8 @@ const AwaitingSubmissionFromBlob = (props) => { router.locale != "en" ? "/" + router.locale + - "/fymhorth/gweldpopeth" - : "/myportal/viewall" + "/fymhorth/gweldpopeth?key=awaitingSubmissionDetails" + : "/myportal/viewall?key=awaitingSubmissionDetails" } className="govuk-link--no-underline" onClick={() => { diff --git a/components/myportal/mycases.js b/components/myportal/mycases.js index 97d09e4a..e8b3d19b 100644 --- a/components/myportal/mycases.js +++ b/components/myportal/mycases.js @@ -32,8 +32,8 @@ const MyCases = (props) => { router.locale != "en" ? "/" + router.locale + - "/fymhorth/gweldpopeth" - : "/myportal/viewall" + "/fymhorth/gweldpopeth?key=myCases" + : "/myportal/viewall?key=myCases" } className="govuk-link--no-underline" onClick={() => { diff --git a/components/myportal/myrepresentations.js b/components/myportal/myrepresentations.js index 54d2f555..17430582 100644 --- a/components/myportal/myrepresentations.js +++ b/components/myportal/myrepresentations.js @@ -37,8 +37,8 @@ const MyRepresentations = (props) => { router.locale != "en" ? "/" + router.locale + - "/fymhorth/gweldpopeth" - : "/myportal/viewall" + "/fymhorth/gweldpopeth?key=myRepresentations" + : "/myportal/viewall?key=myRepresentations" } className="govuk-link--no-underline" onClick={() => { diff --git a/components/myportal/myrepresentationsfromblob.js b/components/myportal/myrepresentationsfromblob.js index 4035c5fa..129cfd1e 100644 --- a/components/myportal/myrepresentationsfromblob.js +++ b/components/myportal/myrepresentationsfromblob.js @@ -36,8 +36,8 @@ const MyRepresentations = (props) => { router.locale != "en" ? "/" + router.locale + - "/fymhorth/gweldpopeth" - : "/myportal/viewall" + "/fymhorth/gweldpopeth?key=myRepresentations" + : "/myportal/viewall?key=myRepresentations" } className="govuk-link--no-underline" onClick={() => { diff --git a/components/myportal/mysubmittedrepresentations.js b/components/myportal/mysubmittedrepresentations.js index 8a6b2b0f..98d9bf0c 100644 --- a/components/myportal/mysubmittedrepresentations.js +++ b/components/myportal/mysubmittedrepresentations.js @@ -43,8 +43,8 @@ const MySubmittedReps = (props) => { router.locale != "en" ? "/" + router.locale + - "/fymhorth/gweldpopeth" - : "/myportal/viewall" + "/fymhorth/gweldpopeth?key=mySubmittedReps" + : "/myportal/viewall?key=mySubmittedReps" } className="govuk-link--no-underline" onClick={() => { diff --git a/components/myportal/viewall.js b/components/myportal/viewall.js index 11cc24c2..ae772292 100644 --- a/components/myportal/viewall.js +++ b/components/myportal/viewall.js @@ -76,19 +76,23 @@ const ViewAllResults = (props) => { return dateObj.toLocaleString(); }; - let currentView = props.currentView.currentView; - //console.log("currentView.viewKey:", typeof currentView.viewKey); + let viewKeyFromUrl = router.query.key; - // typeof currentView.viewKey == "undefined" + let currentView = props.currentView.currentView; + //console.log("currentViewKey:", typeof currentViewKey); + + // typeof currentViewKey == "undefined" // ? console.log("no currentview") // : console.log("has currentview"); + let currentViewKey = currentView.viewKey || viewKeyFromUrl; + var resultsArr = - currentView.viewKey == "awaitingSubmissionDetails" + currentViewKey == "awaitingSubmissionDetails" ? props["awaitingSubmission"].awaitingSubmissionDetails.case - : currentView.viewKey == "mySubmittedReps" - ? props[currentView.viewKey][currentView.viewKey] - : props[currentView.viewKey][currentView.viewKey].value || []; + : currentViewKey == "mySubmittedReps" + ? props[currentViewKey][currentViewKey] + : props[currentViewKey][currentViewKey].value || []; const [orderByState, setOrderbyState] = useState("createdon"); const [fieldSortState, setfieldSortState] = useState("asc"); @@ -105,11 +109,11 @@ const ViewAllResults = (props) => { } var searchDetailsObj = - currentView.viewKey == "awaitingSubmissionDetails" + currentViewKey == "awaitingSubmissionDetails" ? props["awaitingSubmission"].awaitingSubmissionDetails.value - : currentView.viewKey == "myRepresentations" + : currentViewKey == "myRepresentations" ? props["myRepresentations"].myRepresentations.value - : props[currentView.viewKey][currentView.viewKey + "Details"] || []; + : props[currentViewKey][currentViewKey + "Details"] || []; let resultsRowArr = []; const buildResultsRowArr = () => { @@ -117,15 +121,13 @@ const ViewAllResults = (props) => { let detailsObj = jsonpath({ path: "$" + - (currentView.viewKey == "myRepresentations" - ? "" - : "..value") + + (currentViewKey == "myRepresentations" ? "" : "..value") + '[?(@ && @.pinswg_name=="' + - (currentView.viewKey == "awaitingSubmissionDetails" + (currentViewKey == "awaitingSubmissionDetails" ? item.title - : currentView.viewKey == "watchedCases" + : currentViewKey == "watchedCases" ? item.ticketnumber - : currentView.viewKey == "myRepresentations" + : currentViewKey == "myRepresentations" ? item.pinswg_name : item.pinswg_title) + '")]', @@ -137,7 +139,7 @@ const ViewAllResults = (props) => { //console.log(searchDetailsObj[key]); // searchDetailsObj[key] = - // currentView.viewKey == "myRepresentations" + // currentViewKey == "myRepresentations" // ? searchDetailsObj[key].value[0] // : searchDetailsObj[key]; @@ -145,7 +147,7 @@ const ViewAllResults = (props) => { resultsRowArr.push(
- {currentView.viewKey == "myCases" && + {currentViewKey == "myCases" && resultsArr[key].pinswg_publishtoweb === false ? (
{resultsArr[key].ticketnumber}{" "} @@ -155,8 +157,7 @@ const ViewAllResults = (props) => { <> { .repfile_name, }, } - : currentView.viewKey == + : currentViewKey == "awaitingSubmissionDetails" ? router.locale == "cy" ? "/fymhorth/parhauigyflwyno" @@ -191,25 +192,25 @@ const ViewAllResults = (props) => { "&inid=" + resultsArr[key].incidentid + "&key=" + - currentView.viewKey + currentViewKey : router.locale == "cy" ? myportal == true ? "/fymhorth/achos" + resultsArr[key].ticketnumber + "?key=" + - currentView.viewKey + currentViewKey : "/achos" + resultsArr[key].ticketnumber : myportal == true ? "/myportal/case/" + resultsArr[key].ticketnumber + "?key=" + - currentView.viewKey + currentViewKey : "/case/" + resultsArr[key].ticketnumber } onClick={() => { - currentView.viewKey == "watchedCases" && + currentViewKey == "watchedCases" && setSearchResults( props.watchedCases.watchedCases ), @@ -222,9 +223,9 @@ const ViewAllResults = (props) => { resultsArr[key] .ticketnumber, "currentReference": - currentView.viewKey != + currentViewKey != "watchedCases" - ? currentView.viewKey == + ? currentViewKey == "myRepresentations" ? resultsArr[key] .caseRef @@ -234,10 +235,9 @@ const ViewAllResults = (props) => { "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" ], - "currentType": - currentView.viewKey, + "currentType": currentViewKey, "incidentid": - currentView.viewKey != + currentViewKey != "watchedCases" ? resultsArr[key] .incidentid @@ -249,14 +249,14 @@ const ViewAllResults = (props) => { resultsArr[key] .pinswg_appealcasetype, "repDetails": - currentView.viewKey == + currentViewKey == "myRepresentations" && resultsArr[key], }), setCurrentView({ "viewName": currentView.viewName, - "viewKey": currentView.viewKey, + "viewKey": currentViewKey, }); }} > @@ -266,11 +266,10 @@ const ViewAllResults = (props) => { )} : - {currentView.viewKey != "watchedCases" - ? currentView.viewKey == - "myRepresentations" + {currentViewKey != "watchedCases" + ? currentViewKey == "myRepresentations" ? resultsArr[key].caseRef - : currentView.viewKey == + : currentViewKey == "awaitingSubmissionDetails" ? resultsArr[key].title : resultsArr[key].pinswg_title @@ -278,7 +277,7 @@ const ViewAllResults = (props) => { "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" ]} - {currentView.viewKey == "myRepresentations" && ( + {currentViewKey == "myRepresentations" && ( <>
@@ -296,14 +295,14 @@ const ViewAllResults = (props) => { {t("search:searchresults-site-address-label")}: - {currentView.viewKey == "awaitingSubmissionDetails" && + {currentViewKey == "awaitingSubmissionDetails" && _.has(searchDetailsObj[key], "pinswg_siteaddressline1") ? searchDetailsObj[key].pinswg_siteaddressline1 : ""} {_.has(detailsObj, "pinswg_siteaddressline1") ? detailsObj.pinswg_siteaddressline1 : ""} - {currentView.viewKey == "myRepresentations" && + {currentViewKey == "myRepresentations" && _.has(searchDetailsObj[key].pinswg_siteaddressline1) ? searchDetailsObj[key].value[0] .pinswg_siteaddressline1 @@ -311,14 +310,14 @@ const ViewAllResults = (props) => { {_.has(detailsObj, "pinswg_siteaddressline1") ? detailsObj.pinswg_siteaddressline1 : ""} - {currentView.viewKey == "awaitingSubmissionDetails" && + {currentViewKey == "awaitingSubmissionDetails" && _.has( searchDetailsObj[key], "pinswg_siteaddressline1" ) && searchDetailsObj[key].pinswg_siteaddressline1 != null &&
} - {currentView.viewKey == "myRepresentations" && + {currentViewKey == "myRepresentations" && _.has( searchDetailsObj[key].pinswg_siteaddressline1 ) && @@ -328,25 +327,25 @@ const ViewAllResults = (props) => { detailsObj.pinswg_siteaddressline1 != null && (
)} - {currentView.viewKey == "awaitingSubmissionDetails" && + {currentViewKey == "awaitingSubmissionDetails" && _.has(searchDetailsObj[key], "pinswg_siteaddressline1") ? searchDetailsObj[key].pinswg_siteaddressline2 : ""} - {currentView.viewKey == "myRepresentations" && + {currentViewKey == "myRepresentations" && _.has(searchDetailsObj[key].pinswg_siteaddressline1) ? searchDetailsObj[key].pinswg_siteaddressline2 : ""} {_.has(detailsObj, "pinswg_siteaddressline1") ? detailsObj.pinswg_siteaddressline2 : ""} - {currentView.viewKey == "awaitingSubmissionDetails" && + {currentViewKey == "awaitingSubmissionDetails" && _.has( searchDetailsObj[key], "pinswg_siteaddressline2" ) && searchDetailsObj[key].pinswg_siteaddressline2 != null &&
} - {currentView.viewKey == "myRepresentations" && + {currentViewKey == "myRepresentations" && _.has( searchDetailsObj[key].pinswg_siteaddressline2 ) && @@ -356,25 +355,25 @@ const ViewAllResults = (props) => { detailsObj.pinswg_siteaddressline2 != null && (
)} - {currentView.viewKey == "awaitingSubmissionDetails" && + {currentViewKey == "awaitingSubmissionDetails" && _.has(searchDetailsObj[key], "pinswg_siteaddresstown") ? searchDetailsObj[key].pinswg_siteaddresstown : ""} - {currentView.viewKey == "myRepresentations" && + {currentViewKey == "myRepresentations" && _.has(searchDetailsObj[key], "pinswg_siteaddresstown") ? searchDetailsObj[key].pinswg_siteaddresstown : ""} {_.has(detailsObj, "pinswg_siteaddresstown") ? detailsObj.pinswg_siteaddresstown : ""} - {currentView.viewKey == "awaitingSubmissionDetails" && + {currentViewKey == "awaitingSubmissionDetails" && _.has( searchDetailsObj[key], "pinswg_siteaddresstown" ) && searchDetailsObj[key].pinswg_siteaddresstown != null &&
} - {currentView.viewKey == "myRepresentations" && + {currentViewKey == "myRepresentations" && _.has( searchDetailsObj[key], "pinswg_siteaddresstown" @@ -383,18 +382,18 @@ const ViewAllResults = (props) => { null &&
} {_.has(detailsObj, "pinswg_siteaddresstown") && detailsObj.pinswg_siteaddresstown != null &&
} - {currentView.viewKey == "awaitingSubmissionDetails" && + {currentViewKey == "awaitingSubmissionDetails" && _.has(searchDetailsObj[key], "pinswg_siteaddresscounty") ? searchDetailsObj[key].pinswg_siteaddresscounty : ""} - {currentView.viewKey == "myRepresentations" && + {currentViewKey == "myRepresentations" && _.has(searchDetailsObj[key], "pinswg_siteaddresscounty") ? searchDetailsObj[key].pinswg_siteaddresscounty : ""} {_.has(detailsObj, "pinswg_siteaddresscounty") ? detailsObj.pinswg_siteaddresscounty : ""} - {currentView.viewKey == "awaitingSubmissionDetails" && + {currentViewKey == "awaitingSubmissionDetails" && _.has( searchDetailsObj[key], "pinswg_siteaddresscounty" @@ -405,7 +404,7 @@ const ViewAllResults = (props) => { detailsObj.pinswg_siteaddresscounty != null && (
)} - {currentView.viewKey == "awaitingSubmissionDetails" && + {currentViewKey == "awaitingSubmissionDetails" && _.has( searchDetailsObj[key], "pinswg_siteaddresspostcode" @@ -431,10 +430,9 @@ const ViewAllResults = (props) => { "pinswg_siteaddresspostcode", ].map((field, idx) => { const isAwaitingSubmission = - currentView.viewKey === - "awaitingSubmissionDetails"; + currentViewKey === "awaitingSubmissionDetails"; const isMyRepresentations = - currentView.viewKey === "myRepresentations"; + currentViewKey === "myRepresentations"; const searchValue = _.get( searchDetailsObj, `${key}.${field}` @@ -462,11 +460,11 @@ const ViewAllResults = (props) => {
- {currentView.viewKey == "awaitingSubmissionDetails" + {currentViewKey == "awaitingSubmissionDetails" ? t("search:searchresults-created-on-label") : t("search:searchresults-applicant-label")} - {currentView.viewKey == "awaitingSubmissionDetails" + {currentViewKey == "awaitingSubmissionDetails" ? formatDates(item.createdon) : _.has(detailsObj, [ "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue", @@ -474,7 +472,7 @@ const ViewAllResults = (props) => { ? detailsObj[ "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" ] - : currentView.viewKey == "myRepresentations" + : currentViewKey == "myRepresentations" ? searchDetailsObj[key][ "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" ] @@ -486,7 +484,7 @@ const ViewAllResults = (props) => { {t("search:searchresults-authority-label")}: - {currentView.viewKey == "awaitingSubmissionDetails" && + {currentViewKey == "awaitingSubmissionDetails" && _.has(resultsArr[key], "pinswg_lpaname") ? router.locale == "cy" ? jsonpath({ @@ -531,7 +529,7 @@ const ViewAllResults = (props) => { json: transLookup, eval: true, }) - : currentView.viewKey == "myRepresentations" + : currentViewKey == "myRepresentations" ? searchDetailsObj[key].value : searchDetailsObj[key].value[0][ "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" @@ -554,10 +552,10 @@ const ViewAllResults = (props) => { : resultsArr[key][ "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" ] || - (currentView.viewKey == "myRepresentations" + (currentViewKey == "myRepresentations" ? "" : "N/A") - : currentView.viewKey == "myRepresentations" && + : currentViewKey == "myRepresentations" && router.locale == "cy" && jsonpath({ path: @@ -575,7 +573,7 @@ const ViewAllResults = (props) => { {t("search:searchresults-case-type-label")}: - {currentView.viewKey == "awaitingSubmissionDetails" + {currentViewKey == "awaitingSubmissionDetails" ? router.locale == "cy" ? jsonpath({ path: @@ -604,11 +602,11 @@ const ViewAllResults = (props) => { : item[ "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" ] || - (currentView.viewKey == "myRepresentations" + (currentViewKey == "myRepresentations" ? "" : "N/A")} - {currentView.viewKey == "myRepresentations" && + {currentViewKey == "myRepresentations" && (router.locale == "cy" ? jsonpath({ path: @@ -630,13 +628,13 @@ const ViewAllResults = (props) => {
- {currentView.viewKey == "myRepresentations" + {currentViewKey == "myRepresentations" ? "Created" : t("search:searchresults-status-label")} : - {currentView.viewKey == "awaitingSubmissionDetails" + {currentViewKey == "awaitingSubmissionDetails" ? router.locale == "cy" ? jsonpath({ path: @@ -654,7 +652,7 @@ const ViewAllResults = (props) => { json: transLookup, eval: true, }) || "N/A" - : currentView.viewKey == "myRepresentations" + : currentViewKey == "myRepresentations" ? repRaisedDate(item.repfile_name) // ? router.locale == "cy" : // ? jsonpath({path: // @@ -692,7 +690,7 @@ const ViewAllResults = (props) => { "statuscode@OData.Community.Display.V1.FormattedValue" ] || "N/A"}
- {currentView.viewKey == "awaitingSubmissionDetails" && ( + {currentViewKey == "awaitingSubmissionDetails" && (
)} - {currentView.viewKey == "myRepresentations" && ( + {currentViewKey == "myRepresentations" && (
)} - {currentView.viewKey == "watchedCases" && ( + {currentViewKey == "watchedCases" && (
- {currentView.viewKey == + {currentViewKey == "awaitingSubmissionDetails" ? (
- {currentView.viewKey != + {currentViewKey != "awaitingSubmissionDetails" ? (
- {currentView.viewKey == - "myRepresentations" ? ( + {currentViewKey == "myRepresentations" ? (
- {(currentView.viewKey == "watchedCases" || - currentView.viewKey == + {(currentViewKey == "watchedCases" || + currentViewKey == "awaitingSubmissionDetails" || - currentView.viewKey == - "myRepresentations") && ( + currentViewKey == "myRepresentations") && (
)}
diff --git a/components/myportal/watchedcases.js b/components/myportal/watchedcases.js index 40a328c2..a3ee65ec 100644 --- a/components/myportal/watchedcases.js +++ b/components/myportal/watchedcases.js @@ -44,8 +44,8 @@ const WatchedCases = (props) => { router.locale != "en" ? "/" + router.locale + - "/fymhorth/gweldpopeth" - : "/myportal/viewall" + "/fymhorth/gweldpopeth?key=watchedCases" + : "/myportal/viewall?key=watchedCases" } className="govuk-link--no-underline" onClick={() => { From 0b070de9f798188ab8aa696e526c170172dcaae1 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Tue, 19 Aug 2025 12:35:29 +0100 Subject: [PATCH 2/3] updated breadcrumb when key is used --- components/breadcrumbs.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/components/breadcrumbs.js b/components/breadcrumbs.js index e6209cb6..e04a37bc 100644 --- a/components/breadcrumbs.js +++ b/components/breadcrumbs.js @@ -475,23 +475,26 @@ const Breadcrumbs = (props) => {
  • - {currentView.currentView.viewKey == + {(currentView.currentView.viewKey || + router.query.key) == "awaitingSubmissionDetails" && t( "myportal:awatitingsubmission-card-title" )} - {currentView.currentView.viewKey == - "watchedCases" && + {(currentView.currentView.viewKey || + router.query.key) == "watchedCases" && t("myportal:watchedcases-card-title")} - {currentView.currentView.viewKey == - "myCases" && + {(currentView.currentView.viewKey || + router.query.key) == "myCases" && t("myportal:mycases-card-title")} - {currentView.currentView.viewKey == + {(currentView.currentView.viewKey || + router.query.key) == "myRepresentations" && t( "myportal:myrepresentations-card-title" )} - {currentView.currentView.viewKey == + {(currentView.currentView.viewKey || + router.query.key) == "mySubmittedReps" && "Submitted representations"}
  • From 9a3201792cc02c308d95c80f2c2834ed7f4be98d Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Tue, 19 Aug 2025 12:35:51 +0100 Subject: [PATCH 3/3] removed link for res awiating submissin making it onclick instead --- components/myportal/topthree_reps.js | 47 +++++++++++++++++++--------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/components/myportal/topthree_reps.js b/components/myportal/topthree_reps.js index aa40f0de..e048770b 100644 --- a/components/myportal/topthree_reps.js +++ b/components/myportal/topthree_reps.js @@ -193,21 +193,26 @@ const TopThree = (props) => { {showTopThreeArr[key].hasOwnProperty("repComplete") ? ( {showTopThreeArr[key].pinswg_name} ) : ( - { setCurrentReference({ @@ -223,10 +228,24 @@ const TopThree = (props) => { "repDetails": showTopThreeArr[key], }); isLPA && setRepresentationCapacity("LPA"); + router.push({ + pathname: + router.locale == "cy" + ? "/fymhorth/representation" + : "/myportal/representation", + query: { + case: showTopThreeArr[key] + .ticketnumber, + state: "edit", + created: + showTopThreeArr[key] + .repfile_name, + }, + }); }} > {showTopThreeArr[key].pinswg_name} - + )} {!showTopThreeArr[key].hasOwnProperty( "repComplete"