From 1f161238652497d4b8ebd2fbcf0ce587b7487b58 Mon Sep 17 00:00:00 2001 From: RaktimaNXG Date: Fri, 19 Jan 2024 21:17:38 +0530 Subject: [PATCH] fix: draft type document in open-sign drive & disable placeholder click behavior for other signers in mobile view --- .../src/Component/DraftDocument.js | 8 +- .../FolderDrive/legaDriveComponent.js | 15 +- .../src/Component/TemplatePlaceholder.js | 1 - .../Component/WidgetComponent/placeholder.js | 8 +- .../src/Component/component/renderPdf.js | 186 +++++++++--------- 5 files changed, 123 insertions(+), 95 deletions(-) diff --git a/microfrontends/SignDocuments/src/Component/DraftDocument.js b/microfrontends/SignDocuments/src/Component/DraftDocument.js index 8384871f4..6fa85e818 100644 --- a/microfrontends/SignDocuments/src/Component/DraftDocument.js +++ b/microfrontends/SignDocuments/src/Component/DraftDocument.js @@ -51,7 +51,7 @@ function DraftDocument() { const signerExist = data.Signers && data.Signers; const isDecline = data.IsDeclined && data.IsDeclined; const isPlaceholder = data.Placeholders && data.Placeholders; - + const signedUrl = data.SignedUrl; //checking if document has completed and request signature flow if (data?.IsCompleted && signerExist?.length > 0) { navigate(`${hostUrl}pdfRequestFiles/${data.objectId}`); @@ -64,6 +64,12 @@ function DraftDocument() { else if (isDecline) { navigate(`${hostUrl}pdfRequestFiles/${data.objectId}`); //checking draft type document + } else if ( + signerExist?.length > 0 && + isPlaceholder?.length > 0 && + !signedUrl + ) { + navigate(`${hostUrl}placeHolderSign/${data.objectId}`); } //Inprogress document else if (isPlaceholder?.length > 0 && signerExist?.length > 0) { diff --git a/microfrontends/SignDocuments/src/Component/LegaDrive/FolderDrive/legaDriveComponent.js b/microfrontends/SignDocuments/src/Component/LegaDrive/FolderDrive/legaDriveComponent.js index 5edf387e7..e080a49da 100644 --- a/microfrontends/SignDocuments/src/Component/LegaDrive/FolderDrive/legaDriveComponent.js +++ b/microfrontends/SignDocuments/src/Component/LegaDrive/FolderDrive/legaDriveComponent.js @@ -119,7 +119,7 @@ function PdfFileComponent({ const signerExist = data.Signers && data.Signers; const isDecline = data.IsDeclined && data.IsDeclined; const isPlaceholder = data.Placeholders && data.Placeholders; - + const signedUrl = data.SignedUrl; //checking if document has completed and request signature flow if (data?.IsCompleted && signerExist?.length > 0) { navigate(`${hostUrl}pdfRequestFiles/${data.objectId}`); @@ -132,6 +132,12 @@ function PdfFileComponent({ else if (isDecline) { navigate(`${hostUrl}pdfRequestFiles/${data.objectId}`); //checking draft type document + } else if ( + signerExist?.length > 0 && + isPlaceholder?.length > 0 && + !signedUrl + ) { + navigate(`${hostUrl}placeHolderSign/${data.objectId}`); } //Inprogress document else if (isPlaceholder?.length > 0 && signerExist?.length > 0) { @@ -297,6 +303,7 @@ function PdfFileComponent({ isDecline = data.IsDeclined && data.IsDeclined; isPlaceholder = data.Placeholders && data.Placeholders; signerExist = data.Signers && data.Signers; + const signedUrl = data.SignedUrl; const expireUpdateDate = new Date(expireDate).getTime(); const currDate = new Date().getTime(); @@ -316,6 +323,12 @@ function PdfFileComponent({ (!isPlaceholder || isPlaceholder?.length === 0) ) { status = "Draft"; + } else if ( + signerExist?.length > 0 && + isPlaceholder?.length > 0 && + !signedUrl + ) { + status = "Draft"; } else if (isExpire) { status = "Expired"; } else { diff --git a/microfrontends/SignDocuments/src/Component/TemplatePlaceholder.js b/microfrontends/SignDocuments/src/Component/TemplatePlaceholder.js index 1804cd82e..30e814e71 100644 --- a/microfrontends/SignDocuments/src/Component/TemplatePlaceholder.js +++ b/microfrontends/SignDocuments/src/Component/TemplatePlaceholder.js @@ -666,7 +666,6 @@ const TemplatePlaceholder = () => { try { const data = { Placeholders: signerPos, - SignedUrl: pdfDetails[0].URL, Signers: signers, Name: pdfDetails[0]?.Name || "", Note: pdfDetails[0]?.Note || "", diff --git a/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholder.js b/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholder.js index 21debfff4..2db145f79 100644 --- a/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholder.js +++ b/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholder.js @@ -186,7 +186,13 @@ function Placeholder(props) { height: props.posHeight(props.pos, props.isSignYourself), zIndex: "10" }} - onTouchEnd={(e) => handlePlaceholderClick()} + onTouchEnd={(e) => { + props.isNeedSign && props.data?.signerObjId === props.signerObjId + ? handlePlaceholderClick() + : props.isPlaceholder + ? handlePlaceholderClick() + : props.isSignYourself && handlePlaceholderClick(); + }} > {props.isShowBorder && ( <> diff --git a/microfrontends/SignDocuments/src/Component/component/renderPdf.js b/microfrontends/SignDocuments/src/Component/component/renderPdf.js index 184a51b3a..233423311 100644 --- a/microfrontends/SignDocuments/src/Component/component/renderPdf.js +++ b/microfrontends/SignDocuments/src/Component/component/renderPdf.js @@ -1,9 +1,7 @@ import React from "react"; import RSC from "react-scrollbars-custom"; -import { Rnd } from "react-rnd"; -import { themeColor } from "../../utils/ThemeColor/backColor"; import { Document, Page, pdfjs } from "react-pdf"; -import BorderResize from "./borderResize"; + import { addZIndex, defaultWidthHeight, @@ -739,36 +737,38 @@ function RenderPdf({ // // // - + + + ); })} @@ -1191,36 +1191,38 @@ function RenderPdf({ // // // - + + + ); })} @@ -1302,34 +1304,36 @@ function RenderPdf({ // /> // // - - handleStop(event, dragElement, pos.type) - } - handleSignYourselfImageResize={ - handleSignYourselfImageResize - } - index={index} - xyPostion={xyPostion} - setXyPostion={setXyPostion} - pdfOriginalWidth={pdfOriginalWidth} - containerWH={containerWH} - setIsSignPad={setIsSignPad} - isShowBorder={true} - isSignYourself={true} - xPos={xPos} - yPos={yPos} - posWidth={posWidth} - posHeight={posHeight} - pdfDetails={pdfDetails[0]} - isDragging={isDragging} - /> + + + handleStop(event, dragElement, pos.type) + } + handleSignYourselfImageResize={ + handleSignYourselfImageResize + } + index={index} + xyPostion={xyPostion} + setXyPostion={setXyPostion} + pdfOriginalWidth={pdfOriginalWidth} + containerWH={containerWH} + setIsSignPad={setIsSignPad} + isShowBorder={true} + isSignYourself={true} + xPos={xPos} + yPos={yPos} + posWidth={posWidth} + posHeight={posHeight} + pdfDetails={pdfDetails[0]} + isDragging={isDragging} + /> + ) ); })}