view all delete button for awaiting submission
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { setCurrentReference } from "../../store/currentView/action";
|
||||
import { connect } from "react-redux";
|
||||
import { JSONPath as jsonpath } from "jsonpath-plus";
|
||||
import transLookup from "../../data/lookuptranslations.json";
|
||||
@@ -11,6 +10,32 @@ import {
|
||||
setSearchResults,
|
||||
setSearchDetails,
|
||||
} from "../../store/searchOutput/action";
|
||||
import { parseCookies, setCookie, destroyCookie } from "nookies";
|
||||
import {
|
||||
getWatchedCasesProxy,
|
||||
getPortalModuleDetailsProxy,
|
||||
deleteWatchedCases,
|
||||
deleteAwaitingSubmissions,
|
||||
deleteAwaitingSubmissionsFromBlob,
|
||||
getAwaitingSubmissionFromBlobProxy,
|
||||
getAwaitingSubmissionProxy,
|
||||
} from "../../actions";
|
||||
import { setAwaitingSubmissionFromBlob } from "../../store/awaitingSubmission/action";
|
||||
|
||||
import {
|
||||
setWatchedCases,
|
||||
setWatchedCasesDetails,
|
||||
} from "../../store/watchedCases/action";
|
||||
import {
|
||||
setAwaitingSubmission,
|
||||
setAwaitingSubmissionDetails,
|
||||
} from "../../store/awaitingSubmission/action";
|
||||
|
||||
import {
|
||||
setCurrentLinkedCases,
|
||||
setCurrentReference,
|
||||
setCurrentView,
|
||||
} from "../../store/currentView/action";
|
||||
|
||||
const ViewAllResults = (props) => {
|
||||
const {
|
||||
@@ -20,6 +45,9 @@ const ViewAllResults = (props) => {
|
||||
setCurrentReference,
|
||||
myportal,
|
||||
setSearchResults,
|
||||
accountDetails,
|
||||
setAwaitingSubmissionFromBlob,
|
||||
setAwaitingSubmissionDetails,
|
||||
} = props;
|
||||
|
||||
let { t } = useTranslation();
|
||||
@@ -541,6 +569,34 @@ const ViewAllResults = (props) => {
|
||||
"statuscode@OData.Community.Display.V1.FormattedValue"
|
||||
] || "N/A"}
|
||||
</dd>
|
||||
{currentView.viewKey == "awaitingSubmissionDetails" && (
|
||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 cardModuleItem ">
|
||||
<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"
|
||||
) +
|
||||
item.ticketnumber +
|
||||
"?\n" +
|
||||
t(
|
||||
"case:do-you-want-to-delete-case-disclaimer-label"
|
||||
)
|
||||
) &&
|
||||
deleteCaseItem(
|
||||
props.accountDetails.containerID,
|
||||
item.ticketnumber
|
||||
);
|
||||
}}
|
||||
>
|
||||
—
|
||||
</button>
|
||||
</dd>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
});
|
||||
@@ -590,6 +646,29 @@ const ViewAllResults = (props) => {
|
||||
};
|
||||
}
|
||||
|
||||
const deleteCaseItem = (containerID, caseID) => {
|
||||
let cookies = parseCookies();
|
||||
console.log("sssss", containerID, caseID);
|
||||
|
||||
deleteAwaitingSubmissionsFromBlob(containerID, caseID)
|
||||
.then((data) => {
|
||||
return data;
|
||||
})
|
||||
.then(() => {
|
||||
getAwaitingSubmissionFromBlobProxy(containerID)
|
||||
.then((data) => {
|
||||
setAwaitingSubmissionFromBlob(data);
|
||||
setAwaitingSubmissionDetails(data);
|
||||
})
|
||||
.then(() => {
|
||||
setCurrentView({
|
||||
"viewName": "Awaiting Submission",
|
||||
"viewKey": "awaitingSubmissionDetails",
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="govuk-grid-row">
|
||||
@@ -777,6 +856,15 @@ const ViewAllResults = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
// currentView: state.currentView,
|
||||
accountDetails: state.accountDetails,
|
||||
// search: state.search,
|
||||
// searchResultsObj: state.searchResultsObj,
|
||||
};
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
setCurrentReference: (currentReference) => {
|
||||
@@ -788,7 +876,13 @@ const mapDispatchToProps = (dispatch) => {
|
||||
setSearchDetails: (searchDetailsObj) => {
|
||||
dispatch(setSearchDetails(searchDetailsObj));
|
||||
},
|
||||
setAwaitingSubmissionFromBlob: (awaitingSubmission) => {
|
||||
dispatch(setAwaitingSubmissionFromBlob(awaitingSubmission));
|
||||
},
|
||||
setAwaitingSubmissionDetails: (awaitingSubmission) => {
|
||||
dispatch(setAwaitingSubmissionDetails(awaitingSubmission));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(null, mapDispatchToProps)(ViewAllResults);
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(ViewAllResults);
|
||||
|
||||
@@ -316,15 +316,28 @@ export const getProgressObj = (
|
||||
mandatoryFieldsData
|
||||
);
|
||||
|
||||
if (datafieldname[0].value == "pinswg_fileUpload") {
|
||||
return {
|
||||
"fieldType": fieldtype[0].value,
|
||||
"label": rows[0].value,
|
||||
"datafieldname": datafieldname[0].value,
|
||||
"key": key,
|
||||
"picklistData": props.props.formData.pickListData,
|
||||
"mandatoryFieldsData": mandatoryFieldsData,
|
||||
};
|
||||
if (datafieldname[0].value.includes("pinswg_fileUpload")) {
|
||||
if (typeof isRequiredField[0] != "undefined") {
|
||||
if (isRequiredField[0].RequiredLevel.Value != "None") {
|
||||
//console.log(datafieldname[0].value, validation);
|
||||
return {
|
||||
"fieldType": fieldtype[0].value,
|
||||
"label": rows[0].value,
|
||||
"datafieldname": datafieldname[0].value,
|
||||
"datafieldcontent": datafieldcontent,
|
||||
"validation": validation,
|
||||
};
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
"fieldType": fieldtype[0].value,
|
||||
"label": rows[0].value,
|
||||
"datafieldname": datafieldname[0].value,
|
||||
"key": key,
|
||||
"picklistData": props.props.formData.pickListData,
|
||||
"mandatoryFieldsData": mandatoryFieldsData,
|
||||
};
|
||||
}
|
||||
} else {
|
||||
if (typeof isRequiredField[0] != "undefined") {
|
||||
if (isRequiredField[0].RequiredLevel.Value != "None") {
|
||||
@@ -350,6 +363,14 @@ export const getProgressObj = (
|
||||
return el != null;
|
||||
});
|
||||
|
||||
rowObj = rowObj.filter(function (el) {
|
||||
return typeof el.validation != "undefined";
|
||||
});
|
||||
|
||||
rowObj = rowObj.filter(function (el) {
|
||||
return el.validation.indexOf("required") > -1;
|
||||
});
|
||||
|
||||
const filterUnwanted = (rowObj) => {
|
||||
const required = rowObj.filter((el) => {
|
||||
return !_.isEmpty(el.validation);
|
||||
|
||||
Reference in New Issue
Block a user