diff --git a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js index 2b8a56f71..71f2dc1b3 100644 --- a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js +++ b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js @@ -426,228 +426,6 @@ function PdfRequestFiles() { } } - // //function for call cloud function signPdf and generate digital signature - // const signPdfFun = async ( - // base64Url, - // documentId, - // xyPosData, - // pdfBase64Url, - // pageNo, - // signerData - // ) => { - // let signgleSign; - // const isMobile = window.innerWidth < 767; - // const newWidth = window.innerWidth; - // 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) => { - // //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 = pos.xPosition * (pos.scale / scale); - // return x * scale + 50; - // } else { - // const x = pos.xPosition / 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 = pos.xPosition * pos.scale + 50; - // return x; - // } else { - // return pos.xPosition; - // } - // } - // }; - - // const yBottom = (pos) => { - // 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 = pos.yBottom * (pos.scale / scale); - // yPosition = pos.isDrag - // ? y * scale - height - // : pos.firstYPos - // ? y * scale - height + pos.firstYPos - // : y * scale - height; - // return yPosition; - // } else { - // const y = pos.yBottom / scale; - - // 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 = pos.yBottom * pos.scale; - - // yPosition = pos.isDrag - // ? y - height - // : pos.firstYPos - // ? y - height + pos.firstYPos - // : y - height; - // return yPosition; - // } else { - // yPosition = pos.isDrag - // ? pos.yBottom - height - // : pos.firstYPos - // ? pos.yBottom - height + pos.firstYPos - // : pos.yBottom - height; - // return yPosition; - // } - // } - // }; - // const bottomY = yBottom(xyPosData); - // signgleSign = { - // pdfFile: pdfBase64Url, - // docId: documentId, - // userId: signerObjectId, - // sign: { - // Base64: base64Url, - // Left: xPos(xyPosData), - // Bottom: bottomY, - // Width: xyPosData.Width ? xyPosData.Width : 150, - // Height: height, - // Page: pageNo - // } - // }; - // } else if ( - // xyPosData && - // xyPosData.length > 0 && - // xyPosData[0].pos.length > 0 - // ) { - // signgleSign = { - // pdfFile: base64Url, - // docId: documentId, - // userId: signerObjectId - // }; - // } - - // await axios - // .post( - // `${localStorage.getItem("baseUrl")}functions/signPdf`, - // signgleSign, - // { - // headers: { - // "Content-Type": "application/json", - // "X-Parse-Application-Id": localStorage.getItem("parseAppId"), - // sessionToken: localStorage.getItem("accesstoken") - // } - // } - // ) - // .then((Listdata) => { - // const json = Listdata.data; - - // if (json.result.data) { - // setPdfUrl(json.result.data); - // setIsSigned(true); - // setSignedSigners([]); - // setUnSignedSigners([]); - // getDocumentDetails(); - // } - // }) - // .catch((err) => { - // console.log("axois err ", err); - // alert("something went wrong"); - // }); - // }; - - //function for resize image and update width and height - // const handleImageResize = (ref, key, signerId, position) => { - // const filterSignerPos = signerPos.filter( - // (data) => data.signerObjId === signerId - // ); - // if (filterSignerPos.length > 0) { - // const getPlaceHolder = filterSignerPos[0].placeHolder; - // const getPageNumer = getPlaceHolder.filter( - // (data) => data.pageNumber === pageNumber - // ); - // if (getPageNumer.length > 0) { - // const getXYdata = getPageNumer[0].pos.filter( - // (data, ind) => data.key === key && data.Width && data.Height - // ); - // if (getXYdata.length > 0) { - // const getXYdata = getPageNumer[0].pos; - // const getPosData = getXYdata; - // const addSignPos = getPosData.map((url, ind) => { - // if (url.key === key) { - // return { - // ...url, - // Width: ref.offsetWidth, - // Height: ref.offsetHeight, - // xPosition: position.x - // }; - // } - // return url; - // }); - - // const newUpdateSignPos = getPlaceHolder.map((obj, ind) => { - // if (obj.pageNumber === pageNumber) { - // return { ...obj, pos: addSignPos }; - // } - // return obj; - // }); - - // const newUpdateSigner = signerPos.map((obj, ind) => { - // if (obj.signerObjId === signerId) { - // return { ...obj, placeHolder: newUpdateSignPos }; - // } - // return obj; - // }); - - // setSignerPos(newUpdateSigner); - // } else { - // const getXYdata = getPageNumer[0].pos; - - // const getPosData = getXYdata; - - // const addSignPos = getPosData.map((url, ind) => { - // if (url.key === key) { - // return { - // ...url, - // Width: ref.offsetWidth, - // Height: ref.offsetHeight - // }; - // } - // return url; - // }); - - // const newUpdateSignPos = getPlaceHolder.map((obj, ind) => { - // if (obj.pageNumber === pageNumber) { - // return { ...obj, pos: addSignPos }; - // } - // return obj; - // }); - - // const newUpdateSigner = signerPos.map((obj, ind) => { - // if (obj.signerObjId === signerId) { - // return { ...obj, placeHolder: newUpdateSignPos }; - // } - // return obj; - // }); - - // setSignerPos(newUpdateSigner); - // } - // } - // } - // }; - //function for get pdf page details const pageDetails = async (pdf) => { const load = { @@ -950,7 +728,7 @@ function PdfRequestFiles() { )} -