diff --git a/actions/index.js b/actions/index.js index 56bcb920..68b8226e 100644 --- a/actions/index.js +++ b/actions/index.js @@ -921,6 +921,32 @@ export const getRepsFromBlob = (containerName) => { }); }; +export const getRepsFromBlobProxy = (containerName) => { + console.log( + "///////////////////////getRepsFromBlobProxy: " + containerName, + "/api/file/getawaitingsubmissionfromblobproxy?container=" + + containerName, + "\n///////////////////////\n" + ); + + return axios + .get( + // BASE_URL + + "/api/file/getrepsblobproxy?container=" + containerName + // + + // hashAPIPath( + // "/api/file/getawaitingsubmissionfromblob?container=" + + // containerName + // ) + ) + .then((res) => { + return res.data; + }) + .catch((error) => { + consoleLogger(error); + }); +}; + export const getAwaitingSubmissionFromBlobProxy = (containerName) => { console.log( "///////////////////////getAwaitingSubmissionFromBlobProxy: " + @@ -1324,6 +1350,34 @@ export const deleteAwaitingSubmissionsFromBlob = ( }); }; +export const deleteMyRepresentationsFromBlob = ( + containerID, + casefolderID, + repfile +) => { + var queryUrl = + "/api/file/deleteblobrep?container=" + + containerID + + "&casefolderID=" + + casefolderID + + "&repfile=" + + repfile; + + var config = { + method: "get", + url: queryUrl, + }; + //console.log(config); + return axios(config) + .then((res) => { + //console.log("deleted ", res.data); + return res.data; + }) + .catch((error) => { + console.log("this serror", error); + }); +}; + export const deleteWatchedCases = (watchedCaseID) => { var queryUrl = "/api/endpoint/deletewatchedcases_api?watchedCaseID=" + watchedCaseID; diff --git a/components/breadcrumbs.js b/components/breadcrumbs.js index 025caf4c..b25b860e 100644 --- a/components/breadcrumbs.js +++ b/components/breadcrumbs.js @@ -4,11 +4,17 @@ import _ from "lodash"; import { useState } from "react"; import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; +import { useDispatch, useSelector, shallowEqual, connect } from "react-redux"; import { getSession, useSession } from "next-auth/react"; +import { + setCurrentLinkedCases, + setCurrentReference, + setCurrentView, +} from "../store/currentView/action"; const Breadcrumbs = (props) => { - const { courseContent, slug, currentView } = props; + const { courseContent, slug, currentView, setCurrentView } = props; const router = useRouter(); const { appealType, section } = router.query; @@ -456,16 +462,18 @@ const Breadcrumbs = (props) => {
  • - {currentView.viewKey == + {currentView.currentView.viewKey == "awaitingSubmissionDetails" && t( "myportal:awatitingsubmission-card-title" )} - {currentView.viewKey == "watchedCases" && + {currentView.currentView.viewKey == + "watchedCases" && t("myportal:watchedcases-card-title")} - {currentView.viewKey == "myCases" && + {currentView.currentView.viewKey == + "myCases" && t("myportal:mycases-card-title")} - {currentView.viewKey == + {currentView.currentView.viewKey == "myRepresentations" && t( "myportal:myrepresentations-card-title" @@ -491,7 +499,7 @@ const Breadcrumbs = (props) => { {t("common:breadcrumb-my-portal")}
  • -
  • + {/*
  • { : "/myportal/viewall" } className="govuk-breadcrumbs__link" + onClick={() => { + setCurrentView({ + "viewName": + "Awaiting Submission", + "viewKey": + "awaitingSubmissionDetails", + }); + }} > {t("common:breadcrumb-your-cases")} -
  • + */}
  • {t("common:breadcrumb-case-reference")}:{" "} { @@ -648,6 +664,35 @@ const Breadcrumbs = (props) => { ) : ( "" )} + + {router.pathname == "/myportal/case/[ticketnumber]" ? ( + <> + {" "} +
  • + + {t("common:breadcrumb-my-portal")} + +
  • +
  • + {t("common:breadcrumb-case-reference")}:{" "} + { + props.props.currentView.caseReference + .currentReference + } +
  • + + ) : ( + "" + )} {router.pathname == "/myportal/dnsapplications" ? ( <> {" "} @@ -764,8 +809,15 @@ const Breadcrumbs = (props) => { @@ -1080,4 +1132,19 @@ const Breadcrumbs = (props) => { ); }; -export default Breadcrumbs; + +const mapStateToProps = (state) => { + return { + ...state, + }; +}; + +const mapDispatchToProps = (dispatch) => { + return { + setCurrentView: (currentView) => { + dispatch(setCurrentView(currentView)); + }, + }; +}; + +export default connect(mapStateToProps, mapDispatchToProps)(Breadcrumbs); diff --git a/components/myportal/awaitingsubmissionfromblob.js b/components/myportal/awaitingsubmissionfromblob.js index a006b721..c3796104 100644 --- a/components/myportal/awaitingsubmissionfromblob.js +++ b/components/myportal/awaitingsubmissionfromblob.js @@ -16,6 +16,10 @@ import { import { setAwaitingSubmissionFromBlob } from "../../store/awaitingSubmission/action"; import { parseCookies, setCookie, destroyCookie } from "nookies"; import { getFormCollectionByID } from "../../components/utils"; +import { + setAwaitingSubmission, + setAwaitingSubmissionDetails, +} from "../../store/awaitingSubmission/action"; const AwaitingSubmissionFromBlob = (props) => { let { t } = useTranslation(); @@ -55,6 +59,7 @@ const AwaitingSubmissionFromBlob = (props) => { .then(() => { getAwaitingSubmissionFromBlobProxy(containerID).then((data) => { props.setAwaitingSubmissionFromBlob(data); + props.setAwaitingSubmissionDetails(data); }); }); }; @@ -350,6 +355,9 @@ const mapDispatchToProps = (dispatch) => { setAwaitingSubmissionFromBlob: (awaitingSubmission) => { dispatch(setAwaitingSubmissionFromBlob(awaitingSubmission)); }, + setAwaitingSubmissionDetails: (awaitingSubmissionDetails) => { + dispatch(setAwaitingSubmissionDetails(awaitingSubmissionDetails)); + }, }; }; diff --git a/components/myportal/viewall.js b/components/myportal/viewall.js index 392c0e6e..800286da 100644 --- a/components/myportal/viewall.js +++ b/components/myportal/viewall.js @@ -17,8 +17,10 @@ import { deleteWatchedCases, deleteAwaitingSubmissions, deleteAwaitingSubmissionsFromBlob, + deleteMyRepresentationsFromBlob, getAwaitingSubmissionFromBlobProxy, getAwaitingSubmissionProxy, + getRepsFromBlobProxy, } from "../../actions"; import { setAwaitingSubmissionFromBlob } from "../../store/awaitingSubmission/action"; @@ -36,6 +38,12 @@ import { setCurrentReference, setCurrentView, } from "../../store/currentView/action"; +import { + setMyRepresentations, + setMyRepresentationsDetails, + setMySubmittedReps, + setMySubmittedRepsDetails, +} from "../../store/myRepresentations/action"; const ViewAllResults = (props) => { const { @@ -48,6 +56,10 @@ const ViewAllResults = (props) => { accountDetails, setAwaitingSubmissionFromBlob, setAwaitingSubmissionDetails, + setWatchedCasesDetails, + setWatchedCases, + setMyRepresentations, + setMyRepresentationsDetails, } = props; let { t } = useTranslation(); @@ -101,10 +113,19 @@ const ViewAllResults = (props) => { const buildResultsRowArr = () => { resultsArr.map((item, key) => { let detailsObj = jsonpath( - '$..value[?(@.pinswg_name=="' + currentView.viewKey == - "awaitingSubmissionDetails" - ? item.title - : item.pinswg_title + '")]', + "$" + + (currentView.viewKey == "myRepresentations" + ? "" + : "..value") + + '[?(@.pinswg_name=="' + + (currentView.viewKey == "awaitingSubmissionDetails" + ? item.title + : currentView.viewKey == "watchedCases" + ? item.ticketnumber + : currentView.viewKey == "myRepresentations" + ? item.pinswg_name + : item.pinswg_title) + + '")]', searchDetailsObj ); detailsObj = detailsObj[0]; @@ -163,8 +184,10 @@ const ViewAllResults = (props) => { ? "/fymhorth/achos" : "/achos" : myportal == true - ? "/myportal/case" - : "/case" + ? "/myportal/case/" + + resultsArr[key].ticketnumber + : "/case/" + + resultsArr[key].ticketnumber } onClick={() => { setCurrentReference({ @@ -589,7 +612,62 @@ const ViewAllResults = (props) => { ) && deleteCaseItem( props.accountDetails.containerID, - item.ticketnumber + item.pinswg_name + ); + }} + > + — + + + )} + {/* {currentView.viewKey == "myRepresentations" && ( +
    + +
    + )} */} + {currentView.viewKey == "watchedCases" && ( +
    +