delete reps on dash
This commit is contained in:
@@ -9,12 +9,13 @@ import {
|
||||
getAwaitingSubmissionProxy,
|
||||
getPortalModuleDetailsProxy,
|
||||
getWatchedCasesProxy,
|
||||
deleteMyRepresentationsFromBlob,
|
||||
getRepsFromBlobProxy,
|
||||
} from "../../actions";
|
||||
import {
|
||||
setAwaitingSubmission,
|
||||
setAwaitingSubmissionDetails,
|
||||
} from "../../store/awaitingSubmission/action";
|
||||
import { setCurrentReference } from "../../store/currentView/action";
|
||||
import {
|
||||
setWatchedCases,
|
||||
setWatchedCasesDetails,
|
||||
@@ -22,6 +23,17 @@ import {
|
||||
import { getFormCollectionByID } from "../utils";
|
||||
import { JSONPath as jsonpath } from "jsonpath-plus";
|
||||
import transLookup from "../../data/lookuptranslations.json";
|
||||
import {
|
||||
setMyRepresentations,
|
||||
setMyRepresentationsDetails,
|
||||
setMySubmittedReps,
|
||||
setMySubmittedRepsDetails,
|
||||
} from "../../store/myRepresentations/action";
|
||||
import {
|
||||
setCurrentLinkedCases,
|
||||
setCurrentReference,
|
||||
setCurrentView,
|
||||
} from "../../store/currentView/action";
|
||||
|
||||
const TopThree = (props) => {
|
||||
let { t } = useTranslation();
|
||||
@@ -34,6 +46,8 @@ const TopThree = (props) => {
|
||||
setWatchedCasesDetails,
|
||||
setAwaitingSubmission,
|
||||
setAwaitingSubmissionDetails,
|
||||
setMyRepresentations,
|
||||
setMyRepresentationsDetails,
|
||||
} = props;
|
||||
|
||||
const router = useRouter();
|
||||
@@ -93,6 +107,33 @@ const TopThree = (props) => {
|
||||
});
|
||||
};
|
||||
|
||||
const deleteRepItem = (containerID, caseID, repfile) => {
|
||||
let cookies = parseCookies();
|
||||
console.log("sssss", containerID, caseID, repfile);
|
||||
|
||||
deleteMyRepresentationsFromBlob(containerID, caseID, repfile)
|
||||
.then((data) => {
|
||||
return data;
|
||||
})
|
||||
.then(() => {
|
||||
getRepsFromBlobProxy(containerID)
|
||||
.then((data) => {
|
||||
setMyRepresentations(data);
|
||||
setMyRepresentationsDetails(data);
|
||||
})
|
||||
.catch((err) => {
|
||||
consoleLogger(err);
|
||||
res.status(400).json(err);
|
||||
})
|
||||
.then(() => {
|
||||
setCurrentView({
|
||||
"viewName": "My Representations",
|
||||
"viewKey": "myRepresentations",
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const getDetails = (resultsObj, detailsType) => {
|
||||
//console.log(resultsObj);
|
||||
let detailsArr = [];
|
||||
@@ -247,6 +288,29 @@ const TopThree = (props) => {
|
||||
] || ""}
|
||||
</div>
|
||||
</div>
|
||||
<div className="">
|
||||
<button
|
||||
title={t("case:do-you-want-to-delete-case-label")}
|
||||
className=" cardModuleRemoveCase govuk-link govuk-link--no-underline govuk-link--inverse "
|
||||
onClick={() => {
|
||||
confirm(
|
||||
t("case:do-you-want-to-delete-case-label") +
|
||||
showTopThreeArr[key].pinswg_name +
|
||||
"?\n" +
|
||||
t(
|
||||
"case:do-you-want-to-delete-case-disclaimer-label"
|
||||
)
|
||||
) &&
|
||||
deleteRepItem(
|
||||
props.accountDetails.containerID,
|
||||
showTopThreeArr[key].pinswg_name,
|
||||
showTopThreeArr[key].repfile_name
|
||||
);
|
||||
}}
|
||||
>
|
||||
—
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
@@ -276,6 +340,14 @@ const TopThree = (props) => {
|
||||
</>
|
||||
);
|
||||
};
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
// currentView: state.currentView,
|
||||
accountDetails: state.accountDetails,
|
||||
// search: state.search,
|
||||
// searchResultsObj: state.searchResultsObj,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
@@ -294,7 +366,13 @@ const mapDispatchToProps = (dispatch) => {
|
||||
setAwaitingSubmissionDetails: (awaitingSubmissionDetails) => {
|
||||
dispatch(setAwaitingSubmissionDetails(awaitingSubmissionDetails));
|
||||
},
|
||||
setMyRepresentations: (myRepresentations) => {
|
||||
dispatch(setMyRepresentations(myRepresentations));
|
||||
},
|
||||
setMyRepresentationsDetails: (myRepresentationsDetails) => {
|
||||
dispatch(setMyRepresentationsDetails(myRepresentationsDetails));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(null, mapDispatchToProps)(TopThree);
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(TopThree);
|
||||
|
||||
@@ -620,7 +620,7 @@ const ViewAllResults = (props) => {
|
||||
</button>
|
||||
</dd>
|
||||
)}
|
||||
{/* {currentView.viewKey == "myRepresentations" && (
|
||||
{currentView.viewKey == "myRepresentations" && (
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 cardModuleItem ">
|
||||
<button
|
||||
title={t(
|
||||
@@ -648,7 +648,7 @@ const ViewAllResults = (props) => {
|
||||
—
|
||||
</button>
|
||||
</dd>
|
||||
)} */}
|
||||
)}
|
||||
{currentView.viewKey == "watchedCases" && (
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 cardModuleItem ">
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user