) : (
@@ -981,9 +978,15 @@ function PlaceHolderSign() {
)
)}
-
-
-
+
-
- {/* this modal is used show send mail message and after send mail success message */}
-
-
- Mails Sent
-
+
+
- {/* signature modal */}
-
+ {/* this modal is used show send mail message and after send mail success message */}
+ {
+ setIsSend(false);
+ setSignerPos([]);
+ }}
+ >
+
You have successfully sent mails to all recipients!
{currentId && (
Do you want to sign documents right now ?
)}
-
-
-
+
{currentId ? (
<>
)}
-
-
+
+
+
{/* */}
{
- //cheking signUrl is defau;t signature url of custom url
- let ImgUrl = data.SignUrl;
- const checkUrl = urlValidator(ImgUrl);
+ // for (let xyData of xyPostion) {
+ // const imgUrlList = xyData.pos;
+ // const pageNo = xyData.pageNumber;
+ // imgUrlList.map(async (data) => {
+ // //cheking signUrl is defau;t signature url of custom url
+ // let ImgUrl = data.SignUrl;
+ // const checkUrl = urlValidator(ImgUrl);
- //if default signature url then convert it in base 64
- if (checkUrl) {
- ImgUrl = await getBase64FromIMG(ImgUrl + "?get");
- }
- //function for convert signature png base64 url to jpeg base64
- convertPNGtoJPEG(ImgUrl)
- .then((jpegBase64Data) => {
- const removeBase64Fromjpeg = "data:image/jpeg;base64,";
- const newImgUrl = jpegBase64Data.replace(
- removeBase64Fromjpeg,
- ""
- );
+ // //if default signature url then convert it in base 64
+ // if (checkUrl) {
+ // ImgUrl = await getBase64FromIMG(ImgUrl + "?get");
+ // }
+ // //function for convert signature png base64 url to jpeg base64
+ // convertPNGtoJPEG(ImgUrl)
+ // .then((jpegBase64Data) => {
+ // const removeBase64Fromjpeg = "data:image/jpeg;base64,";
+ // const newImgUrl = jpegBase64Data.replace(
+ // removeBase64Fromjpeg,
+ // ""
+ // );
- //function for embed signature in pdf and get digital signature pdf
- signPdfFun(
- newImgUrl,
- docId,
- signerUserId,
- pdfOriginalWidth,
- xyPostion,
- containerWH,
- setIsAlert,
- data,
- pdfBase64,
- pageNo
- )
- .then((res) => {
- if (res && res.status === "success") {
- getDocumentDetails();
- } else {
- setIsAlert({
- isShow: true,
- alertMessage: "something went wrong"
- });
- }
- })
- .catch((err) => {
- setIsAlert({
- isShow: true,
- alertMessage: "something went wrong"
- });
- });
- })
- .catch((error) => {
- setIsAlert({
- isShow: true,
- alertMessage: "something went wrong"
- });
- });
- });
- }
- }
- //else if signature is more than one then embed all sign with the use of pdf-lib
- else if (xyPostion.length > 0 && xyPostion[0].pos.length > 0) {
- const flag = false;
- //embed document's object id to all pages in pdf document
+ // //function for embed signature in pdf and get digital signature pdf
+ // signPdfFun(
+ // newImgUrl,
+ // docId,
+ // signerUserId,
+ // pdfOriginalWidth,
+ // xyPostion,
+ // containerWH,
+ // setIsAlert,
+ // data,
+ // pdfBase64,
+ // pageNo
+ // )
+ // .then((res) => {
+ // if (res && res.status === "success") {
+ // getDocumentDetails();
+ // } else {
+ // setIsAlert({
+ // isShow: true,
+ // alertMessage: "something went wrong"
+ // });
+ // }
+ // })
+ // .catch((err) => {
+ // setIsAlert({
+ // isShow: true,
+ // alertMessage: "something went wrong"
+ // });
+ // });
+ // })
+ // .catch((error) => {
+ // setIsAlert({
+ // isShow: true,
+ // alertMessage: "something went wrong"
+ // });
+ // });
+ // });
+ // }
+ // }
+ // //else if signature is more than one then embed all sign with the use of pdf-lib
+ // else if (xyPostion.length > 0 && xyPostion[0].pos.length > 0) {
+ const flag = false;
+ //embed document's object id to all pages in pdf document
+ if (!isDocId) {
await embedDocId(pdfDoc, docId, allPages);
- //embed multi signature in pdf
- const pdfBytes = await multiSignEmbed(
- pngUrl,
- pdfDoc,
- pdfOriginalWidth,
- flag,
- containerWH
- );
+ }
+ //embed multi signature in pdf
+ const pdfBytes = await multiSignEmbed(
+ pngUrl,
+ pdfDoc,
+ pdfOriginalWidth,
+ flag,
+ containerWH
+ );
- //function for embed signature in pdf and get digital signature pdf
- try {
- const res = await signPdfFun(
- pdfBytes,
- docId,
- signerUserId,
- pdfOriginalWidth,
- xyPostion,
- containerWH,
- setIsAlert
- );
- if (res && res.status === "success") {
- getDocumentDetails();
- } else {
- setIsAlert({
- isShow: true,
- alertMessage: "something went wrong"
- });
- }
- } catch (err) {
+ //function for embed signature in pdf and get digital signature pdf
+ try {
+ const res = await signPdfFun(
+ pdfBytes,
+ docId,
+ signerUserId,
+ pdfOriginalWidth,
+ xyPostion,
+ containerWH,
+ setIsAlert
+ );
+ if (res && res.status === "success") {
+ getDocumentDetails();
+ } else {
setIsAlert({
isShow: true,
alertMessage: "something went wrong"
});
}
+ } catch (err) {
+ setIsAlert({
+ isShow: true,
+ alertMessage: "something went wrong"
+ });
}
- setIsSignPad(false);
- setXyPostion([]);
}
+ setIsSignPad(false);
+ setXyPostion([]);
+ // }
}
//function for change page
diff --git a/microfrontends/SignDocuments/src/utils/Utils.js b/microfrontends/SignDocuments/src/utils/Utils.js
index 573f29eb4..2d4ff8706 100644
--- a/microfrontends/SignDocuments/src/utils/Utils.js
+++ b/microfrontends/SignDocuments/src/utils/Utils.js
@@ -767,7 +767,7 @@ export const handleSignYourselfImageResize = (
key,
xyPostion,
index,
- setXyPostion,
+ setXyPostion
) => {
const updateFilter = xyPostion[index].pos.filter(
(data) => data.key === key && data.Width && data.Height
@@ -838,120 +838,120 @@ export const signPdfFun = async (
) => {
let singleSign;
- const newWidth = containerWH.width;
- const scale = isMobile ? pdfOriginalWidth / newWidth : 1;
- if (signerData && signerData.length === 1 && signerData[0].pos.length === 1) {
- const height = xyPosData.Height ? xyPosData.Height : 60;
+ // const newWidth = containerWH.width;
+ // const scale = isMobile ? pdfOriginalWidth / newWidth : 1;
+ // if (signerData && signerData.length === 1 && signerData[0].pos.length === 1) {
+ // const height = xyPosData.Height ? xyPosData.Height : 60;
- const xPos = (pos) => {
- const resizePos = pos.xPosition;
- //checking both condition mobile and desktop view
- if (isMobile) {
- //if pos.isMobile false -- placeholder saved from desktop view then handle position in mobile view divided by scale
- if (pos.isMobile) {
- const x = resizePos * (pos.scale / scale);
- return x * scale;
- } else {
- const x = resizePos / scale;
- return x * scale;
- }
- } else {
- //else if pos.isMobile true -- placeholder saved from mobile or tablet view then handle position in desktop view divide by scale
- if (pos.isMobile) {
- const x = resizePos * pos.scale;
- return x;
- } else {
- return resizePos;
- }
- }
- };
- const yBottom = (pos) => {
- const resizePos = pos.yBottom;
- let yPosition;
- //checking both condition mobile and desktop view
+ // const xPos = (pos) => {
+ // const resizePos = pos.xPosition;
+ // //checking both condition mobile and desktop view
+ // if (isMobile) {
+ // //if pos.isMobile false -- placeholder saved from desktop view then handle position in mobile view divided by scale
+ // if (pos.isMobile) {
+ // const x = resizePos * (pos.scale / scale);
+ // return x * scale;
+ // } else {
+ // const x = resizePos / scale;
+ // return x * scale;
+ // }
+ // } else {
+ // //else if pos.isMobile true -- placeholder saved from mobile or tablet view then handle position in desktop view divide by scale
+ // if (pos.isMobile) {
+ // const x = resizePos * pos.scale;
+ // return x;
+ // } else {
+ // return resizePos;
+ // }
+ // }
+ // };
+ // const yBottom = (pos) => {
+ // const resizePos = pos.yBottom;
+ // let yPosition;
+ // //checking both condition mobile and desktop view
- if (isMobile) {
- //if pos.isMobile false -- placeholder saved from desktop view then handle position in mobile view divided by scale
- if (pos.isMobile) {
- const y = resizePos * (pos.scale / scale);
- yPosition = pos.isDrag
- ? y * scale - height * scale
- : pos.firstYPos
- ? y * scale - height * scale + pos.firstYPos
- : y * scale - height * scale;
- return yPosition;
- } else {
- const y = resizePos / scale;
- if (pos.IsResize) {
- yPosition = pos.isDrag
- ? y * scale - height * scale
- : pos.firstYPos
- ? y * scale - height * scale + pos.firstYPos
- : y * scale - height * scale;
- return yPosition;
- } else {
- yPosition = pos.isDrag
- ? y * scale - height
- : pos.firstYPos
- ? y * scale - height + pos.firstYPos
- : y * scale - height;
- return yPosition;
- }
- }
- } else {
- //else if pos.isMobile true -- placeholder saved from mobile or tablet view then handle position in desktop view divide by scale
- if (pos.isMobile) {
- const y = resizePos * pos.scale;
- if (pos.IsResize) {
- yPosition = pos.isDrag
- ? y - height
- : pos.firstYPos
- ? y - height + pos.firstYPos
- : y - height;
- return yPosition;
- } else {
- yPosition = pos.isDrag
- ? y - height * pos.scale
- : pos.firstYPos
- ? y - height * pos.scale + pos.firstYPos
- : y - height * pos.scale;
- return yPosition;
- }
- } else {
- yPosition = pos.isDrag
- ? resizePos - height
- : pos.firstYPos
- ? resizePos - height + pos.firstYPos
- : resizePos - height;
- return yPosition;
- }
- }
- };
+ // if (isMobile) {
+ // //if pos.isMobile false -- placeholder saved from desktop view then handle position in mobile view divided by scale
+ // if (pos.isMobile) {
+ // const y = resizePos * (pos.scale / scale);
+ // yPosition = pos.isDrag
+ // ? y * scale - height * scale
+ // : pos.firstYPos
+ // ? y * scale - height * scale + pos.firstYPos
+ // : y * scale - height * scale;
+ // return yPosition;
+ // } else {
+ // const y = resizePos / scale;
+ // if (pos.IsResize) {
+ // yPosition = pos.isDrag
+ // ? y * scale - height * scale
+ // : pos.firstYPos
+ // ? y * scale - height * scale + pos.firstYPos
+ // : y * scale - height * scale;
+ // return yPosition;
+ // } else {
+ // yPosition = pos.isDrag
+ // ? y * scale - height
+ // : pos.firstYPos
+ // ? y * scale - height + pos.firstYPos
+ // : y * scale - height;
+ // return yPosition;
+ // }
+ // }
+ // } else {
+ // //else if pos.isMobile true -- placeholder saved from mobile or tablet view then handle position in desktop view divide by scale
+ // if (pos.isMobile) {
+ // const y = resizePos * pos.scale;
+ // if (pos.IsResize) {
+ // yPosition = pos.isDrag
+ // ? y - height
+ // : pos.firstYPos
+ // ? y - height + pos.firstYPos
+ // : y - height;
+ // return yPosition;
+ // } else {
+ // yPosition = pos.isDrag
+ // ? y - height * pos.scale
+ // : pos.firstYPos
+ // ? y - height * pos.scale + pos.firstYPos
+ // : y - height * pos.scale;
+ // return yPosition;
+ // }
+ // } else {
+ // yPosition = pos.isDrag
+ // ? resizePos - height
+ // : pos.firstYPos
+ // ? resizePos - height + pos.firstYPos
+ // : resizePos - height;
+ // return yPosition;
+ // }
+ // }
+ // };
- singleSign = {
- pdfFile: pdfBase64Url,
- docId: documentId,
- userId: signerObjectId,
- sign: {
- Base64: base64Url,
- Left: xPos(xyPosData),
- Bottom: yBottom(xyPosData),
- Width: placeholderWidth(xyPosData, scale),
- Height: placeholderHeight(xyPosData, scale),
- Page: pageNo
- }
- };
- } else if (
- signerData &&
- signerData.length > 0 &&
- signerData[0].pos.length > 0
- ) {
- singleSign = {
- pdfFile: base64Url,
- docId: documentId,
- userId: signerObjectId
- };
- }
+ // singleSign = {
+ // pdfFile: pdfBase64Url,
+ // docId: documentId,
+ // userId: signerObjectId,
+ // sign: {
+ // Base64: base64Url,
+ // Left: xPos(xyPosData),
+ // Bottom: yBottom(xyPosData),
+ // Width: placeholderWidth(xyPosData, scale),
+ // Height: placeholderHeight(xyPosData, scale),
+ // Page: pageNo
+ // }
+ // };
+ // } else if (
+ // signerData &&
+ // signerData.length > 0 &&
+ // signerData[0].pos.length > 0
+ // ) {
+ singleSign = {
+ pdfFile: base64Url,
+ docId: documentId,
+ userId: signerObjectId
+ // };
+ };
const response = await axios
.post(`${localStorage.getItem("baseUrl")}functions/signPdf`, singleSign, {
@@ -1048,7 +1048,6 @@ export const getFirstLetter = (name) => {
return firstLetter;
};
-
export const darkenColor = (color, factor) => {
// Remove '#' from the color code and parse it to get RGB values
const hex = color.replace("#", "");
@@ -1066,5 +1065,3 @@ export const darkenColor = (color, factor) => {
.toString(16)
.padStart(6, "0")}`;
};
-
-