diff --git a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js
index acfeca3e5..053c5ca78 100644
--- a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js
+++ b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js
@@ -18,7 +18,8 @@ import {
getBase64FromUrl,
urlValidator,
multiSignEmbed,
- embedDocId
+ embedDocId,
+ pdfNewWidthFun
} from "../utils/Utils";
import Loader from "./component/loader";
import HandleError from "./component/HandleError";
@@ -92,19 +93,14 @@ function PdfRequestFiles() {
const jsonSender = JSON.parse(senderUser);
useEffect(() => {
- const clientWidth = window.innerWidth;
- const value = docId ? 80 : 30;
- const pdfWidth = clientWidth - 160 - 200 - value;
-
- //160 is width of left side, 200 is width of right side component and 50 is space of middle compoent
- //pdf from left and right component
- setPdfNewWidth(pdfWidth);
if (documentId) {
getDocumentDetails();
}
}, []);
useEffect(() => {
if (divRef.current) {
+ const pdfWidth = pdfNewWidthFun(divRef);
+ setPdfNewWidth(pdfWidth);
setContainerWH({
width: divRef.current.offsetWidth,
height: divRef.current.offsetHeight
diff --git a/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js b/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js
index d072f2a3d..e816f99d6 100644
--- a/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js
+++ b/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js
@@ -20,7 +20,8 @@ import {
contractDocument,
getBase64FromIMG,
embedDocId,
- multiSignEmbed
+ multiSignEmbed,
+ pdfNewWidthFun
} from "../utils/Utils";
import { useParams } from "react-router-dom";
import Tour from "reactour";
@@ -81,7 +82,7 @@ function SignYourSelf() {
status: false,
type: "load"
});
-
+ const divRef = useRef(null);
const nodeRef = useRef(null);
const [{ isOver }, drop] = useDrop({
accept: "BOX",
@@ -168,17 +169,18 @@ function SignYourSelf() {
const jsonSender = JSON.parse(senderUser);
useEffect(() => {
- const clientWidth = window.innerWidth;
- const value = docId ? 80 : 80;
- const pdfWidth = clientWidth - 160 - 200 - value;
- //160 is width of left side, 200 is width of right side component and 50 is space of middle compoent
- //pdf from left and right component
- setPdfNewWidth(pdfWidth);
if (documentId) {
getDocumentDetails(true);
}
}, []);
+ useEffect(() => {
+ if (divRef.current) {
+ const pdfWidth = pdfNewWidthFun(divRef);
+ setPdfNewWidth(pdfWidth);
+ }
+ }, [divRef.current]);
+
//function for get document details for perticular signer with signer'object id
const getDocumentDetails = async (showComplete) => {
//getting document details
@@ -188,18 +190,19 @@ function SignYourSelf() {
setPdfDetails(documentData);
const isCompleted =
documentData[0].IsCompleted && documentData[0].IsCompleted;
- if (isCompleted && showComplete) {
+ if (isCompleted) {
const docStatus = {
isCompleted: isCompleted
};
-
setDocumentStatus(docStatus);
+ setPdfUrl(documentData[0].SignedUrl);
const alreadySign = {
status: true,
mssg: "You have successfully signed the document!"
};
- setShowAlreadySignDoc(alreadySign);
- setPdfUrl(documentData[0].SignedUrl);
+ if (showComplete) {
+ setShowAlreadySignDoc(alreadySign);
+ }
}
} else if (
documentData === "Error: Something went wrong!" ||
@@ -874,7 +877,7 @@ function SignYourSelf() {
) : noData ? (