mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-09-08 02:37:40 +02:00
fix: document decline event not trigger on revoke
This commit is contained in:
@@ -1220,31 +1220,26 @@ function PdfRequestFiles(props) {
|
||||
);
|
||||
const jsonSender = JSON.parse(senderUser);
|
||||
setIsDecline({ isDeclined: false });
|
||||
const data = {
|
||||
IsDeclined: true,
|
||||
DeclineReason: reason,
|
||||
DeclineBy: {
|
||||
__type: "Pointer",
|
||||
className: "_User",
|
||||
objectId: jsonSender?.objectId
|
||||
}
|
||||
};
|
||||
setIsUiLoading(true);
|
||||
|
||||
const email =
|
||||
pdfDetails?.[0].Signers?.find((x) => x.objectId === signerObjectId)
|
||||
?.Email || jsonSender?.email;
|
||||
const userId =
|
||||
pdfDetails?.[0].Signers?.find((x) => x.objectId === signerObjectId)
|
||||
?.UserId?.objectId || jsonSender?.objectId;
|
||||
const params = {
|
||||
docId: pdfDetails?.[0].objectId,
|
||||
reason: reason,
|
||||
userId: userId
|
||||
};
|
||||
await axios
|
||||
.put(
|
||||
`${localStorage.getItem(
|
||||
"baseUrl"
|
||||
)}classes/contracts_Document/${documentId}`,
|
||||
data,
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
|
||||
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
|
||||
}
|
||||
.post(`${localStorage.getItem("baseUrl")}functions/declinedoc`, params, {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
|
||||
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
|
||||
}
|
||||
)
|
||||
})
|
||||
.then(async (result) => {
|
||||
const res = result.data;
|
||||
if (res) {
|
||||
@@ -1264,7 +1259,8 @@ function PdfRequestFiles(props) {
|
||||
email: x?.Email,
|
||||
phone: x?.Phone
|
||||
})),
|
||||
declinedBy: jsonSender.email,
|
||||
declinedBy: email,
|
||||
declinedReason: reason,
|
||||
declinedAt: new Date(),
|
||||
createdAt: pdfDetails?.[0].createdAt
|
||||
}
|
||||
@@ -1715,11 +1711,7 @@ function PdfRequestFiles(props) {
|
||||
{/* this modal is used to show decline alert */}
|
||||
<PdfDeclineModal
|
||||
show={isDecline.isDeclined}
|
||||
headMsg={
|
||||
pdfDetails[0]?.IsDeclined
|
||||
? t("document-declined")
|
||||
: t("document-decline")
|
||||
}
|
||||
headMsg={t("document-declined")}
|
||||
bodyMssg={
|
||||
isDecline.currnt === "Sure"
|
||||
? t("decline-alert-1")
|
||||
|
||||
@@ -516,7 +516,6 @@ const ReportTable = (props) => {
|
||||
.then(async (result) => {
|
||||
const res = result.data;
|
||||
if (res) {
|
||||
setReason("");
|
||||
setActLoader({});
|
||||
setIsAlert(true);
|
||||
setAlertMsg({
|
||||
@@ -528,7 +527,43 @@ const ReportTable = (props) => {
|
||||
(x) => x.objectId !== item.objectId
|
||||
);
|
||||
props.setList(upldatedList);
|
||||
const params = {
|
||||
event: "declined",
|
||||
body: {
|
||||
objectId: item.objectId,
|
||||
file: item?.SignedUrl || item?.URL,
|
||||
name: item?.Name,
|
||||
note: item?.Note || "",
|
||||
description: item?.Description || "",
|
||||
signers: item?.Signers?.map((x) => ({
|
||||
name: x?.Name,
|
||||
email: x?.Email,
|
||||
phone: x?.Phone
|
||||
})),
|
||||
declinedBy: jsonSender?.email,
|
||||
declinedReason: reason,
|
||||
declinedAt: new Date(),
|
||||
createdAt: item?.createdAt
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
await axios.post(
|
||||
`${localStorage.getItem("baseUrl")}functions/callwebhook`,
|
||||
params,
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
|
||||
sessiontoken: localStorage.getItem("accesstoken")
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (err) {
|
||||
console.log("Err ", err);
|
||||
}
|
||||
}
|
||||
setReason("");
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("err", err);
|
||||
|
||||
@@ -41,8 +41,8 @@ function CustomModal(props) {
|
||||
className="op-btn op-btn-primary mr-2 px-6"
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setReason("");
|
||||
props.declineDoc(reason);
|
||||
setReason("");
|
||||
}}
|
||||
>
|
||||
{t("yes")}
|
||||
|
||||
Reference in New Issue
Block a user