mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-10-01 14:04:59 +02:00
fix: signature type not visible in signpad for public template
This commit is contained in:
@@ -37,11 +37,13 @@ function SignPad(props) {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleTab();
|
handleTab();
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, [props.signatureTypes]);
|
||||||
|
|
||||||
function handleTab() {
|
function handleTab() {
|
||||||
const signtypes = props?.signatureTypes || [];
|
const signtypes = props?.signatureTypes || [];
|
||||||
const index = signtypes?.findIndex((x) => x.enabled === true);
|
const index = signtypes?.findIndex((x) => x.enabled === true);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
|
setIsSignTypes(true);
|
||||||
const tab = props?.signatureTypes[index].name;
|
const tab = props?.signatureTypes[index].name;
|
||||||
if (tab === "draw") {
|
if (tab === "draw") {
|
||||||
setIsTab("draw");
|
setIsTab("draw");
|
||||||
|
|||||||
@@ -248,15 +248,18 @@ const DraftTemplate = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (documentData && documentData.length > 0) {
|
if (documentData && documentData.length > 0) {
|
||||||
const docSignTypes = documentData?.[0]?.SignatureType || signatureTypes;
|
if (isEnableSubscription) {
|
||||||
|
checkIsSubscribed(documentData[0]?.ExtUserPtr?.Email);
|
||||||
|
}
|
||||||
|
const userSignatureType =
|
||||||
|
documentData[0]?.ExtUserPtr?.SignatureType || signatureTypes;
|
||||||
|
const docSignTypes =
|
||||||
|
documentData?.[0]?.SignatureType || userSignatureType;
|
||||||
const updatedSignatureType = await handleSignatureType(
|
const updatedSignatureType = await handleSignatureType(
|
||||||
tenantSignTypes,
|
tenantSignTypes,
|
||||||
docSignTypes
|
docSignTypes
|
||||||
);
|
);
|
||||||
setSignatureType(updatedSignatureType);
|
setSignatureType(updatedSignatureType);
|
||||||
if (isEnableSubscription) {
|
|
||||||
checkIsSubscribed(documentData[0]?.ExtUserPtr?.Email);
|
|
||||||
}
|
|
||||||
const updatedPdfDetails = [...documentData];
|
const updatedPdfDetails = [...documentData];
|
||||||
updatedPdfDetails[0].SignatureType = updatedSignatureType;
|
updatedPdfDetails[0].SignatureType = updatedSignatureType;
|
||||||
setPdfDetails(updatedPdfDetails);
|
setPdfDetails(updatedPdfDetails);
|
||||||
@@ -327,19 +330,6 @@ const DraftTemplate = () => {
|
|||||||
|
|
||||||
const res = await contractUsers(jwttoken);
|
const res = await contractUsers(jwttoken);
|
||||||
if (res[0] && res.length) {
|
if (res[0] && res.length) {
|
||||||
const userSignatureType = res[0]?.SignatureType || signatureTypes;
|
|
||||||
const docSignTypes =
|
|
||||||
documentData?.[0]?.SignatureType || userSignatureType;
|
|
||||||
const updatedSignatureType = await handleSignatureType(
|
|
||||||
tenantSignTypes,
|
|
||||||
docSignTypes
|
|
||||||
);
|
|
||||||
setSignatureType(updatedSignatureType);
|
|
||||||
if (documentData?.length && documentData?.[0]?.objectId) {
|
|
||||||
const updatedPdfDetails = [...documentData];
|
|
||||||
updatedPdfDetails[0].SignatureType = updatedSignatureType;
|
|
||||||
setPdfDetails(updatedPdfDetails);
|
|
||||||
}
|
|
||||||
setSignerUserId(res[0].objectId);
|
setSignerUserId(res[0].objectId);
|
||||||
const tourstatus = res[0].TourStatus && res[0].TourStatus;
|
const tourstatus = res[0].TourStatus && res[0].TourStatus;
|
||||||
if (tourstatus && tourstatus.length > 0) {
|
if (tourstatus && tourstatus.length > 0) {
|
||||||
|
|||||||
@@ -421,12 +421,18 @@ function PdfRequestFiles(props) {
|
|||||||
//getting document details
|
//getting document details
|
||||||
const documentData = await contractDocument(docId);
|
const documentData = await contractDocument(docId);
|
||||||
if (documentData && documentData.length > 0) {
|
if (documentData && documentData.length > 0) {
|
||||||
const docSignTypes = documentData?.[0]?.SignatureType || signatureTypes;
|
const userSignatureType =
|
||||||
|
documentData[0]?.ExtUserPtr?.SignatureType || signatureTypes;
|
||||||
|
const docSignTypes =
|
||||||
|
documentData?.[0]?.SignatureType || userSignatureType;
|
||||||
const updatedSignatureType = await handleSignatureType(
|
const updatedSignatureType = await handleSignatureType(
|
||||||
tenantSignTypes,
|
tenantSignTypes,
|
||||||
docSignTypes
|
docSignTypes
|
||||||
);
|
);
|
||||||
setSignatureType(updatedSignatureType);
|
setSignatureType(updatedSignatureType);
|
||||||
|
const updatedPdfDetails = [...documentData];
|
||||||
|
updatedPdfDetails[0].SignatureType = updatedSignatureType;
|
||||||
|
setPdfDetails(updatedPdfDetails);
|
||||||
const url =
|
const url =
|
||||||
documentData[0] &&
|
documentData[0] &&
|
||||||
(documentData[0]?.SignedUrl || documentData[0]?.URL);
|
(documentData[0]?.SignedUrl || documentData[0]?.URL);
|
||||||
@@ -2130,28 +2136,30 @@ function PdfRequestFiles(props) {
|
|||||||
</div>
|
</div>
|
||||||
</ModalUi>
|
</ModalUi>
|
||||||
{/* this component is used for signature pad modal */}
|
{/* this component is used for signature pad modal */}
|
||||||
<SignPad
|
{documentId && (
|
||||||
signatureTypes={signatureType}
|
<SignPad
|
||||||
isSignPad={isSignPad}
|
signatureTypes={signatureType}
|
||||||
isStamp={isStamp}
|
isSignPad={isSignPad}
|
||||||
setIsImageSelect={setIsImageSelect}
|
isStamp={isStamp}
|
||||||
setIsSignPad={setIsSignPad}
|
setIsImageSelect={setIsImageSelect}
|
||||||
setImage={setImage}
|
setIsSignPad={setIsSignPad}
|
||||||
isImageSelect={isImageSelect}
|
setImage={setImage}
|
||||||
imageRef={imageRef}
|
isImageSelect={isImageSelect}
|
||||||
onImageChange={onImageChange}
|
imageRef={imageRef}
|
||||||
setSignature={setSignature}
|
onImageChange={onImageChange}
|
||||||
image={image}
|
setSignature={setSignature}
|
||||||
onSaveImage={saveImage}
|
image={image}
|
||||||
onSaveSign={saveSign}
|
onSaveImage={saveImage}
|
||||||
defaultSign={defaultSignImg}
|
onSaveSign={saveSign}
|
||||||
myInitial={myInitial}
|
defaultSign={defaultSignImg}
|
||||||
isInitial={isInitial}
|
myInitial={myInitial}
|
||||||
setIsInitial={setIsInitial}
|
isInitial={isInitial}
|
||||||
setIsStamp={setIsStamp}
|
setIsInitial={setIsInitial}
|
||||||
currWidgetsDetails={currWidgetsDetails}
|
setIsStamp={setIsStamp}
|
||||||
setCurrWidgetsDetails={setCurrWidgetsDetails}
|
currWidgetsDetails={currWidgetsDetails}
|
||||||
/>
|
setCurrWidgetsDetails={setCurrWidgetsDetails}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{/* pdf header which contain funish back button */}
|
{/* pdf header which contain funish back button */}
|
||||||
<Header
|
<Header
|
||||||
isPdfRequestFiles={isPublicTemplate ? false : true}
|
isPdfRequestFiles={isPublicTemplate ? false : true}
|
||||||
|
|||||||
@@ -262,12 +262,6 @@ function PlaceHolderSign() {
|
|||||||
const documentData = await contractDocument(documentId);
|
const documentData = await contractDocument(documentId);
|
||||||
if (documentData && documentData.length > 0) {
|
if (documentData && documentData.length > 0) {
|
||||||
const url = documentData[0] && documentData[0]?.URL;
|
const url = documentData[0] && documentData[0]?.URL;
|
||||||
const docSignTypes = documentData?.[0]?.SignatureType || signatureTypes;
|
|
||||||
const updatedSignatureType = await handleSignatureType(
|
|
||||||
tenantSignTypes,
|
|
||||||
docSignTypes
|
|
||||||
);
|
|
||||||
setSignatureType(updatedSignatureType);
|
|
||||||
//convert document url in array buffer format to use embed widgets in pdf using pdf-lib
|
//convert document url in array buffer format to use embed widgets in pdf using pdf-lib
|
||||||
const arrayBuffer = await convertPdfArrayBuffer(url);
|
const arrayBuffer = await convertPdfArrayBuffer(url);
|
||||||
if (arrayBuffer === "Error") {
|
if (arrayBuffer === "Error") {
|
||||||
@@ -320,6 +314,15 @@ function PlaceHolderSign() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const userSignatureType =
|
||||||
|
documentData[0]?.ExtUserPtr?.SignatureType || signatureTypes;
|
||||||
|
const docSignTypes =
|
||||||
|
documentData?.[0]?.SignatureType || userSignatureType;
|
||||||
|
const updatedSignatureType = await handleSignatureType(
|
||||||
|
tenantSignTypes,
|
||||||
|
docSignTypes
|
||||||
|
);
|
||||||
|
setSignatureType(updatedSignatureType);
|
||||||
const updatedPdfDetails = [...documentData];
|
const updatedPdfDetails = [...documentData];
|
||||||
updatedPdfDetails[0].SignatureType = updatedSignatureType;
|
updatedPdfDetails[0].SignatureType = updatedSignatureType;
|
||||||
setPdfDetails(updatedPdfDetails);
|
setPdfDetails(updatedPdfDetails);
|
||||||
@@ -445,19 +448,6 @@ function PlaceHolderSign() {
|
|||||||
setHandleError(t("something-went-wrong-mssg"));
|
setHandleError(t("something-went-wrong-mssg"));
|
||||||
setIsLoading({ isLoad: false });
|
setIsLoading({ isLoad: false });
|
||||||
} else if (res.length && res[0]?.objectId) {
|
} else if (res.length && res[0]?.objectId) {
|
||||||
const userSignatureType = res[0]?.SignatureType || signatureTypes;
|
|
||||||
const docSignTypes =
|
|
||||||
documentData?.[0]?.SignatureType || userSignatureType;
|
|
||||||
const updatedSignatureType = await handleSignatureType(
|
|
||||||
tenantSignTypes,
|
|
||||||
docSignTypes
|
|
||||||
);
|
|
||||||
setSignatureType(updatedSignatureType);
|
|
||||||
if (documentData?.length && documentData?.[0]?.objectId) {
|
|
||||||
const updatedPdfDetails = [...documentData];
|
|
||||||
updatedPdfDetails[0].SignatureType = updatedSignatureType;
|
|
||||||
setPdfDetails(updatedPdfDetails);
|
|
||||||
}
|
|
||||||
setActiveMailAdapter(res[0]?.active_mail_adapter);
|
setActiveMailAdapter(res[0]?.active_mail_adapter);
|
||||||
setSignerUserId(res[0].objectId);
|
setSignerUserId(res[0].objectId);
|
||||||
const tourstatus = res[0].TourStatus && res[0].TourStatus;
|
const tourstatus = res[0].TourStatus && res[0].TourStatus;
|
||||||
|
|||||||
@@ -236,15 +236,18 @@ const TemplatePlaceholder = () => {
|
|||||||
: [];
|
: [];
|
||||||
|
|
||||||
if (documentData && documentData.length > 0) {
|
if (documentData && documentData.length > 0) {
|
||||||
const docSignTypes = documentData?.[0]?.SignatureType || signatureTypes;
|
if (isEnableSubscription) {
|
||||||
|
checkIsSubscribed(documentData[0]?.ExtUserPtr?.Email);
|
||||||
|
}
|
||||||
|
const userSignatureType =
|
||||||
|
documentData[0]?.ExtUserPtr?.SignatureType || signatureTypes;
|
||||||
|
const docSignTypes =
|
||||||
|
documentData?.[0]?.SignatureType || userSignatureType;
|
||||||
const updatedSignatureType = await handleSignatureType(
|
const updatedSignatureType = await handleSignatureType(
|
||||||
tenantSignTypes,
|
tenantSignTypes,
|
||||||
docSignTypes
|
docSignTypes
|
||||||
);
|
);
|
||||||
setSignatureType(updatedSignatureType);
|
setSignatureType(updatedSignatureType);
|
||||||
if (isEnableSubscription) {
|
|
||||||
checkIsSubscribed(documentData[0]?.ExtUserPtr?.Email);
|
|
||||||
}
|
|
||||||
const updatedPdfDetails = [...documentData];
|
const updatedPdfDetails = [...documentData];
|
||||||
updatedPdfDetails[0].SignatureType = updatedSignatureType;
|
updatedPdfDetails[0].SignatureType = updatedSignatureType;
|
||||||
setPdfDetails(updatedPdfDetails);
|
setPdfDetails(updatedPdfDetails);
|
||||||
@@ -314,19 +317,6 @@ const TemplatePlaceholder = () => {
|
|||||||
}
|
}
|
||||||
const res = await contractUsers();
|
const res = await contractUsers();
|
||||||
if (res[0] && res.length) {
|
if (res[0] && res.length) {
|
||||||
const userSignatureType = res[0]?.SignatureType || signatureTypes;
|
|
||||||
const docSignTypes =
|
|
||||||
documentData?.[0]?.SignatureType || userSignatureType;
|
|
||||||
const updatedSignatureType = await handleSignatureType(
|
|
||||||
tenantSignTypes,
|
|
||||||
docSignTypes
|
|
||||||
);
|
|
||||||
setSignatureType(updatedSignatureType);
|
|
||||||
if (documentData?.length && documentData?.[0]?.objectId) {
|
|
||||||
const updatedPdfDetails = [...documentData];
|
|
||||||
updatedPdfDetails[0].SignatureType = updatedSignatureType;
|
|
||||||
setPdfDetails(updatedPdfDetails);
|
|
||||||
}
|
|
||||||
setSignerUserId(res[0].objectId);
|
setSignerUserId(res[0].objectId);
|
||||||
setCurrentEmail(res[0].Email);
|
setCurrentEmail(res[0].Email);
|
||||||
const tourstatus = res[0].TourStatus && res[0].TourStatus;
|
const tourstatus = res[0].TourStatus && res[0].TourStatus;
|
||||||
|
|||||||
Reference in New Issue
Block a user