Skip to content

🔥 The free & Open Source DocuSign alternative

extend expire date of expired draft document

RaktimaNXG148ae40e1a3e
diff --git a/microfrontends/SignDocuments/src/Component/DraftDocument.js b/microfrontends/SignDocuments/src/Component/DraftDocument.js
index 6e292296a..1d9e57b0b 100644
--- a/microfrontends/SignDocuments/src/Component/DraftDocument.js
+++ b/microfrontends/SignDocuments/src/Component/DraftDocument.js
@@ -48,62 +48,33 @@ function DraftDocument() {
const handleDraftDoc = () => {
const data = pdfDetails[0];
const hostUrl = getHostUrl();
- const expireDate = data.ExpiryDate.iso;
- const expireUpdateDate = new Date(expireDate).getTime();
- const currDate = new Date().getTime();
const signerExist = data.Signers && data.Signers;
- const signUrl = data.SignedUrl && data.SignedUrl;
const isDecline = data.IsDeclined && data.IsDeclined;
const isPlaceholder = data.Placeholders && data.Placeholders;
- let isExpire = false;
- if (currDate > expireUpdateDate) {
- isExpire = true;
- }
- //checking if document has completed
- //checking if document has completed
+ //checking if document has completed and request signature flow
if (data?.IsCompleted && signerExist?.length > 0) {
navigate(`${hostUrl}pdfRequestFiles/${data.objectId}`);
-
- // window.location.hash = `/pdfRequestFiles/${data.objectId}`;
- } else if (data?.IsCompleted && signerExist?.length === 0) {
+ }
+ //checking if document has completed and signyour-self flow
+ else if (!signerExist && !isPlaceholder) {
navigate(`${hostUrl}signaturePdf/${data.objectId}`);
}
//checking if document has declined by someone
else if (isDecline) {
navigate(`${hostUrl}pdfRequestFiles/${data.objectId}`);
//checking draft type document
- } else if (
- (isExpire || !isExpire) &&
- !signerExist &&
- !isPlaceholder &&
- !signUrl
- ) {
- navigate(`${hostUrl}signaturePdf/${data.objectId}`);
- } else if (
- (isExpire || !isExpire) &&
- isPlaceholder &&
- signerExist?.length > 0
- ) {
+ }
+ //Inprogress document
+ else if (isPlaceholder?.length > 0 && signerExist?.length > 0) {
navigate(`${hostUrl}pdfRequestFiles/${data.objectId}`);
- } else if (
- (isExpire || !isExpire) &&
- signerExist?.length > 0 &&
- !isPlaceholder
- ) {
- navigate(`${hostUrl}placeHolderSign/${data.objectId}`);
- //checking draft type document
- } else if (
- (isExpire || !isExpire) &&
- signerExist?.length === 0 &&
- isPlaceholder
+ } //placeholder draft document
+ else if (
+ (signerExist?.length > 0 && !isPlaceholder) ||
+ (!signerExist && isPlaceholder?.length > 0)
) {
navigate(`${hostUrl}placeHolderSign/${data.objectId}`);
}
- //checking document is draft and signyourself type then user can sign document
- else {
- navigate(`${hostUrl}signaturePdf/${data.objectId}`);
- }
};
return (
diff --git a/microfrontends/SignDocuments/src/Component/LegaDrive/FolderDrive/legaDriveComponent.js b/microfrontends/SignDocuments/src/Component/LegaDrive/FolderDrive/legaDriveComponent.js
index 9c69c80c1..201849c57 100644
--- a/microfrontends/SignDocuments/src/Component/LegaDrive/FolderDrive/legaDriveComponent.js
+++ b/microfrontends/SignDocuments/src/Component/LegaDrive/FolderDrive/legaDriveComponent.js
@@ -111,60 +111,33 @@ function PdfFileComponent({
//function for navigate user to microapp-signature component
const checkPdfStatus = async (data) => {
const hostUrl = getHostUrl();
- const expireDate = data.ExpiryDate.iso;
- const expireUpdateDate = new Date(expireDate).getTime();
- const currDate = new Date().getTime();
+
const signerExist = data.Signers && data.Signers;
- const signUrl = data.SignedUrl && data.SignedUrl;
const isDecline = data.IsDeclined && data.IsDeclined;
const isPlaceholder = data.Placeholders && data.Placeholders;
- let isExpire = false;
- if (currDate > expireUpdateDate) {
- isExpire = true;
- }
- //checking if document has completed
+ //checking if document has completed and request signature flow
if (data?.IsCompleted && signerExist?.length > 0) {
navigate(`${hostUrl}pdfRequestFiles/${data.objectId}`);
-
- // window.location.hash = `/pdfRequestFiles/${data.objectId}`;
- } else if (data?.IsCompleted && signerExist?.length === 0) {
+ }
+ //checking if document has completed and signyour-self flow
+ else if (!signerExist && !isPlaceholder) {
navigate(`${hostUrl}signaturePdf/${data.objectId}`);
}
//checking if document has declined by someone
else if (isDecline) {
navigate(`${hostUrl}pdfRequestFiles/${data.objectId}`);
//checking draft type document
- } else if (
- (isExpire || !isExpire) &&
- !signerExist &&
- !isPlaceholder &&
- !signUrl
- ) {
- navigate(`${hostUrl}signaturePdf/${data.objectId}`);
- } else if (
- (isExpire || !isExpire) &&
- isPlaceholder &&
- signerExist?.length > 0
- ) {
+ }
+ //Inprogress document
+ else if (isPlaceholder?.length > 0 && signerExist?.length > 0) {
navigate(`${hostUrl}pdfRequestFiles/${data.objectId}`);
- } else if (
- (isExpire || !isExpire) &&
- signerExist?.length > 0 &&
- !isPlaceholder
+ } //placeholder draft document
+ else if (
+ (signerExist?.length > 0 && !isPlaceholder) ||
+ (!signerExist && isPlaceholder?.length > 0)
) {
navigate(`${hostUrl}placeHolderSign/${data.objectId}`);
- //checking draft type document
- } else if (
- (isExpire || !isExpire) &&
- signerExist?.length === 0 &&
- isPlaceholder
- ) {
- navigate(`${hostUrl}placeHolderSign/${data.objectId}`);
- }
- //checking document is draft and signyourself type then user can sign document
- else {
- navigate(`${hostUrl}signaturePdf/${data.objectId}`);
}
};
@@ -329,29 +302,15 @@ function PdfFileComponent({
status = "Completed";
} else if (isDecline) {
status = "Declined";
- } else if (
- !isExpire &&
- isPlaceholder?.length === 0 &&
- signerExist?.length > 0
- ) {
+ } else if (!signerExist || signerExist?.length === 0) {
status = "Draft";
} else if (
- !isExpire &&
- isPlaceholder?.length > 0 &&
- signerExist?.length === 0
- ) {
- status = "Draft";
- } else if (
- !isExpire &&
- isPlaceholder?.length === 0 &&
signerExist?.length > 0 &&
- !signUrl
+ (!isPlaceholder || isPlaceholder?.length === 0)
) {
status = "Draft";
} else if (isExpire) {
status = "Expired";
- } else if (!signUrl) {
- status = "Draft";
} else {
status = "In Progress";
}
diff --git a/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.js b/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.js
index 6e08e6e85..fef248eb6 100644
--- a/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.js
+++ b/microfrontends/SignDocuments/src/Component/LegaDrive/LegaDrive.js
@@ -294,7 +294,7 @@ function PdfFile() {
const handleFolderTab = (folderData, isMove) => {
return folderData.map((data, id) => {
return (
- <React.Fragment>
+ <React.Fragment key={id}>
<span
onClick={() => handleRoute(id)}
style={{
diff --git a/microfrontends/SignDocuments/src/Component/placeHolderSign.js b/microfrontends/SignDocuments/src/Component/placeHolderSign.js
index 8eff1ef3e..aae6c9594 100644
--- a/microfrontends/SignDocuments/src/Component/placeHolderSign.js
+++ b/microfrontends/SignDocuments/src/Component/placeHolderSign.js
@@ -639,6 +639,7 @@ function PlaceHolderSign() {
setIsSendAlert(alert);
}
};
+
const sendEmailToSigners = async () => {
const loadObj = {
isLoad: true,
@@ -723,12 +724,32 @@ function PlaceHolderSign() {
const currentUser = signersdata.find((x) => x.Email === currentId);
setCurrentId(currentUser?.objectId);
+ const expiryTime = new Date(expireDate).getTime();
+ const currDate = new Date().getTime();
+ let updateExpiryDate, data;
+ if (currDate > expiryTime) {
+ updateExpiryDate = new Date(expireDate);
+ updateExpiryDate.setDate(updateExpiryDate.getDate() + 15);
+ }
+
try {
- const data = {
- Placeholders: signerPos,
- SignedUrl: pdfDetails[0].URL,
- Signers: signers
- };
+ if (updateExpiryDate) {
+ data = {
+ Placeholders: signerPos,
+ SignedUrl: pdfDetails[0].URL,
+ Signers: signers,
+ ExpiryDate: {
+ iso: updateExpiryDate,
+ __type: "Date"
+ }
+ };
+ } else {
+ data = {
+ Placeholders: signerPos,
+ SignedUrl: pdfDetails[0].URL,
+ Signers: signers
+ };
+ }
await axios
.put(