delet blob wip
This commit is contained in:
@@ -4,6 +4,13 @@ import useTranslation from "next-translate/useTranslation";
|
||||
import TopThree from "./topthree";
|
||||
import { connect } from "react-redux";
|
||||
import { setCurrentView } from "../../store/currentView/action";
|
||||
import {
|
||||
deleteAwaitingSubmissionsFromBlob,
|
||||
getAwaitingSubmissionFromBlobProxy,
|
||||
} from "../../actions";
|
||||
import { setAwaitingSubmissionFromBlob } from "../../store/awaitingSubmission/action";
|
||||
import { parseCookies, setCookie, destroyCookie } from "nookies";
|
||||
import { getFormCollectionByID } from "../../components/utils";
|
||||
|
||||
const AwaitingSubmissionFromBlob = (props) => {
|
||||
let { t } = useTranslation();
|
||||
@@ -15,16 +22,87 @@ const AwaitingSubmissionFromBlob = (props) => {
|
||||
let topthreeRow = [];
|
||||
let showTopThreeArr = props.awaitingSubmissionFromBlob.value;
|
||||
|
||||
const deleteCaseItem = (containerID, caseID) => {
|
||||
let cookies = parseCookies();
|
||||
console.log("sssss", containerID, caseID);
|
||||
|
||||
deleteAwaitingSubmissionsFromBlob(containerID, caseID)
|
||||
.then((data) => {
|
||||
return data;
|
||||
})
|
||||
.then(() => {
|
||||
getAwaitingSubmissionFromBlobProxy(containerID).then((data) => {
|
||||
props.setAwaitingSubmissionFromBlob(data);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
let topThreeOnlyArr = showTopThreeArr;
|
||||
console.log(showTopThreeArr);
|
||||
Object.keys(topThreeOnlyArr).map((key, index) => {
|
||||
topthreeRow.push(
|
||||
<div className="cardModuleItem" key={index}>
|
||||
<div className="cardModuleDetails">
|
||||
<div className="cardModuleReference">
|
||||
<b>{t("myportal:case-reference")}:</b>
|
||||
{showTopThreeArr[index].pinswg_name}
|
||||
</div>
|
||||
|
||||
<Link
|
||||
href={
|
||||
router.locale == "cy"
|
||||
? "/fymhorth/parhauigyflwyno"
|
||||
: "/myportal" +
|
||||
"/" +
|
||||
getFormCollectionByID(
|
||||
showTopThreeArr[key]
|
||||
.pinswg_appealcasetype
|
||||
).UrlName +
|
||||
"?lpa=" +
|
||||
showTopThreeArr[key][
|
||||
"_pinswg_associatedlpa_value"
|
||||
] +
|
||||
"&apt=" +
|
||||
showTopThreeArr[key]
|
||||
.pinswg_appealcasetype +
|
||||
"&casereference=" +
|
||||
showTopThreeArr[key].pinswg_name +
|
||||
"&inid=" +
|
||||
showTopThreeArr[key].incidentid
|
||||
}
|
||||
>
|
||||
<a
|
||||
className="govuk-link--no-underline"
|
||||
data-id={index}
|
||||
onClick={() => {
|
||||
setCurrentReference({
|
||||
"currentReference":
|
||||
topThreeType != "watchedCases"
|
||||
? topThreeType !=
|
||||
"myRepresentations"
|
||||
? showTopThreeArr[key]
|
||||
.ticketnumber
|
||||
: showTopThreeArr[key][
|
||||
"_pinswg_case_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
: showTopThreeArr[key][
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
],
|
||||
"currentType": topThreeType,
|
||||
|
||||
"incidentid": getIncidentId(
|
||||
topThreeType,
|
||||
showTopThreeArr[key]
|
||||
),
|
||||
|
||||
"appealType":
|
||||
showTopThreeArr[key]
|
||||
.pinswg_appealcasetype,
|
||||
});
|
||||
}}
|
||||
>
|
||||
{showTopThreeArr[index].pinswg_name}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
<div className="carModuleAddress">
|
||||
<b>{t("myportal:case-address")}:</b>{" "}
|
||||
{_.isEmpty(showTopThreeArr)
|
||||
@@ -54,6 +132,25 @@ const AwaitingSubmissionFromBlob = (props) => {
|
||||
: "")}
|
||||
</div>
|
||||
</div>
|
||||
<div className="">
|
||||
<a
|
||||
href="#"
|
||||
className=" cardModuleRemoveCase govuk-link govuk-link--no-underline govuk-link--inverse "
|
||||
onClick={() => {
|
||||
event.preventDefault();
|
||||
deleteCaseItem(
|
||||
props.containerID,
|
||||
showTopThreeArr[key].pinswg_name
|
||||
);
|
||||
alert(
|
||||
"You have deleted case " +
|
||||
showTopThreeArr[key].pinswg_name
|
||||
);
|
||||
}}
|
||||
>
|
||||
—
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
@@ -99,6 +196,9 @@ const mapDispatchToProps = (dispatch) => {
|
||||
setCurrentView: (currentView) => {
|
||||
dispatch(setCurrentView(currentView));
|
||||
},
|
||||
setAwaitingSubmissionFromBlob: (awaitingSubmission) => {
|
||||
dispatch(setAwaitingSubmissionFromBlob(awaitingSubmission));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user