extend expire date of expired draft document

This commit is contained in:
RaktimaNXG
2024-01-10 15:11:26 +05:30
parent 9cb0ced4f6
commit 148ae40e1a
4 changed files with 56 additions and 105 deletions
@@ -48,61 +48,32 @@ 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
) {
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
) {
navigate(`${hostUrl}placeHolderSign/${data.objectId}`);
}
//checking document is draft and signyourself type then user can sign document
else {
navigate(`${hostUrl}signaturePdf/${data.objectId}`);
//Inprogress document
else if (isPlaceholder?.length > 0 && signerExist?.length > 0) {
navigate(`${hostUrl}pdfRequestFiles/${data.objectId}`);
} //placeholder draft document
else if (
(signerExist?.length > 0 && !isPlaceholder) ||
(!signerExist && isPlaceholder?.length > 0)
) {
navigate(`${hostUrl}placeHolderSign/${data.objectId}`);
}
};