Added service stage status and delete functions

This commit is contained in:
2022-01-25 10:09:11 +00:00
parent 10f2baa7be
commit f347a0d73b
27 changed files with 575 additions and 125 deletions
+64 -3
View File
@@ -9,12 +9,18 @@ import {
getWatchedCasesProxy,
getPortalModuleDetailsProxy,
deleteWatchedCases,
deleteAwaitingSubmissions,
getAwaitingSubmissionProxy,
} from "../../actions";
import {
setWatchedCases,
setWatchedCasesDetails,
} from "../../store/watchedCases/action";
import {
setAwaitingSubmission,
setAwaitingSubmissionDetails,
} from "../../store/awaitingSubmission/action";
import { getFormCollectionByID } from "../../components/utils";
const TopThree = (props) => {
@@ -26,6 +32,8 @@ const TopThree = (props) => {
topThreeType,
setWatchedCases,
setWatchedCasesDetails,
setAwaitingSubmission,
setAwaitingSubmissionDetails,
} = props;
const router = useRouter();
@@ -37,6 +45,7 @@ const TopThree = (props) => {
const deleteItem = (caseID, topThreeType) => {
let cookies = parseCookies();
//console.log("sssss", caseID, topThreeType);
topThreeType == "watchedCases" &&
deleteWatchedCases(caseID)
.then((data) => data)
@@ -48,6 +57,32 @@ const TopThree = (props) => {
});
});
});
topThreeType == "awaitingSubmission" &&
deleteAwaitingSubmissions(caseID)
.then((data) => {
console.log("zzzzz");
return data;
})
.then(() => {
console.log("qqqqqq");
getAwaitingSubmissionProxy(cookies.pinsUser).then(
(data) => {
console.log("assss", data);
setAwaitingSubmission(data),
getDetails(data, "awaitingSubmission").then(
(data) => {
console.log(
"submission get details:",
data
);
setAwaitingSubmissionDetails(data);
}
);
}
);
});
};
const getDetails = (resultsObj, detailsType) => {
@@ -94,6 +129,7 @@ const TopThree = (props) => {
return objArr.ticketnumber;
break;
case "awaitingSubmission":
return objArr.ticketnumber;
break;
default:
// code block
@@ -183,14 +219,12 @@ const TopThree = (props) => {
{topThreeType == "awaitingSubmission" ? (
<div className="carModuleAddress">
Make Representation on Case Incomplete, not
submitted
Case Incomplete, not submitted
</div>
) : (
""
)}
</div>
{topThreeType == "watchedCases" && (
<div className="">
<a
@@ -214,6 +248,27 @@ const TopThree = (props) => {
</a>
</div>
)}
{topThreeType == "awaitingSubmission" && (
<div className="">
<a
href="#"
className=" cardModuleRemoveCase govuk-link govuk-link--no-underline govuk-link--inverse "
onClick={() => {
event.preventDefault();
deleteItem(
showTopThreeArr[key].incidentid,
"awaitingSubmission"
);
alert(
"You have deleted case " +
showTopThreeArr[key].ticketnumber
);
}}
>
&mdash;
</a>
</div>
)}
</div>
);
});
@@ -255,6 +310,12 @@ const mapDispatchToProps = (dispatch) => {
setWatchedCasesDetails: (watchedCasesDetails) => {
dispatch(setWatchedCasesDetails(watchedCasesDetails));
},
setAwaitingSubmission: (awaitingSubmission) => {
dispatch(setAwaitingSubmission(awaitingSubmission));
},
setAwaitingSubmissionDetails: (awaitingSubmissionDetails) => {
dispatch(setAwaitingSubmissionDetails(awaitingSubmissionDetails));
},
};
};