diff --git a/apps/OpenSign/src/components/pdf/Placeholder.js b/apps/OpenSign/src/components/pdf/Placeholder.js index 2d956019f..2cbeafaa4 100644 --- a/apps/OpenSign/src/components/pdf/Placeholder.js +++ b/apps/OpenSign/src/components/pdf/Placeholder.js @@ -562,6 +562,55 @@ function Placeholder(props) { ) ); }; + const xPos = (pos, signYourself) => { + const containerScale = props.containerWH.width / props.pdfOriginalWH.width; + const resizePos = pos.xPosition; + if (signYourself) { + return resizePos * containerScale * props.scale; + } else { + //checking both condition mobile and desktop view + // if (pos.isMobile && pos.scale) { + // if (props.scale > 1) { + // return resizePos * pos.scale * containerScale * props.scale; + // } else { + // return resizePos * pos.scale * containerScale; + // } + // } else { + // if (pos.scale === containerScale) { + // return resizePos * pos.scale * props.scale; + // } else { + // return resizePos * pos.scale * containerScale * props.scale; + // } + // } + return resizePos * containerScale * props.scale; + } + }; + const yPos = (pos, signYourself) => { + const containerScale = props.containerWH.width / props.pdfOriginalWH.width; + const resizePos = pos.yPosition; + + if (signYourself) { + return resizePos * containerScale * props.scale; + } else { + // checking both condition mobile and desktop view + // if (pos.isMobile && pos.scale) { + // if (props.scale > 1) { + // return resizePos * pos.scale * containerScale * props.scale; + // } else { + // return resizePos * pos.scale * containerScale; + // } + // } else if (pos.scale === containerScale) { + // if (props.scale > 1) { + // return resizePos * pos.scale * props.scale; + // } else { + // return resizePos * pos.scale; + // } + // } else { + // return resizePos * containerScale; + // } + return resizePos * containerScale * props.scale; + } + }; return ( { setPlaceholderBorder({ @@ -719,8 +768,8 @@ function Placeholder(props) {
{ - // if ( - // ["name", "email", "job title", "company"].includes(type) && - // props.isNeedSign && - // props.data?.signerObjId === props.signerObjId - // ) { - // const isDefault = true; - // const senderUser = localStorage.getItem(`Extand_Class`); - // const jsonSender = JSON.parse(senderUser); - // onChangeInput( - // jsonSender && jsonSender[0], - // null, - // props.xyPostion, - // null, - // props.setXyPostion, - // props.data.Id, - // isDefault - // ); - // } - // // eslint-disable-next-line react-hooks/exhaustive-deps - // }, [type]); + useEffect(() => { + if ( + ["name", "email", "job title", "company"].includes(type) && + props.isNeedSign && + props.data?.signerObjId === props.signerObjId + ) { + const isDefault = true; + const senderUser = localStorage.getItem(`Extand_Class`); + const jsonSender = JSON.parse(senderUser); + onChangeInput( + jsonSender && jsonSender[0], + null, + props.xyPostion, + null, + props.setXyPostion, + props.data.Id, + isDefault + ); + } + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [type]); const calculateFontSize = () => { const fontSize = 10 + Math.min(props.pos.Width, props.pos.Height) * 0.1; @@ -319,7 +319,6 @@ function PlaceholderType(props) { props?.data?.Role, props?.pos?.type )} - {/* {props.xPos(props.pos, props.isSignYourself)} */}
); case "stamp": diff --git a/apps/OpenSign/src/components/pdf/RenderPdf.js b/apps/OpenSign/src/components/pdf/RenderPdf.js index 3fb0bcfe0..2c44d92a3 100644 --- a/apps/OpenSign/src/components/pdf/RenderPdf.js +++ b/apps/OpenSign/src/components/pdf/RenderPdf.js @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from "react"; +import React, { useState } from "react"; import RSC from "react-scrollbars-custom"; import { Document, Page } from "react-pdf"; import { @@ -58,7 +58,6 @@ function RenderPdf({ setTempSignerId, uniqueId, setPdfRenderHeight, - isResize, pdfOriginalWH, scale }) { @@ -121,90 +120,24 @@ function RenderPdf({ } } }; - const xPos = (pos, signYourself) => { - const containerScale = containerWH.width / pdfOriginalWH.width; - const resizePos = pos.xPosition; - - if (signYourself) { - return resizePos * containerScale * scale; - } else { - //checking both condition mobile and desktop view - if (pos.isMobile && pos.scale) { - if (scale > 1) { - return resizePos * pos.scale * containerScale * scale; - } else { - return resizePos * pos.scale * containerScale; - } - } else if (pos.scale === containerScale) { - if (scale > 1) { - return resizePos * pos.scale * scale; - } else { - return resizePos * pos.scale; - } - } else { - if (pos.scale === containerScale) { - if (scale > 1) { - return resizePos * pos.scale * scale; - } else { - return resizePos * pos.scale; - } - } else { - return resizePos * containerScale; - } - } - } - }; - const yPos = (pos, signYourself) => { - const containerScale = containerWH.width / pdfOriginalWH.width; - const resizePos = pos.yPosition; - - if (signYourself) { - // if (pos.scale === containerScale) { - // if (scale > 1) { - // return resizePos * pos.scale * scale; - // } else { - // return resizePos * pos.scale; - // } - // } else { - return resizePos * containerScale * scale; - // } - } else { - // checking both condition mobile and desktop view - if (pos.isMobile && pos.scale) { - if (scale > 1) { - return resizePos * pos.scale * containerScale * scale; - } else { - return resizePos * pos.scale * containerScale; - } - } else if (pos.scale === containerScale) { - if (scale > 1) { - return resizePos * pos.scale * scale; - } else { - return resizePos * pos.scale; - } - } else { - return resizePos * containerScale; - } - } - }; //function for render placeholder block over pdf document - const CheckSignedSignes = ({ data }) => { + const checkSignedSignes = (data) => { let checkSign = []; //condition to handle quick send flow and using normal request sign flow - checkSign = signedSigners.filter( - (sign) => sign?.Id === data?.Id || sign?.objectId === data?.signerObjId - ); - useEffect(() => { - if (data.signerObjId === signerObjectId) { - setCurrentSigner(true); - } - }, [data.signerObjId]); - + checkSign = signedSigners + ? signedSigners?.filter( + (sign) => + sign?.Id === data?.Id || sign?.objectId === data?.signerObjId + ) + : []; + if (data.signerObjId === signerObjectId) { + setCurrentSigner(true); + } const handleAllUserName = (Id, Role, type) => { return ( -
+
{ pdfDetails[0].Signers?.find( (signer) => signer.objectId === data.signerObjId @@ -241,14 +174,11 @@ function RenderPdf({ setXyPostion={setSignerPos} data={data} setIsResize={setIsResize} - isResize={isResize} isShowBorder={false} signerObjId={signerObjectId} isShowDropdown={true} isNeedSign={true} isSignYourself={false} - xPos={xPos} - yPos={yPos} posWidth={posWidth} posHeight={posHeight} handleUserName={handleAllUserName} @@ -260,6 +190,7 @@ function RenderPdf({ setSelectWidgetId={setSelectWidgetId} selectWidgetId={selectWidgetId} setCurrWidgetsDetails={setCurrWidgetsDetails} + uniqueId={uniqueId} scale={scale} containerWH={containerWH} pdfOriginalWH={pdfOriginalWH} @@ -273,7 +204,6 @@ function RenderPdf({ }) ); }; - //function for render placeholder block over pdf document const handleUserName = (Id, Role, type) => { @@ -324,11 +254,13 @@ function RenderPdf({ id="container" > {isLoadPdf && + containerWH?.width && + pdfOriginalWH?.width && (pdfRequest ? signerPos.map((data, key) => { return ( - + {checkSignedSignes(data)} ); }) @@ -367,8 +299,6 @@ function RenderPdf({ handleLinkUser={handleLinkUser} handleUserName={handleUserName} isSignYourself={false} - xPos={xPos} - yPos={yPos} posWidth={posWidth} posHeight={posHeight} isDragging={isDragging} @@ -387,6 +317,7 @@ function RenderPdf({ handleTextSettingModal={ handleTextSettingModal } + scale={scale} containerWH={containerWH} pdfOriginalWH={pdfOriginalWH} /> @@ -424,8 +355,6 @@ function RenderPdf({ setIsSignPad={setIsSignPad} isShowBorder={true} isSignYourself={true} - xPos={xPos} - yPos={yPos} posWidth={posWidth} posHeight={posHeight} pdfDetails={pdfDetails[0]} @@ -511,11 +440,13 @@ function RenderPdf({ id="container" > {isLoadPdf && + containerWH?.width && + pdfOriginalWH?.width && (pdfRequest ? signerPos?.map((data, key) => { return ( - + {checkSignedSignes(data)} ); }) @@ -554,8 +485,6 @@ function RenderPdf({ handleLinkUser={handleLinkUser} handleUserName={handleUserName} isSignYourself={false} - xPos={xPos} - yPos={yPos} posWidth={posWidth} posHeight={posHeight} isDragging={isDragging} @@ -612,8 +541,6 @@ function RenderPdf({ setIsSignPad={setIsSignPad} isShowBorder={true} isSignYourself={true} - xPos={xPos} - yPos={yPos} posWidth={posWidth} posHeight={posHeight} pdfDetails={pdfDetails[0]} diff --git a/apps/OpenSign/src/components/pdf/Signedby.js b/apps/OpenSign/src/components/pdf/Signedby.js index d3cd4a789..4e40c064c 100644 --- a/apps/OpenSign/src/components/pdf/Signedby.js +++ b/apps/OpenSign/src/components/pdf/Signedby.js @@ -7,18 +7,14 @@ function Signedby({ pdfDetails }) { }; return ( -
+
Signed By
-
- +
+ {getFirstLetter(pdfDetails.ExtUserPtr.Name)}
diff --git a/apps/OpenSign/src/pages/SignyourselfPdf.js b/apps/OpenSign/src/pages/SignyourselfPdf.js index 7308f2a79..17a5030a5 100644 --- a/apps/OpenSign/src/pages/SignyourselfPdf.js +++ b/apps/OpenSign/src/pages/SignyourselfPdf.js @@ -1181,7 +1181,7 @@ function SignYourSelf() {
)} {/*
*/} -
+
{!isEmailVerified && ( -
+
-
+
-
+
{containerWH?.width && containerWH?.height && (
{!isCompleted ? (