fix: single signature issue, change react tour message, add icon for create new tamplate

This commit is contained in:
RaktimaNXG
2024-01-03 19:47:22 +05:30
parent 3226e4fd85
commit 1cd6718489
8 changed files with 609 additions and 590 deletions
+112 -115
View File
@@ -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")}`;
};