+ {isDownloading === "certificate"}{" "}
Your completion certificate is being generated. Please wait
momentarily.
diff --git a/apps/OpenSign/src/components/pdf/RenderPdf.js b/apps/OpenSign/src/components/pdf/RenderPdf.js
index 5118dfcc1..716c404e2 100644
--- a/apps/OpenSign/src/components/pdf/RenderPdf.js
+++ b/apps/OpenSign/src/components/pdf/RenderPdf.js
@@ -211,27 +211,25 @@ function RenderPdf({
setCurrentSigner(true);
}
const handleAllUserName = (Id, Role, type) => {
- return pdfDetails[0].Signers.map((signerData, key) => {
- return (
- signerData.objectId === data.signerObjId && (
-
- {signerData?.Name && (
-
- {signerData.Name}
-
- )}
- {type && (
- {type}
- )}
- {Role && (
-
- {`(${Role})`}
-
- )}
-
- )
- );
- });
+ return (
+
+
+ {
+ pdfDetails[0].Signers?.find(
+ (signer) => signer.objectId === data.signerObjId
+ )?.Name
+ }
+
+ {type && (
+ {type}
+ )}
+ {Role && (
+
+ {`(${Role})`}
+
+ )}
+
+ );
};
return (
diff --git a/apps/OpenSign/src/components/shared/fields/SuggestionInput.js b/apps/OpenSign/src/components/shared/fields/SuggestionInput.js
index 6efaf66a8..aaefb2b30 100644
--- a/apps/OpenSign/src/components/shared/fields/SuggestionInput.js
+++ b/apps/OpenSign/src/components/shared/fields/SuggestionInput.js
@@ -66,7 +66,7 @@ const SuggestionInput = (props) => {
type={props?.type || "text"}
value={inputValue}
onChange={handleInputChange}
- placeholder="Enter text..."
+ placeholder="Enter Email..."
className="w-full border-[1px] border-gray-400 p-2 text-black rounded"
required={props.required}
/>
diff --git a/apps/OpenSign/src/constant/Utils.js b/apps/OpenSign/src/constant/Utils.js
index 7cb9be16b..147d360d2 100644
--- a/apps/OpenSign/src/constant/Utils.js
+++ b/apps/OpenSign/src/constant/Utils.js
@@ -2034,8 +2034,13 @@ export const handleSendOTP = async (email) => {
}
};
//handle download signed pdf
-export const handleDownloadPdf = async (pdfDetails, pdfUrl) => {
+export const handleDownloadPdf = async (
+ pdfDetails,
+ pdfUrl,
+ setIsDownloading
+) => {
const pdfName = pdfDetails[0] && pdfDetails[0].Name;
+ setIsDownloading("pdf");
try {
// const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl });
const axiosRes = await axios.post(
@@ -2051,8 +2056,10 @@ export const handleDownloadPdf = async (pdfDetails, pdfUrl) => {
);
const url = axiosRes.data.result;
saveAs(url, `${sanitizeFileName(pdfName)}_signed_by_OpenSign™.pdf`);
+ setIsDownloading("");
} catch (err) {
console.log("err in getsignedurl", err);
+ setIsDownloading("");
alert("something went wrong, please try again later.");
}
};
@@ -2062,9 +2069,9 @@ export const sanitizeFileName = (pdfName) => {
return pdfName.replace(/ /g, "_");
};
//function for print digital sign pdf
-export const handleToPrint = async (event, pdfUrl) => {
+export const handleToPrint = async (event, pdfUrl, setIsDownloading) => {
event.preventDefault();
-
+ setIsDownloading("pdf");
try {
// const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl });
const axiosRes = await axios.post(
@@ -2094,10 +2101,13 @@ export const handleToPrint = async (event, pdfUrl) => {
const blob = new Blob([byteArray], { type: "application/pdf" });
const blobUrl = URL.createObjectURL(blob);
window.open(blobUrl, "_blank");
+ setIsDownloading("");
} else {
printModule({ printable: pdf, type: "pdf", base64: true });
+ setIsDownloading("");
}
} catch (err) {
+ setIsDownloading("");
console.log("err in getsignedurl", err);
alert("something went wrong, please try again later.");
}
@@ -2106,7 +2116,7 @@ export const handleToPrint = async (event, pdfUrl) => {
//handle download signed pdf
export const handleDownloadCertificate = async (
pdfDetails,
- setIsCertificate
+ setIsDownloading
) => {
if (pdfDetails?.length > 0 && pdfDetails[0]?.CertificateUrl) {
try {
@@ -2117,7 +2127,7 @@ export const handleDownloadCertificate = async (
console.log("err in download in certificate", err);
}
} else {
- setIsCertificate(true);
+ setIsDownloading("certificate");
try {
const data = {
docId: pdfDetails[0]?.objectId
@@ -2139,9 +2149,9 @@ export const handleDownloadCertificate = async (
await fetch(doc?.CertificateUrl);
const certificateUrl = doc?.CertificateUrl;
saveAs(certificateUrl, `Certificate_signed_by_OpenSign™.pdf`);
- setIsCertificate(false);
+ setIsDownloading("");
} else {
- setIsCertificate(true);
+ setIsDownloading("certificate");
}
}
} catch (err) {
@@ -2150,7 +2160,7 @@ export const handleDownloadCertificate = async (
}
}
};
- export async function findContact(value) {
+export async function findContact(value) {
try {
const currentUser = Parse.User.current();
const contactbook = new Parse.Query("contracts_Contactbook");
diff --git a/apps/OpenSign/src/json/ReportJson.js b/apps/OpenSign/src/json/ReportJson.js
index f16efca1c..705ce8fb9 100644
--- a/apps/OpenSign/src/json/ReportJson.js
+++ b/apps/OpenSign/src/json/ReportJson.js
@@ -3,7 +3,7 @@ export default function reportJson(id) {
const head = ["Sr.No", "Title", "Note", "Folder", "File", "Owner", "Signers"];
const contactbook = ["Sr.No", "Title", "Email", "Phone"];
const dashboardReportHead = ["Title", "File", "Owner", "Signers"];
-
+ const templateReport = ["Sr.No", "Title", "File", "Owner", "Signers"];
switch (id) {
// draft documents report
case "ByHuevtCFY":
@@ -326,7 +326,7 @@ export default function reportJson(id) {
case "6TeaPr321t":
return {
reportName: "Templates",
- heading: head,
+ heading: templateReport,
actions: [
{
btnId: "2234",
@@ -341,6 +341,17 @@ export default function reportJson(id) {
message:
"Click the 'Use' button to create a new document from an existing template. "
},
+ {
+ btnId: "1631",
+ btnLabel: "Quick send",
+ hoverLabel: "Quick send",
+ btnIcon: "fa-solid fa-envelope",
+ redirectUrl: "",
+ action: "bulksend",
+ selector: "tourbulksend",
+ message:
+ "To quickly create and send multiple documents using an existing template, click the 'Quick Send' button."
+ },
{
btnId: "2234",
hoverLabel: "option",
@@ -360,14 +371,6 @@ export default function reportJson(id) {
redirectUrl: "template",
action: "redirect"
},
- {
- btnId: "1631",
- btnLabel: "Quick send",
- hoverLabel: "Quick send",
- btnIcon: "fa-solid fa-envelope",
- redirectUrl: "",
- action: "bulksend"
- },
{
btnId: "1834",
btnLabel: "Delete",
diff --git a/apps/OpenSign/src/pages/GuestLogin.js b/apps/OpenSign/src/pages/GuestLogin.js
index 6647e1ee5..aad55b42a 100644
--- a/apps/OpenSign/src/pages/GuestLogin.js
+++ b/apps/OpenSign/src/pages/GuestLogin.js
@@ -169,10 +169,10 @@ function GuestLogin() {
e.preventDefault();
const params = { ...contact, docId: documentId };
try {
+ setLoading(true);
const linkContactRes = await Parse.Cloud.run("linkcontacttodoc", params);
// console.log("linkContactRes ", linkContactRes);
setContactId(linkContactRes.contactId);
- setLoading(true);
setEnterOtp(true);
await SendOtp();
} catch (err) {
diff --git a/apps/OpenSign/src/pages/PdfRequestFiles.js b/apps/OpenSign/src/pages/PdfRequestFiles.js
index ad36b8517..b0be26095 100644
--- a/apps/OpenSign/src/pages/PdfRequestFiles.js
+++ b/apps/OpenSign/src/pages/PdfRequestFiles.js
@@ -95,7 +95,7 @@ function PdfRequestFiles() {
const [expiredDate, setExpiredDate] = useState("");
const [signerUserId, setSignerUserId] = useState();
const [isDontShow, setIsDontShow] = useState(false);
- const [isCertificate, setIsCertificate] = useState(false);
+ const [isDownloading, setIsDownloading] = useState("");
const [defaultSignAlert, setDefaultSignAlert] = useState({
isShow: false,
alertMessage: ""
@@ -278,6 +278,10 @@ function PdfRequestFiles() {
};
setAlreadySign(true);
setIsCompleted(data);
+ setIsCelebration(true);
+ setTimeout(() => {
+ setIsCelebration(false);
+ }, 5000);
} else if (declined) {
const currentDecline = {
currnt: "another",
@@ -290,6 +294,13 @@ function PdfRequestFiles() {
);
setIsExpired(true);
setExpiredDate(expireDateFormat);
+ } // Check if the current signer is not a last signer and handle the complete message.
+ else if (isNextUser) {
+ 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."
+ });
}
const isGuestSign = location.pathname.includes("/load/");
@@ -319,164 +330,157 @@ function PdfRequestFiles() {
}
}
}
- if (documentData.length > 0) {
- const checkDocIdExist =
- documentData[0].AuditTrail &&
- documentData[0].AuditTrail.length > 0 &&
- documentData[0].AuditTrail.filter(
- (data) => data.Activity === "Signed"
- );
+ const checkDocIdExist =
+ 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"
- );
+ 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 (
- checkAlreadySign &&
- checkAlreadySign[0] &&
- checkAlreadySign.length > 0
+ obj &&
+ obj.Signers &&
+ obj.Signers.length > 0 &&
+ obj.Placeholders &&
+ obj.Placeholders.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
- }
- };
+ 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")
- }
+ 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 = [];
-
- //check document is signed or not
- if (checkDocIdExist && checkDocIdExist.length > 0) {
- setIsDocId(true);
- const signerRes = documentData[0].Signers;
- //comparison auditTrail user details with signers user details
- for (let i = 0; i < signerRes.length; i++) {
- const signerId = signerRes[i].objectId;
-
- let isSignedSignature = false;
- for (let j = 0; j < checkDocIdExist.length; j++) {
- const signedExist =
- checkDocIdExist[j] && checkDocIdExist[j].UserPtr.objectId;
- //checking signerObjId and auditTrail User objId
- // if match then add signed data in signer array and break loop
-
- if (signerId === signedExist) {
- signers.push({ ...signerRes[i], ...signerRes[i] });
- isSignedSignature = true;
- break;
}
- // if does not match then add unsigned data in unSignedSigner array
- }
- if (!isSignedSignature) {
- unSignedSigner.push({ ...signerRes[i], ...signerRes[i] });
- }
+ );
+ } catch (err) {
+ console.log("Err ", err);
}
- setSignedSigners(signers);
- setUnSignedSigners(unSignedSigner);
+ }
+ }
- setSignerPos(documentData[0].Placeholders);
- } else {
- let unsigned = [];
- for (let i = 0; i < documentData.length; i++) {
- unsigned.push(documentData[i].Signers);
+ let signers = [];
+ let unSignedSigner = [];
+
+ //check document is signed or not
+ if (checkDocIdExist && checkDocIdExist.length > 0) {
+ setIsDocId(true);
+ const signerRes = documentData[0].Signers;
+ //comparison auditTrail user details with signers user details
+ for (let i = 0; i < signerRes.length; i++) {
+ const signerId = signerRes[i].objectId;
+
+ let isSignedSignature = false;
+ for (let j = 0; j < checkDocIdExist.length; j++) {
+ const signedExist =
+ checkDocIdExist[j] && checkDocIdExist[j].UserPtr.objectId;
+ //checking signerObjId and auditTrail User objId
+ // if match then add signed data in signer array and break loop
+
+ if (signerId === signedExist) {
+ signers.push({ ...signerRes[i], ...signerRes[i] });
+ isSignedSignature = true;
+ break;
+ }
+ // if does not match then add unsigned data in unSignedSigner array
}
- setUnSignedSigners(unsigned[0]);
- setSignerPos(documentData[0].Placeholders);
- }
- setPdfDetails(documentData);
- // Check if the current signer is not a last signer and handle the complete message.
- if (isNextUser) {
- const getSignedAuditTrail = documentData[0].AuditTrail.filter(
- (data) => data.Activity === "Signed"
- );
- const isLastSigner =
- getSignedAuditTrail?.length === documentData?.[0]?.Signers?.length;
- if (!isLastSigner) {
- 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 {
- setIsCelebration(true);
- setTimeout(() => {
- setIsCelebration(false);
- }, 5000);
+ if (!isSignedSignature) {
+ unSignedSigner.push({ ...signerRes[i], ...signerRes[i] });
}
}
- //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(false);
- } 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 status
- const localuser = localStorage.getItem(
- `Parse/${appInfo.appId}/currentUser`
- );
- const currentUser = JSON.parse(JSON.stringify(localuser));
- const currentUserEmail = currentUser.email;
- const res = await contractUsers(currentUserEmail);
+ setSignedSigners(signers);
+ setUnSignedSigners(unSignedSigner);
+ setSignerPos(documentData[0].Placeholders);
+ } else {
+ let unsigned = [];
+ for (let i = 0; i < documentData.length; i++) {
+ unsigned.push(documentData[i].Signers);
+ }
+ setUnSignedSigners(unsigned[0]);
+ 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(false);
+ } 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 status
+ const localuser = localStorage.getItem(
+ `Parse/${appInfo.appId}/currentUser`
+ );
+ const currentUser = JSON.parse(JSON.stringify(localuser));
+ const currentUserEmail = currentUser.email;
+ const res = await contractUsers(currentUserEmail);
+ 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 tourstatus = res[0].TourStatus && res[0].TourStatus;
+ if (tourstatus && tourstatus.length > 0) {
+ setTourStatus(tourstatus);
+ const checkTourRequestSign = tourstatus.filter(
+ (data) => data.requestSign
+ );
+ if (checkTourRequestSign && checkTourRequestSign.length > 0) {
+ setRequestSignTour(checkTourRequestSign[0].requestSign);
+ }
+ }
+ } else if (res?.length === 0) {
+ const res = await contactBook(currUserId);
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);
+ } else if (res[0] && res.length) {
+ setContractName("_Contactbook");
+ const objectId = res[0].objectId;
+ setSignerUserId(objectId);
const tourstatus = res[0].TourStatus && res[0].TourStatus;
if (tourstatus && tourstatus.length > 0) {
setTourStatus(tourstatus);
@@ -487,33 +491,12 @@ function PdfRequestFiles() {
setRequestSignTour(checkTourRequestSign[0].requestSign);
}
}
- } else if (res?.length === 0) {
- 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 tourstatus = res[0].TourStatus && res[0].TourStatus;
- if (tourstatus && tourstatus.length > 0) {
- setTourStatus(tourstatus);
- const checkTourRequestSign = tourstatus.filter(
- (data) => data.requestSign
- );
- if (checkTourRequestSign && checkTourRequestSign.length > 0) {
- setRequestSignTour(checkTourRequestSign[0].requestSign);
- }
- }
- } else if (res.length === 0) {
- setHandleError("Error: User does not exist!");
- }
+ } else if (res.length === 0) {
+ setHandleError("Error: User does not exist!");
}
}
- setIsUiLoading(false);
- } else {
- alert("No data found!");
}
+ setIsUiLoading(false);
} else if (
documentData === "Error: Something went wrong!" ||
(documentData.result && documentData.result.error)
@@ -804,7 +787,10 @@ function PdfRequestFiles() {
(x) => x.Email === jsonSender.email
);
const newIndex = index + 1;
- const user = pdfDetails?.[0].Signers[newIndex];
+ const usermail = {
+ Email: pdfDetails?.[0]?.Placeholders[newIndex]?.email || ""
+ };
+ const user = usermail || pdfDetails?.[0]?.Signers[newIndex];
if (sendmail !== "false" && sendInOrder) {
const requestBody = pdfDetails?.[0]?.RequestBody;
const requestSubject = pdfDetails?.[0]?.RequestSubject;
@@ -828,19 +814,26 @@ function PdfRequestFiles() {
"https://qikinnovation.ams3.digitaloceanspaces.com/logo.png";
let url = `${localStorage.getItem(
"baseUrl"
- )}functions/sendmailv3/`;
+ )}functions/sendmailv3`;
const headers = {
"Content-Type": "application/json",
"X-Parse-Application-Id":
localStorage.getItem("parseAppId"),
sessionToken: localStorage.getItem("accesstoken")
};
- const objectId = user.objectId;
+ const objectId = user?.objectId;
const hostUrl = window.location.origin;
//encode this url value `${pdfDetails?.[0].objectId}/${user.Email}/${objectId}` to base64 using `btoa` function
- const encodeBase64 = btoa(
- `${pdfDetails?.[0].objectId}/${user.Email}/${objectId}`
- );
+ let encodeBase64;
+ if (objectId) {
+ encodeBase64 = btoa(
+ `${pdfDetails?.[0].objectId}/${user.Email}/${objectId}`
+ );
+ } else {
+ encodeBase64 = btoa(
+ `${pdfDetails?.[0].objectId}/${user.Email}`
+ );
+ }
let signPdf = `${hostUrl}/login/${encodeBase64}`;
const openSignUrl =
"https://www.opensignlabs.com/contact-us";
@@ -1605,7 +1598,7 @@ function PdfRequestFiles() {
onClick={() =>
handleDownloadCertificate(
pdfDetails,
- setIsCertificate
+ setIsDownloading
)
}
className="flex flex-row items-center shadow rounded-[3px] py-[3px] px-[11px] text-white font-[500] text-[13px] mr-[5px] bg-[#08bc66]"
@@ -1619,7 +1612,9 @@ function PdfRequestFiles() {