mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-17 21:25:54 +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(() => {
|
||||
handleTab();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
}, [props.signatureTypes]);
|
||||
|
||||
function handleTab() {
|
||||
const signtypes = props?.signatureTypes || [];
|
||||
const index = signtypes?.findIndex((x) => x.enabled === true);
|
||||
if (index !== -1) {
|
||||
setIsSignTypes(true);
|
||||
const tab = props?.signatureTypes[index].name;
|
||||
if (tab === "draw") {
|
||||
setIsTab("draw");
|
||||
|
||||
@@ -248,15 +248,18 @@ const DraftTemplate = () => {
|
||||
}
|
||||
|
||||
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(
|
||||
tenantSignTypes,
|
||||
docSignTypes
|
||||
);
|
||||
setSignatureType(updatedSignatureType);
|
||||
if (isEnableSubscription) {
|
||||
checkIsSubscribed(documentData[0]?.ExtUserPtr?.Email);
|
||||
}
|
||||
const updatedPdfDetails = [...documentData];
|
||||
updatedPdfDetails[0].SignatureType = updatedSignatureType;
|
||||
setPdfDetails(updatedPdfDetails);
|
||||
@@ -327,19 +330,6 @@ const DraftTemplate = () => {
|
||||
|
||||
const res = await contractUsers(jwttoken);
|
||||
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);
|
||||
const tourstatus = res[0].TourStatus && res[0].TourStatus;
|
||||
if (tourstatus && tourstatus.length > 0) {
|
||||
|
||||
@@ -421,12 +421,18 @@ function PdfRequestFiles(props) {
|
||||
//getting document details
|
||||
const documentData = await contractDocument(docId);
|
||||
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(
|
||||
tenantSignTypes,
|
||||
docSignTypes
|
||||
);
|
||||
setSignatureType(updatedSignatureType);
|
||||
const updatedPdfDetails = [...documentData];
|
||||
updatedPdfDetails[0].SignatureType = updatedSignatureType;
|
||||
setPdfDetails(updatedPdfDetails);
|
||||
const url =
|
||||
documentData[0] &&
|
||||
(documentData[0]?.SignedUrl || documentData[0]?.URL);
|
||||
@@ -2130,28 +2136,30 @@ function PdfRequestFiles(props) {
|
||||
</div>
|
||||
</ModalUi>
|
||||
{/* this component is used for signature pad modal */}
|
||||
<SignPad
|
||||
signatureTypes={signatureType}
|
||||
isSignPad={isSignPad}
|
||||
isStamp={isStamp}
|
||||
setIsImageSelect={setIsImageSelect}
|
||||
setIsSignPad={setIsSignPad}
|
||||
setImage={setImage}
|
||||
isImageSelect={isImageSelect}
|
||||
imageRef={imageRef}
|
||||
onImageChange={onImageChange}
|
||||
setSignature={setSignature}
|
||||
image={image}
|
||||
onSaveImage={saveImage}
|
||||
onSaveSign={saveSign}
|
||||
defaultSign={defaultSignImg}
|
||||
myInitial={myInitial}
|
||||
isInitial={isInitial}
|
||||
setIsInitial={setIsInitial}
|
||||
setIsStamp={setIsStamp}
|
||||
currWidgetsDetails={currWidgetsDetails}
|
||||
setCurrWidgetsDetails={setCurrWidgetsDetails}
|
||||
/>
|
||||
{documentId && (
|
||||
<SignPad
|
||||
signatureTypes={signatureType}
|
||||
isSignPad={isSignPad}
|
||||
isStamp={isStamp}
|
||||
setIsImageSelect={setIsImageSelect}
|
||||
setIsSignPad={setIsSignPad}
|
||||
setImage={setImage}
|
||||
isImageSelect={isImageSelect}
|
||||
imageRef={imageRef}
|
||||
onImageChange={onImageChange}
|
||||
setSignature={setSignature}
|
||||
image={image}
|
||||
onSaveImage={saveImage}
|
||||
onSaveSign={saveSign}
|
||||
defaultSign={defaultSignImg}
|
||||
myInitial={myInitial}
|
||||
isInitial={isInitial}
|
||||
setIsInitial={setIsInitial}
|
||||
setIsStamp={setIsStamp}
|
||||
currWidgetsDetails={currWidgetsDetails}
|
||||
setCurrWidgetsDetails={setCurrWidgetsDetails}
|
||||
/>
|
||||
)}
|
||||
{/* pdf header which contain funish back button */}
|
||||
<Header
|
||||
isPdfRequestFiles={isPublicTemplate ? false : true}
|
||||
|
||||
@@ -262,12 +262,6 @@ function PlaceHolderSign() {
|
||||
const documentData = await contractDocument(documentId);
|
||||
if (documentData && documentData.length > 0) {
|
||||
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
|
||||
const arrayBuffer = await convertPdfArrayBuffer(url);
|
||||
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];
|
||||
updatedPdfDetails[0].SignatureType = updatedSignatureType;
|
||||
setPdfDetails(updatedPdfDetails);
|
||||
@@ -445,19 +448,6 @@ function PlaceHolderSign() {
|
||||
setHandleError(t("something-went-wrong-mssg"));
|
||||
setIsLoading({ isLoad: false });
|
||||
} 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);
|
||||
setSignerUserId(res[0].objectId);
|
||||
const tourstatus = res[0].TourStatus && res[0].TourStatus;
|
||||
|
||||
@@ -236,15 +236,18 @@ const TemplatePlaceholder = () => {
|
||||
: [];
|
||||
|
||||
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(
|
||||
tenantSignTypes,
|
||||
docSignTypes
|
||||
);
|
||||
setSignatureType(updatedSignatureType);
|
||||
if (isEnableSubscription) {
|
||||
checkIsSubscribed(documentData[0]?.ExtUserPtr?.Email);
|
||||
}
|
||||
const updatedPdfDetails = [...documentData];
|
||||
updatedPdfDetails[0].SignatureType = updatedSignatureType;
|
||||
setPdfDetails(updatedPdfDetails);
|
||||
@@ -314,19 +317,6 @@ const TemplatePlaceholder = () => {
|
||||
}
|
||||
const res = await contractUsers();
|
||||
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);
|
||||
setCurrentEmail(res[0].Email);
|
||||
const tourstatus = res[0].TourStatus && res[0].TourStatus;
|
||||
|
||||
Reference in New Issue
Block a user