mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-09-04 16:58:05 +02:00
Compare commits
1
Commits
v2.7.0
...
autosign_issue
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69308e22d8 |
@@ -1,9 +1,7 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { saveAs } from "file-saver";
|
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { getBase64FromUrl } from "../../constant/Utils";
|
import { handleDownloadPdf, handleToPrint } from "../../constant/Utils";
|
||||||
import { themeColor, emailRegex } from "../../constant/const";
|
import { themeColor, emailRegex } from "../../constant/const";
|
||||||
import printModule from "print-js";
|
|
||||||
import Loader from "../../primitives/Loader";
|
import Loader from "../../primitives/Loader";
|
||||||
import ModalUi from "../../primitives/ModalUi";
|
import ModalUi from "../../primitives/ModalUi";
|
||||||
|
|
||||||
@@ -12,7 +10,7 @@ function EmailComponent({
|
|||||||
pdfUrl,
|
pdfUrl,
|
||||||
setIsEmail,
|
setIsEmail,
|
||||||
setSuccessEmail,
|
setSuccessEmail,
|
||||||
pdfName,
|
pdfDetails,
|
||||||
sender,
|
sender,
|
||||||
setIsAlert,
|
setIsAlert,
|
||||||
extUserId,
|
extUserId,
|
||||||
@@ -22,8 +20,11 @@ function EmailComponent({
|
|||||||
const [emailValue, setEmailValue] = useState("");
|
const [emailValue, setEmailValue] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [emailErr, setEmailErr] = useState(false);
|
const [emailErr, setEmailErr] = useState(false);
|
||||||
|
const [isDownloading, setIsDownloading] = useState("");
|
||||||
|
const isAndroid = /Android/i.test(navigator.userAgent);
|
||||||
//function for send email
|
//function for send email
|
||||||
const sendEmail = async () => {
|
const sendEmail = async () => {
|
||||||
|
const pdfName = pdfDetails[0]?.Name;
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
let sendMail;
|
let sendMail;
|
||||||
@@ -138,43 +139,6 @@ function EmailComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// function for print signed pdf
|
|
||||||
const handleToPrint = async (event) => {
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
const pdf = await getBase64FromUrl(pdfUrl);
|
|
||||||
const isAndroidDevice = navigator.userAgent.match(/Android/i);
|
|
||||||
const isAppleDevice =
|
|
||||||
(/iPad|iPhone|iPod/.test(navigator.platform) ||
|
|
||||||
(navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1)) &&
|
|
||||||
!window.MSStream;
|
|
||||||
if (isAndroidDevice || isAppleDevice) {
|
|
||||||
const byteArray = Uint8Array.from(
|
|
||||||
atob(pdf)
|
|
||||||
.split("")
|
|
||||||
.map((char) => char.charCodeAt(0))
|
|
||||||
);
|
|
||||||
const blob = new Blob([byteArray], { type: "application/pdf" });
|
|
||||||
const blobUrl = URL.createObjectURL(blob);
|
|
||||||
window.open(blobUrl, "_blank");
|
|
||||||
} else {
|
|
||||||
printModule({ printable: pdf, type: "pdf", base64: true });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//handle download signed pdf
|
|
||||||
const handleDownloadPdf = () => {
|
|
||||||
saveAs(pdfUrl, `${sanitizeFileName(pdfName)}_signed_by_OpenSign™.pdf`);
|
|
||||||
};
|
|
||||||
|
|
||||||
const sanitizeFileName = (pdfName) => {
|
|
||||||
// Replace spaces with underscore
|
|
||||||
return pdfName.replace(/ /g, "_");
|
|
||||||
};
|
|
||||||
|
|
||||||
const isAndroid = /Android/i.test(navigator.userAgent);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{/* isEmail */}
|
{/* isEmail */}
|
||||||
@@ -188,6 +152,11 @@ function EmailComponent({
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{isDownloading === "pdf" && (
|
||||||
|
<div className="fixed z-[200] inset-0 flex justify-center items-center bg-black bg-opacity-30">
|
||||||
|
<Loader />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<div className="flex justify-between items-center py-[10px] px-[20px] border-b-[1px] border-base-content">
|
<div className="flex justify-between items-center py-[10px] px-[20px] border-b-[1px] border-base-content">
|
||||||
<span className="text-base-content font-semibold">
|
<span className="text-base-content font-semibold">
|
||||||
Successfully signed!
|
Successfully signed!
|
||||||
@@ -195,7 +164,7 @@ function EmailComponent({
|
|||||||
<div className="flex flex-row">
|
<div className="flex flex-row">
|
||||||
{!isAndroid && (
|
{!isAndroid && (
|
||||||
<button
|
<button
|
||||||
onClick={handleToPrint}
|
onClick={(e) => handleToPrint(e, pdfUrl, setIsDownloading)}
|
||||||
className="op-btn op-btn-neutral op-btn-sm text-[15px]"
|
className="op-btn op-btn-neutral op-btn-sm text-[15px]"
|
||||||
>
|
>
|
||||||
<i className="fa-light fa-print" aria-hidden="true"></i>
|
<i className="fa-light fa-print" aria-hidden="true"></i>
|
||||||
@@ -204,7 +173,9 @@ function EmailComponent({
|
|||||||
)}
|
)}
|
||||||
<button
|
<button
|
||||||
className="op-btn op-btn-primary op-btn-sm text-[15px] ml-2"
|
className="op-btn op-btn-primary op-btn-sm text-[15px] ml-2"
|
||||||
onClick={() => handleDownloadPdf()}
|
onClick={() =>
|
||||||
|
handleDownloadPdf(pdfDetails, pdfUrl, setIsDownloading)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<i className="fa-light fa-download" aria-hidden="true"></i>
|
<i className="fa-light fa-download" aria-hidden="true"></i>
|
||||||
Download
|
Download
|
||||||
|
|||||||
@@ -440,7 +440,7 @@ export const resizeBorderExtraWidth = () => {
|
|||||||
return 20;
|
return 20;
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function getBase64FromUrl(url) {
|
export async function getBase64FromUrl(url, autosign) {
|
||||||
const data = await fetch(url);
|
const data = await fetch(url);
|
||||||
const blob = await data.blob();
|
const blob = await data.blob();
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
@@ -448,8 +448,12 @@ export async function getBase64FromUrl(url) {
|
|||||||
reader.readAsDataURL(blob);
|
reader.readAsDataURL(blob);
|
||||||
reader.onloadend = function () {
|
reader.onloadend = function () {
|
||||||
const pdfBase = this.result;
|
const pdfBase = this.result;
|
||||||
const suffixbase64 = pdfBase.split(",").pop();
|
if (autosign) {
|
||||||
resolve(suffixbase64);
|
resolve(pdfBase);
|
||||||
|
} else {
|
||||||
|
const suffixbase64 = pdfBase.split(",").pop();
|
||||||
|
resolve(suffixbase64);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -2225,3 +2229,42 @@ export const getContainerScale = (pdfOriginalWH, pageNumber, containerWH) => {
|
|||||||
const containerScale = containerWH?.width / getPdfPageWidth?.width || 1;
|
const containerScale = containerWH?.width / getPdfPageWidth?.width || 1;
|
||||||
return containerScale;
|
return containerScale;
|
||||||
};
|
};
|
||||||
|
//function to get default signatur eof current user from `contracts_Signature` class
|
||||||
|
export const getDefaultSignature = async (objectId) => {
|
||||||
|
try {
|
||||||
|
const result = await axios.get(
|
||||||
|
`${localStorage.getItem(
|
||||||
|
"baseUrl"
|
||||||
|
)}classes/contracts_Signature?where={"UserId": {"__type": "Pointer","className": "_User", "objectId":"${objectId}"}}`,
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
|
||||||
|
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
const res = result.data?.results;
|
||||||
|
if (res[0] && res.length > 0) {
|
||||||
|
const defaultSignature = res[0]?.ImageURL
|
||||||
|
? await getBase64FromUrl(res[0]?.ImageURL, true)
|
||||||
|
: "";
|
||||||
|
const defaultInitial = res[0]?.Initials
|
||||||
|
? await getBase64FromUrl(res[0]?.Initials, true)
|
||||||
|
: "";
|
||||||
|
|
||||||
|
return {
|
||||||
|
status: "success",
|
||||||
|
res: {
|
||||||
|
defaultSignature: defaultSignature,
|
||||||
|
defaultInitial: defaultInitial
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log("Error: error in fetch data in contracts_Signature", err);
|
||||||
|
return {
|
||||||
|
status: "error"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ import {
|
|||||||
contactBook,
|
contactBook,
|
||||||
handleDownloadPdf,
|
handleDownloadPdf,
|
||||||
handleToPrint,
|
handleToPrint,
|
||||||
handleDownloadCertificate
|
handleDownloadCertificate,
|
||||||
|
getDefaultSignature
|
||||||
} from "../constant/Utils";
|
} from "../constant/Utils";
|
||||||
import LoaderWithMsg from "../primitives/LoaderWithMsg";
|
import LoaderWithMsg from "../primitives/LoaderWithMsg";
|
||||||
import HandleError from "../primitives/HandleError";
|
import HandleError from "../primitives/HandleError";
|
||||||
@@ -337,244 +338,233 @@ function PdfRequestFiles(props) {
|
|||||||
};
|
};
|
||||||
//function for get document details for perticular signer with signer'object id
|
//function for get document details for perticular signer with signer'object id
|
||||||
const getDocumentDetails = async (docId, isNextUser) => {
|
const getDocumentDetails = async (docId, isNextUser) => {
|
||||||
const senderUser = localStorage.getItem(
|
try {
|
||||||
`Parse/${localStorage.getItem("parseAppId")}/currentUser`
|
const senderUser = localStorage.getItem(
|
||||||
);
|
`Parse/${localStorage.getItem("parseAppId")}/currentUser`
|
||||||
const jsonSender = JSON.parse(senderUser);
|
);
|
||||||
let currUserId;
|
const jsonSender = JSON.parse(senderUser);
|
||||||
//getting document details
|
let currUserId;
|
||||||
const documentData = await contractDocument(documentId || docId);
|
//getting document details
|
||||||
if (documentData && documentData.length > 0) {
|
const documentData = await contractDocument(documentId || docId);
|
||||||
setExtUserId(documentData[0]?.ExtUserPtr?.objectId);
|
if (documentData && documentData.length > 0) {
|
||||||
const isCompleted =
|
setExtUserId(documentData[0]?.ExtUserPtr?.objectId);
|
||||||
documentData[0].IsCompleted && documentData[0].IsCompleted;
|
const isCompleted =
|
||||||
const expireDate = documentData[0].ExpiryDate.iso;
|
documentData[0].IsCompleted && documentData[0].IsCompleted;
|
||||||
const declined = documentData[0].IsDeclined && documentData[0].IsDeclined;
|
const expireDate = documentData[0].ExpiryDate.iso;
|
||||||
const expireUpdateDate = new Date(expireDate).getTime();
|
const declined =
|
||||||
const currDate = new Date().getTime();
|
documentData[0].IsDeclined && documentData[0].IsDeclined;
|
||||||
const getSigners = documentData[0].Signers;
|
const expireUpdateDate = new Date(expireDate).getTime();
|
||||||
const getCurrentSigner =
|
const currDate = new Date().getTime();
|
||||||
getSigners &&
|
const getSigners = documentData[0].Signers;
|
||||||
getSigners.filter(
|
const getCurrentSigner =
|
||||||
(data) => data.UserId.objectId === jsonSender?.objectId
|
getSigners &&
|
||||||
);
|
getSigners.filter(
|
||||||
|
(data) => data.UserId.objectId === jsonSender?.objectId
|
||||||
|
);
|
||||||
|
|
||||||
currUserId = getCurrentSigner[0] ? getCurrentSigner[0].objectId : "";
|
currUserId = getCurrentSigner[0] ? getCurrentSigner[0].objectId : "";
|
||||||
if (isEnableSubscription) {
|
if (isEnableSubscription) {
|
||||||
await checkIsSubscribed(
|
await checkIsSubscribed(
|
||||||
documentData[0]?.ExtUserPtr?.objectId,
|
documentData[0]?.ExtUserPtr?.objectId,
|
||||||
currUserId
|
currUserId
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (currUserId) {
|
|
||||||
setSignerObjectId(currUserId);
|
|
||||||
}
|
|
||||||
if (documentData[0].SignedUrl) {
|
|
||||||
setPdfUrl(documentData[0].SignedUrl);
|
|
||||||
} else {
|
|
||||||
setPdfUrl(documentData[0].URL);
|
|
||||||
}
|
|
||||||
if (isCompleted) {
|
|
||||||
setIsSigned(true);
|
|
||||||
const data = {
|
|
||||||
isCertificate: true,
|
|
||||||
isModal: true
|
|
||||||
};
|
|
||||||
setAlreadySign(true);
|
|
||||||
setIsCompleted(data);
|
|
||||||
setIsCelebration(true);
|
|
||||||
setTimeout(() => {
|
|
||||||
setIsCelebration(false);
|
|
||||||
}, 5000);
|
|
||||||
} else if (declined) {
|
|
||||||
const currentDecline = {
|
|
||||||
currnt: "another",
|
|
||||||
isDeclined: true
|
|
||||||
};
|
|
||||||
setIsDecline(currentDecline);
|
|
||||||
} else if (currDate > expireUpdateDate) {
|
|
||||||
const expireDateFormat = moment(new Date(expireDate)).format(
|
|
||||||
"MMM DD, YYYY"
|
|
||||||
);
|
|
||||||
setIsExpired(true);
|
|
||||||
setExpiredDate(expireDateFormat);
|
|
||||||
} // Check if the current signer is not a last signer and handle the complete message.
|
|
||||||
else if (isNextUser) {
|
|
||||||
setIsCelebration(true);
|
|
||||||
setTimeout(() => {
|
|
||||||
setIsCelebration(false);
|
|
||||||
}, 5000);
|
|
||||||
setIsCompleted({
|
|
||||||
isModal: true,
|
|
||||||
message:
|
|
||||||
"You have successfully signed the document. You can download or print a copy of the partially signed document. A copy of the digitally signed document will be sent to the owner over email once it is signed by all signers."
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (currUserId) {
|
if (currUserId) {
|
||||||
const checkCurrentUser = documentData[0].Placeholders.find(
|
setSignerObjectId(currUserId);
|
||||||
(data) => data?.signerObjId === currUserId
|
|
||||||
);
|
|
||||||
if (checkCurrentUser) {
|
|
||||||
setCurrentSigner(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
if (documentData[0].SignedUrl) {
|
||||||
const audittrailData =
|
setPdfUrl(documentData[0].SignedUrl);
|
||||||
documentData[0].AuditTrail &&
|
|
||||||
documentData[0].AuditTrail.length > 0 &&
|
|
||||||
documentData[0].AuditTrail.filter((data) => data.Activity === "Signed");
|
|
||||||
|
|
||||||
const checkAlreadySign =
|
|
||||||
documentData[0].AuditTrail &&
|
|
||||||
documentData[0].AuditTrail.length > 0 &&
|
|
||||||
documentData[0].AuditTrail.filter(
|
|
||||||
(data) =>
|
|
||||||
data.UserPtr.objectId === currUserId && data.Activity === "Signed"
|
|
||||||
);
|
|
||||||
if (
|
|
||||||
checkAlreadySign &&
|
|
||||||
checkAlreadySign[0] &&
|
|
||||||
checkAlreadySign.length > 0
|
|
||||||
) {
|
|
||||||
setAlreadySign(true);
|
|
||||||
} else {
|
|
||||||
const obj = documentData?.[0];
|
|
||||||
setSendInOrder(obj?.SendinOrder || false);
|
|
||||||
if (
|
|
||||||
obj &&
|
|
||||||
obj.Signers &&
|
|
||||||
obj.Signers.length > 0 &&
|
|
||||||
obj.Placeholders &&
|
|
||||||
obj.Placeholders.length > 0
|
|
||||||
) {
|
|
||||||
const params = {
|
|
||||||
event: "viewed",
|
|
||||||
contactId: currUserId,
|
|
||||||
body: {
|
|
||||||
objectId: documentData?.[0].objectId,
|
|
||||||
file: documentData?.[0]?.SignedUrl || documentData?.[0]?.URL,
|
|
||||||
name: documentData?.[0].Name,
|
|
||||||
note: documentData?.[0].Note || "",
|
|
||||||
description: documentData?.[0].Description || "",
|
|
||||||
signers: documentData?.[0].Signers?.map((x) => ({
|
|
||||||
name: x?.Name,
|
|
||||||
email: x?.Email,
|
|
||||||
phone: x?.Phone
|
|
||||||
})),
|
|
||||||
viewedBy: jsonSender.email,
|
|
||||||
viewedAt: new Date(),
|
|
||||||
createdAt: documentData?.[0].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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let signers = [];
|
|
||||||
let unSignedSigner = [];
|
|
||||||
|
|
||||||
const placeholdersOrSigners = [];
|
|
||||||
for (const placeholder of documentData[0].Placeholders) {
|
|
||||||
//`emailExist` variable to handle condition for quick send flow and show unsigned signers list
|
|
||||||
const signerIdExist = placeholder?.signerObjId;
|
|
||||||
if (signerIdExist) {
|
|
||||||
const getSignerData = documentData[0].Signers.find(
|
|
||||||
(data) => data.objectId === placeholder?.signerObjId
|
|
||||||
);
|
|
||||||
placeholdersOrSigners.push(getSignerData);
|
|
||||||
} else {
|
} else {
|
||||||
placeholdersOrSigners.push(placeholder);
|
setPdfUrl(documentData[0].URL);
|
||||||
}
|
}
|
||||||
}
|
if (isCompleted) {
|
||||||
//condition to check already signed document by someone
|
setIsSigned(true);
|
||||||
if (audittrailData && audittrailData.length > 0) {
|
const data = {
|
||||||
setIsDocId(true);
|
isCertificate: true,
|
||||||
|
isModal: true
|
||||||
for (const item of placeholdersOrSigners) {
|
};
|
||||||
const checkEmail = item?.email;
|
setAlreadySign(true);
|
||||||
//if email exist then compare user signed by using email else signers objectId
|
setIsCompleted(data);
|
||||||
const emailOrId = checkEmail ? item.email : item.objectId;
|
setIsCelebration(true);
|
||||||
//`isSignedSignature` variable to handle break loop whenever it get true
|
setTimeout(() => {
|
||||||
let isSignedSignature = false;
|
setIsCelebration(false);
|
||||||
//checking the signer who signed the document by using audit trail details.
|
}, 5000);
|
||||||
//and save signedSigners and unsignedSigners details
|
} else if (declined) {
|
||||||
for (const doc of audittrailData) {
|
const currentDecline = {
|
||||||
const signedExist = checkEmail
|
currnt: "another",
|
||||||
? doc?.UserPtr.Email
|
isDeclined: true
|
||||||
: doc?.UserPtr.objectId;
|
};
|
||||||
|
setIsDecline(currentDecline);
|
||||||
if (emailOrId === signedExist) {
|
} else if (currDate > expireUpdateDate) {
|
||||||
signers.push({ ...item });
|
const expireDateFormat = moment(new Date(expireDate)).format(
|
||||||
isSignedSignature = true;
|
"MMM DD, YYYY"
|
||||||
break;
|
);
|
||||||
|
setIsExpired(true);
|
||||||
|
setExpiredDate(expireDateFormat);
|
||||||
|
} // Check if the current signer is not a last signer and handle the complete message.
|
||||||
|
else if (isNextUser) {
|
||||||
|
setIsCelebration(true);
|
||||||
|
setTimeout(() => {
|
||||||
|
setIsCelebration(false);
|
||||||
|
}, 5000);
|
||||||
|
setIsCompleted({
|
||||||
|
isModal: true,
|
||||||
|
message:
|
||||||
|
"You have successfully signed the document. You can download or print a copy of the partially signed document. A copy of the digitally signed document will be sent to the owner over email once it is signed by all signers."
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (currUserId) {
|
||||||
|
const checkCurrentUser = documentData[0].Placeholders.find(
|
||||||
|
(data) => data?.signerObjId === currUserId
|
||||||
|
);
|
||||||
|
if (checkCurrentUser) {
|
||||||
|
setCurrentSigner(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isSignedSignature) {
|
}
|
||||||
unSignedSigner.push({ ...item });
|
const audittrailData =
|
||||||
|
documentData[0].AuditTrail &&
|
||||||
|
documentData[0].AuditTrail.length > 0 &&
|
||||||
|
documentData[0].AuditTrail.filter(
|
||||||
|
(data) => data.Activity === "Signed"
|
||||||
|
);
|
||||||
|
|
||||||
|
const checkAlreadySign =
|
||||||
|
documentData[0].AuditTrail &&
|
||||||
|
documentData[0].AuditTrail.length > 0 &&
|
||||||
|
documentData[0].AuditTrail.filter(
|
||||||
|
(data) =>
|
||||||
|
data.UserPtr.objectId === currUserId && data.Activity === "Signed"
|
||||||
|
);
|
||||||
|
if (
|
||||||
|
checkAlreadySign &&
|
||||||
|
checkAlreadySign[0] &&
|
||||||
|
checkAlreadySign.length > 0
|
||||||
|
) {
|
||||||
|
setAlreadySign(true);
|
||||||
|
} else {
|
||||||
|
const obj = documentData?.[0];
|
||||||
|
setSendInOrder(obj?.SendinOrder || false);
|
||||||
|
if (
|
||||||
|
obj &&
|
||||||
|
obj.Signers &&
|
||||||
|
obj.Signers.length > 0 &&
|
||||||
|
obj.Placeholders &&
|
||||||
|
obj.Placeholders.length > 0
|
||||||
|
) {
|
||||||
|
const params = {
|
||||||
|
event: "viewed",
|
||||||
|
contactId: currUserId,
|
||||||
|
body: {
|
||||||
|
objectId: documentData?.[0].objectId,
|
||||||
|
file: documentData?.[0]?.SignedUrl || documentData?.[0]?.URL,
|
||||||
|
name: documentData?.[0].Name,
|
||||||
|
note: documentData?.[0].Note || "",
|
||||||
|
description: documentData?.[0].Description || "",
|
||||||
|
signers: documentData?.[0].Signers?.map((x) => ({
|
||||||
|
name: x?.Name,
|
||||||
|
email: x?.Email,
|
||||||
|
phone: x?.Phone
|
||||||
|
})),
|
||||||
|
viewedBy: jsonSender.email,
|
||||||
|
viewedAt: new Date(),
|
||||||
|
createdAt: documentData?.[0].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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setSignedSigners(signers);
|
|
||||||
setUnSignedSigners(unSignedSigner);
|
let signers = [];
|
||||||
setSignerPos(documentData[0].Placeholders);
|
let unSignedSigner = [];
|
||||||
} else {
|
|
||||||
//else condition is show there are no details in audit trail then direct push all signers details
|
const placeholdersOrSigners = [];
|
||||||
//in unsignedsigners array
|
for (const placeholder of documentData[0].Placeholders) {
|
||||||
setUnSignedSigners(placeholdersOrSigners);
|
//`emailExist` variable to handle condition for quick send flow and show unsigned signers list
|
||||||
setSignerPos(documentData[0].Placeholders);
|
const signerIdExist = placeholder?.signerObjId;
|
||||||
}
|
if (signerIdExist) {
|
||||||
setPdfDetails(documentData);
|
const getSignerData = documentData[0].Signers.find(
|
||||||
//checking if condition current user already sign or owner does not exist as a signer or document has been declined by someone or document has been expired
|
(data) => data.objectId === placeholder?.signerObjId
|
||||||
//then stop to display tour message
|
|
||||||
if (
|
|
||||||
(checkAlreadySign &&
|
|
||||||
checkAlreadySign[0] &&
|
|
||||||
checkAlreadySign.length > 0) ||
|
|
||||||
!currUserId ||
|
|
||||||
declined ||
|
|
||||||
currDate > expireUpdateDate
|
|
||||||
) {
|
|
||||||
setRequestSignTour(true);
|
|
||||||
} else {
|
|
||||||
//else condition to check current user exist in contracts_Users class and check tour message status
|
|
||||||
//if not then check user exist in contracts_Contactbook class and check tour message statu
|
|
||||||
const res = await contractUsers();
|
|
||||||
if (res === "Error: Something went wrong!") {
|
|
||||||
setHandleError("Error: Something went wrong!");
|
|
||||||
} else if (res[0] && res?.length) {
|
|
||||||
setContractName("_Users");
|
|
||||||
currUserId = res[0].objectId;
|
|
||||||
setSignerUserId(currUserId);
|
|
||||||
const tourData = res[0].TourStatus && res[0].TourStatus;
|
|
||||||
if (tourData && tourData.length > 0) {
|
|
||||||
const checkTourRequest = tourData.filter(
|
|
||||||
(data) => data?.requestSign
|
|
||||||
);
|
);
|
||||||
setTourStatus(tourData);
|
placeholdersOrSigners.push(getSignerData);
|
||||||
setRequestSignTour(checkTourRequest[0]?.requestSign || false);
|
} else {
|
||||||
|
placeholdersOrSigners.push(placeholder);
|
||||||
}
|
}
|
||||||
} else if (res?.length === 0) {
|
}
|
||||||
const res = await contactBook(currUserId);
|
//condition to check already signed document by someone
|
||||||
|
if (audittrailData && audittrailData.length > 0) {
|
||||||
|
setIsDocId(true);
|
||||||
|
|
||||||
|
for (const item of placeholdersOrSigners) {
|
||||||
|
const checkEmail = item?.email;
|
||||||
|
//if email exist then compare user signed by using email else signers objectId
|
||||||
|
const emailOrId = checkEmail ? item.email : item.objectId;
|
||||||
|
//`isSignedSignature` variable to handle break loop whenever it get true
|
||||||
|
let isSignedSignature = false;
|
||||||
|
//checking the signer who signed the document by using audit trail details.
|
||||||
|
//and save signedSigners and unsignedSigners details
|
||||||
|
for (const doc of audittrailData) {
|
||||||
|
const signedExist = checkEmail
|
||||||
|
? doc?.UserPtr.Email
|
||||||
|
: doc?.UserPtr.objectId;
|
||||||
|
|
||||||
|
if (emailOrId === signedExist) {
|
||||||
|
signers.push({ ...item });
|
||||||
|
isSignedSignature = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isSignedSignature) {
|
||||||
|
unSignedSigner.push({ ...item });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setSignedSigners(signers);
|
||||||
|
setUnSignedSigners(unSignedSigner);
|
||||||
|
setSignerPos(documentData[0].Placeholders);
|
||||||
|
} else {
|
||||||
|
//else condition is show there are no details in audit trail then direct push all signers details
|
||||||
|
//in unsignedsigners array
|
||||||
|
setUnSignedSigners(placeholdersOrSigners);
|
||||||
|
setSignerPos(documentData[0].Placeholders);
|
||||||
|
}
|
||||||
|
setPdfDetails(documentData);
|
||||||
|
//checking if condition current user already sign or owner does not exist as a signer or document has been declined by someone or document has been expired
|
||||||
|
//then stop to display tour message
|
||||||
|
if (
|
||||||
|
(checkAlreadySign &&
|
||||||
|
checkAlreadySign[0] &&
|
||||||
|
checkAlreadySign.length > 0) ||
|
||||||
|
!currUserId ||
|
||||||
|
declined ||
|
||||||
|
currDate > expireUpdateDate
|
||||||
|
) {
|
||||||
|
setRequestSignTour(true);
|
||||||
|
} else {
|
||||||
|
//else condition to check current user exist in contracts_Users class and check tour message status
|
||||||
|
//if not then check user exist in contracts_Contactbook class and check tour message statu
|
||||||
|
const res = await contractUsers();
|
||||||
if (res === "Error: Something went wrong!") {
|
if (res === "Error: Something went wrong!") {
|
||||||
setHandleError("Error: Something went wrong!");
|
setHandleError("Error: Something went wrong!");
|
||||||
} else if (res[0] && res.length) {
|
} else if (res[0] && res?.length) {
|
||||||
setContractName("_Contactbook");
|
setContractName("_Users");
|
||||||
const objectId = res[0].objectId;
|
currUserId = res[0].objectId;
|
||||||
setSignerUserId(objectId);
|
setSignerUserId(currUserId);
|
||||||
const tourData = res[0].TourStatus && res[0].TourStatus;
|
const tourData = res[0].TourStatus && res[0].TourStatus;
|
||||||
if (tourData && tourData.length > 0) {
|
if (tourData && tourData.length > 0) {
|
||||||
const checkTourRequest = tourData.filter(
|
const checkTourRequest = tourData.filter(
|
||||||
@@ -583,63 +573,61 @@ function PdfRequestFiles(props) {
|
|||||||
setTourStatus(tourData);
|
setTourStatus(tourData);
|
||||||
setRequestSignTour(checkTourRequest[0]?.requestSign || false);
|
setRequestSignTour(checkTourRequest[0]?.requestSign || false);
|
||||||
}
|
}
|
||||||
} else if (res.length === 0) {
|
} else if (res?.length === 0) {
|
||||||
setHandleError("Error: User does not exist!");
|
const res = await contactBook(currUserId);
|
||||||
|
if (res === "Error: Something went wrong!") {
|
||||||
|
setHandleError("Error: Something went wrong!");
|
||||||
|
} else if (res[0] && res.length) {
|
||||||
|
setContractName("_Contactbook");
|
||||||
|
const objectId = res[0].objectId;
|
||||||
|
setSignerUserId(objectId);
|
||||||
|
const tourData = res[0].TourStatus && res[0].TourStatus;
|
||||||
|
if (tourData && tourData.length > 0) {
|
||||||
|
const checkTourRequest = tourData.filter(
|
||||||
|
(data) => data?.requestSign
|
||||||
|
);
|
||||||
|
setTourStatus(tourData);
|
||||||
|
setRequestSignTour(checkTourRequest[0]?.requestSign || false);
|
||||||
|
}
|
||||||
|
} else if (res.length === 0) {
|
||||||
|
setHandleError("Error: User does not exist!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
setIsUiLoading(false);
|
||||||
setIsUiLoading(false);
|
} else if (
|
||||||
} else if (
|
documentData === "Error: Something went wrong!" ||
|
||||||
documentData === "Error: Something went wrong!" ||
|
(documentData.result && documentData.result.error)
|
||||||
(documentData.result && documentData.result.error)
|
) {
|
||||||
) {
|
|
||||||
setHandleError("Error: Something went wrong!");
|
|
||||||
setIsLoading({
|
|
||||||
isLoad: false
|
|
||||||
});
|
|
||||||
console.log("err in getDocument cloud function ");
|
|
||||||
} else {
|
|
||||||
setHandleError("No Data Found!");
|
|
||||||
setIsUiLoading({
|
|
||||||
isLoad: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
await axios
|
|
||||||
.get(
|
|
||||||
`${localStorage.getItem(
|
|
||||||
"baseUrl"
|
|
||||||
)}classes/contracts_Signature?where={"UserId": {"__type": "Pointer","className": "_User", "objectId":"${
|
|
||||||
jsonSender?.objectId
|
|
||||||
}"}}`,
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
|
|
||||||
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.then((Listdata) => {
|
|
||||||
const json = Listdata.data;
|
|
||||||
const res = json.results;
|
|
||||||
|
|
||||||
if (res[0] && res.length > 0) {
|
|
||||||
setDefaultSignImg(res[0].ImageURL);
|
|
||||||
setMyInitial(res[0]?.Initials);
|
|
||||||
}
|
|
||||||
|
|
||||||
const loadObj = {
|
|
||||||
isLoad: false
|
|
||||||
};
|
|
||||||
setIsLoading(loadObj);
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.log("Err in contracts_Signature class", err);
|
|
||||||
setHandleError("Error: Something went wrong!");
|
setHandleError("Error: Something went wrong!");
|
||||||
setIsLoading({
|
setIsLoading({
|
||||||
isLoad: false
|
isLoad: false
|
||||||
});
|
});
|
||||||
|
console.log("err in getDocument cloud function ");
|
||||||
|
} else {
|
||||||
|
setHandleError("No Data Found!");
|
||||||
|
setIsUiLoading({
|
||||||
|
isLoad: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//function to get default signatur eof current user from `contracts_Signature` class
|
||||||
|
const defaultSignRes = await getDefaultSignature(jsonSender.objectId);
|
||||||
|
if (defaultSignRes?.status === "success") {
|
||||||
|
setDefaultSignImg(defaultSignRes?.res?.defaultSignature);
|
||||||
|
setMyInitial(defaultSignRes?.res?.defaultInitial);
|
||||||
|
} else if (defaultSignRes?.status === "error") {
|
||||||
|
setHandleError("Error: Something went wrong!");
|
||||||
|
setIsLoading({
|
||||||
|
isLoad: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log("Error: error in getDocumentDetails", err);
|
||||||
|
setHandleError("Error: Something went wrong!");
|
||||||
|
setIsLoading({
|
||||||
|
isLoad: false
|
||||||
});
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
//function for embed signature or image url in pdf
|
//function for embed signature or image url in pdf
|
||||||
async function embedWidgetsData() {
|
async function embedWidgetsData() {
|
||||||
@@ -2156,7 +2144,6 @@ function PdfRequestFiles(props) {
|
|||||||
{defaultSignImg && !alreadySign && currentSigner && (
|
{defaultSignImg && !alreadySign && currentSigner && (
|
||||||
<DefaultSignature
|
<DefaultSignature
|
||||||
defaultSignImg={defaultSignImg}
|
defaultSignImg={defaultSignImg}
|
||||||
setDefaultSignImg={setDefaultSignImg}
|
|
||||||
userObjectId={signerObjectId}
|
userObjectId={signerObjectId}
|
||||||
setIsLoading={setIsLoading}
|
setIsLoading={setIsLoading}
|
||||||
xyPostion={signerPos}
|
xyPostion={signerPos}
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ import {
|
|||||||
fetchImageBase64,
|
fetchImageBase64,
|
||||||
changeImageWH,
|
changeImageWH,
|
||||||
handleSendOTP,
|
handleSendOTP,
|
||||||
getContainerScale
|
getContainerScale,
|
||||||
|
getDefaultSignature
|
||||||
} from "../constant/Utils";
|
} from "../constant/Utils";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import Tour from "reactour";
|
import Tour from "reactour";
|
||||||
@@ -205,131 +206,91 @@ function SignYourSelf() {
|
|||||||
}, [divRef.current, isHeader]);
|
}, [divRef.current, isHeader]);
|
||||||
//function for get document details for perticular signer with signer'object id
|
//function for get document details for perticular signer with signer'object id
|
||||||
const getDocumentDetails = async (showComplete) => {
|
const getDocumentDetails = async (showComplete) => {
|
||||||
let isCompleted;
|
try {
|
||||||
//getting document details
|
let isCompleted;
|
||||||
const documentData = await contractDocument(documentId);
|
//getting document details
|
||||||
|
const documentData = await contractDocument(documentId);
|
||||||
|
|
||||||
if (documentData && documentData.length > 0) {
|
if (documentData && documentData.length > 0) {
|
||||||
setPdfDetails(documentData);
|
setPdfDetails(documentData);
|
||||||
setExtUserId(documentData[0]?.ExtUserPtr?.objectId);
|
setExtUserId(documentData[0]?.ExtUserPtr?.objectId);
|
||||||
const url = documentData[0] && documentData[0]?.URL;
|
const url = documentData[0] && documentData[0]?.URL;
|
||||||
if (url) {
|
if (url) {
|
||||||
//convert document url in array buffer format to use embed widgets in pdf using pdf-lib
|
//convert document url in array buffer format to use embed widgets in pdf using pdf-lib
|
||||||
const arrayBuffer = await convertPdfArrayBuffer(url);
|
const arrayBuffer = await convertPdfArrayBuffer(url);
|
||||||
if (arrayBuffer === "Error") {
|
if (arrayBuffer === "Error") {
|
||||||
|
setHandleError("Error: Something went wrong!");
|
||||||
|
} else {
|
||||||
|
setPdfArrayBuffer(arrayBuffer);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
setHandleError("Error: Something went wrong!");
|
setHandleError("Error: Something went wrong!");
|
||||||
} else {
|
|
||||||
setPdfArrayBuffer(arrayBuffer);
|
|
||||||
}
|
}
|
||||||
} else {
|
isCompleted =
|
||||||
setHandleError("Error: Something went wrong!");
|
documentData[0].IsCompleted && documentData[0].IsCompleted;
|
||||||
}
|
if (isCompleted) {
|
||||||
isCompleted = documentData[0].IsCompleted && documentData[0].IsCompleted;
|
setIsCelebration(true);
|
||||||
if (isCompleted) {
|
setTimeout(() => {
|
||||||
setIsCelebration(true);
|
setIsCelebration(false);
|
||||||
setTimeout(() => {
|
}, 5000);
|
||||||
setIsCelebration(false);
|
setIsCompleted(true);
|
||||||
}, 5000);
|
setPdfUrl(documentData[0].SignedUrl);
|
||||||
setIsCompleted(true);
|
const alreadySign = {
|
||||||
setPdfUrl(documentData[0].SignedUrl);
|
status: true,
|
||||||
const alreadySign = {
|
mssg: "Congratulations! 🎉 This document has been successfully signed by you!"
|
||||||
status: true,
|
};
|
||||||
mssg: "Congratulations! 🎉 This document has been successfully signed by you!"
|
if (showComplete) {
|
||||||
};
|
setShowAlreadySignDoc(alreadySign);
|
||||||
if (showComplete) {
|
} else {
|
||||||
setShowAlreadySignDoc(alreadySign);
|
setIsUiLoading(false);
|
||||||
} else {
|
setIsSignPad(false);
|
||||||
setIsUiLoading(false);
|
setIsEmail(true);
|
||||||
setIsSignPad(false);
|
setXyPostion([]);
|
||||||
setIsEmail(true);
|
setSignBtnPosition([]);
|
||||||
setXyPostion([]);
|
|
||||||
setSignBtnPosition([]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (
|
|
||||||
documentData === "Error: Something went wrong!" ||
|
|
||||||
(documentData.result && documentData.result.error)
|
|
||||||
) {
|
|
||||||
const loadObj = {
|
|
||||||
isLoad: false
|
|
||||||
};
|
|
||||||
setHandleError("Error: Something went wrong!");
|
|
||||||
setIsLoading(loadObj);
|
|
||||||
} else {
|
|
||||||
setHandleError("No Data Found!");
|
|
||||||
const loadObj = {
|
|
||||||
isLoad: false
|
|
||||||
};
|
|
||||||
setIsLoading(loadObj);
|
|
||||||
}
|
|
||||||
await axios
|
|
||||||
.get(
|
|
||||||
`${localStorage.getItem(
|
|
||||||
"baseUrl"
|
|
||||||
)}classes/contracts_Signature?where={"UserId": {"__type": "Pointer","className": "_User", "objectId":"${
|
|
||||||
jsonSender.objectId
|
|
||||||
}"}}`,
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
|
|
||||||
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
} else if (
|
||||||
.then((Listdata) => {
|
documentData === "Error: Something went wrong!" ||
|
||||||
const json = Listdata.data;
|
(documentData.result && documentData.result.error)
|
||||||
const res = json.results;
|
) {
|
||||||
if (res[0] && res.length > 0) {
|
|
||||||
setDefaultSignImg(res[0].ImageURL);
|
|
||||||
setMyInitial(res[0]?.Initials);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.log("Err ", err);
|
|
||||||
const loadObj = {
|
const loadObj = {
|
||||||
isLoad: false
|
isLoad: false
|
||||||
};
|
};
|
||||||
setHandleError("Error: Something went wrong!");
|
setHandleError("Error: Something went wrong!");
|
||||||
setIsLoading(loadObj);
|
setIsLoading(loadObj);
|
||||||
});
|
|
||||||
const contractUsersRes = await contractUsers();
|
|
||||||
if (contractUsersRes === "Error: Something went wrong!") {
|
|
||||||
const loadObj = {
|
|
||||||
isLoad: false
|
|
||||||
};
|
|
||||||
setHandleError("Error: Something went wrong!");
|
|
||||||
setIsLoading(loadObj);
|
|
||||||
} else if (contractUsersRes[0] && contractUsersRes.length > 0) {
|
|
||||||
setActiveMailAdapter(contractUsersRes[0]?.active_mail_adapter);
|
|
||||||
setContractName("_Users");
|
|
||||||
setSignerUserId(contractUsersRes[0].objectId);
|
|
||||||
const tourstatuss =
|
|
||||||
contractUsersRes[0].TourStatus && contractUsersRes[0].TourStatus;
|
|
||||||
if (tourstatuss && tourstatuss.length > 0 && !isCompleted) {
|
|
||||||
setTourStatus(tourstatuss);
|
|
||||||
const checkTourRecipients = tourstatuss.filter(
|
|
||||||
(data) => data.signyourself
|
|
||||||
);
|
|
||||||
if (checkTourRecipients && checkTourRecipients.length > 0) {
|
|
||||||
setCheckTourStatus(checkTourRecipients[0].signyourself);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
setCheckTourStatus(true);
|
setHandleError("No Data Found!");
|
||||||
|
const loadObj = {
|
||||||
|
isLoad: false
|
||||||
|
};
|
||||||
|
setIsLoading(loadObj);
|
||||||
}
|
}
|
||||||
const loadObj = {
|
|
||||||
isLoad: false
|
|
||||||
};
|
|
||||||
setIsLoading(loadObj);
|
|
||||||
} else if (contractUsersRes.length === 0) {
|
|
||||||
const contractContactBook = await contactBook(jsonSender.objectId);
|
|
||||||
if (contractContactBook && contractContactBook.length > 0) {
|
|
||||||
setContractName("_Contactbook");
|
|
||||||
setSignerUserId(contractContactBook[0].objectId);
|
|
||||||
const tourstatuss =
|
|
||||||
contractContactBook[0].TourStatus &&
|
|
||||||
contractContactBook[0].TourStatus;
|
|
||||||
|
|
||||||
|
//function to get default signatur eof current user from `contracts_Signature` class
|
||||||
|
const defaultSignRes = await getDefaultSignature(jsonSender.objectId);
|
||||||
|
console.log("defaultSignRes", defaultSignRes);
|
||||||
|
if (defaultSignRes?.status === "success") {
|
||||||
|
setDefaultSignImg(defaultSignRes?.res?.defaultSignature);
|
||||||
|
setMyInitial(defaultSignRes?.res?.defaultInitial);
|
||||||
|
} else if (defaultSignRes?.status === "error") {
|
||||||
|
setHandleError("Error: Something went wrong!");
|
||||||
|
setIsLoading({
|
||||||
|
isLoad: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const contractUsersRes = await contractUsers();
|
||||||
|
if (contractUsersRes === "Error: Something went wrong!") {
|
||||||
|
const loadObj = {
|
||||||
|
isLoad: false
|
||||||
|
};
|
||||||
|
setHandleError("Error: Something went wrong!");
|
||||||
|
setIsLoading(loadObj);
|
||||||
|
} else if (contractUsersRes[0] && contractUsersRes.length > 0) {
|
||||||
|
setActiveMailAdapter(contractUsersRes[0]?.active_mail_adapter);
|
||||||
|
setContractName("_Users");
|
||||||
|
setSignerUserId(contractUsersRes[0].objectId);
|
||||||
|
const tourstatuss =
|
||||||
|
contractUsersRes[0].TourStatus && contractUsersRes[0].TourStatus;
|
||||||
if (tourstatuss && tourstatuss.length > 0 && !isCompleted) {
|
if (tourstatuss && tourstatuss.length > 0 && !isCompleted) {
|
||||||
setTourStatus(tourstatuss);
|
setTourStatus(tourstatuss);
|
||||||
const checkTourRecipients = tourstatuss.filter(
|
const checkTourRecipients = tourstatuss.filter(
|
||||||
@@ -341,15 +302,47 @@ function SignYourSelf() {
|
|||||||
} else {
|
} else {
|
||||||
setCheckTourStatus(true);
|
setCheckTourStatus(true);
|
||||||
}
|
}
|
||||||
} else {
|
const loadObj = {
|
||||||
setHandleError("No Data Found!");
|
isLoad: false
|
||||||
|
};
|
||||||
|
setIsLoading(loadObj);
|
||||||
|
} else if (contractUsersRes.length === 0) {
|
||||||
|
const contractContactBook = await contactBook(jsonSender.objectId);
|
||||||
|
if (contractContactBook && contractContactBook.length > 0) {
|
||||||
|
setContractName("_Contactbook");
|
||||||
|
setSignerUserId(contractContactBook[0].objectId);
|
||||||
|
const tourstatuss =
|
||||||
|
contractContactBook[0].TourStatus &&
|
||||||
|
contractContactBook[0].TourStatus;
|
||||||
|
|
||||||
|
if (tourstatuss && tourstatuss.length > 0 && !isCompleted) {
|
||||||
|
setTourStatus(tourstatuss);
|
||||||
|
const checkTourRecipients = tourstatuss.filter(
|
||||||
|
(data) => data.signyourself
|
||||||
|
);
|
||||||
|
if (checkTourRecipients && checkTourRecipients.length > 0) {
|
||||||
|
setCheckTourStatus(checkTourRecipients[0].signyourself);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setCheckTourStatus(true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setHandleError("No Data Found!");
|
||||||
|
}
|
||||||
|
const loadObj = {
|
||||||
|
isLoad: false
|
||||||
|
};
|
||||||
|
setIsLoading(loadObj);
|
||||||
}
|
}
|
||||||
const loadObj = {
|
} catch (err) {
|
||||||
|
console.log("Error: error in getDocumentDetails", err);
|
||||||
|
setHandleError("Error: Something went wrong!");
|
||||||
|
setIsLoading({
|
||||||
isLoad: false
|
isLoad: false
|
||||||
};
|
});
|
||||||
setIsLoading(loadObj);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getWidgetValue = (type) => {
|
const getWidgetValue = (type) => {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "name":
|
case "name":
|
||||||
@@ -1310,12 +1303,12 @@ function SignYourSelf() {
|
|||||||
isEmail={isEmail}
|
isEmail={isEmail}
|
||||||
pdfUrl={pdfUrl}
|
pdfUrl={pdfUrl}
|
||||||
setIsEmail={setIsEmail}
|
setIsEmail={setIsEmail}
|
||||||
pdfName={pdfDetails[0] && pdfDetails[0].Name}
|
|
||||||
setSuccessEmail={setSuccessEmail}
|
setSuccessEmail={setSuccessEmail}
|
||||||
sender={jsonSender}
|
sender={jsonSender}
|
||||||
setIsAlert={setIsAlert}
|
setIsAlert={setIsAlert}
|
||||||
extUserId={extUserId}
|
extUserId={extUserId}
|
||||||
activeMailAdapter={activeMailAdapter}
|
activeMailAdapter={activeMailAdapter}
|
||||||
|
pdfDetails={pdfDetails}
|
||||||
/>
|
/>
|
||||||
{/* pdf header which contain funish back button */}
|
{/* pdf header which contain funish back button */}
|
||||||
<Header
|
<Header
|
||||||
|
|||||||
Reference in New Issue
Block a user