Skip to content
Merged
1 change: 1 addition & 0 deletions apps/OpenSign/src/components/pdf/Placeholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ function Placeholder(props) {
}
};
const handleOnClickPlaceholder = () => {
props.setCurrWidgetsDetails && props.setCurrWidgetsDetails(props.pos);
if (!props.isNeedSign) {
props.setWidgetType(props.pos.type);
}
Expand Down
5 changes: 5 additions & 0 deletions apps/OpenSign/src/components/pdf/PlaceholderType.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ function PlaceholderType(props) {
return props.pos.SignUrl ? (
<img
alt="signimg"
draggable="false"
src={props.pos.SignUrl}
style={{
width: "99%",
Expand All @@ -328,6 +329,7 @@ function PlaceholderType(props) {
return props.pos.SignUrl ? (
<img
alt="signimg"
draggable="false"
src={props.pos.SignUrl}
style={{
width: "99%",
Expand Down Expand Up @@ -483,6 +485,7 @@ function PlaceholderType(props) {
return props.pos.SignUrl ? (
<img
alt="signimg"
draggable="false"
src={props.pos.SignUrl}
style={{
width: "99%",
Expand Down Expand Up @@ -668,6 +671,7 @@ function PlaceholderType(props) {
return props.pos.SignUrl ? (
<img
alt="signimg"
draggable="false"
src={props.pos.SignUrl}
style={{
width: "99%",
Expand Down Expand Up @@ -787,6 +791,7 @@ function PlaceholderType(props) {
<div style={{ pointerEvents: "none" }}>
<img
alt="signimg"
draggable="false"
src={props.pos.SignUrl}
style={{
width: "99%",
Expand Down
8 changes: 7 additions & 1 deletion apps/OpenSign/src/components/pdf/RecipientList.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,13 @@ const RecipientList = (props) => {
data-tut="reactourFirst"
onMouseEnter={() => setIsHover(ind)}
onMouseLeave={() => setIsHover(null)}
className={props.sendInOrder && "dragCursor"}
className={
props.sendInOrder
? props.isMailSend
? "disabled"
: "dragCursor"
: props.isMailSend && "disabled"
}
style={
(!isMobile && isHover === ind) || props.isSelectListId === ind
? onHoverStyle(ind, obj?.blockColor)
Expand Down
1 change: 1 addition & 0 deletions apps/OpenSign/src/components/pdf/RenderPdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ function RenderPdf({
unSignedWidgetId={unSignedWidgetId}
setSelectWidgetId={setSelectWidgetId}
selectWidgetId={selectWidgetId}
setCurrWidgetsDetails={setCurrWidgetsDetails}
/>
</React.Fragment>
)
Expand Down
55 changes: 36 additions & 19 deletions apps/OpenSign/src/components/pdf/SignPad.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ function SignPad({
isInitial,
setIsInitial,
setIsStamp,
widgetType
widgetType,
currWidgetsDetails,
setCurrWidgetsDetails
}) {
const [penColor, setPenColor] = useState("blue");
const allColor = ["blue", "red", "black"];
Expand All @@ -31,6 +33,7 @@ function SignPad({
const [signValue, setSignValue] = useState("");
const [textWidth, setTextWidth] = useState(null);
const [textHeight, setTextHeight] = useState(null);
const [signatureType, setSignatureType] = useState("draw");
const fontOptions = [
{ value: "Fasthand" },
{ value: "Dancing Script" },
Expand All @@ -48,19 +51,11 @@ function SignPad({
`Parse/${localStorage.getItem("parseAppId")}/currentUser`
);
const jsonSender = JSON.parse(senderUser);

const currentUserName = jsonSender && jsonSender.name;

useEffect(() => {
const trimmedName = currentUserName.trim();
const firstCharacter = trimmedName.charAt(0);
const userName = isInitial ? firstCharacter : currentUserName;
setSignValue(userName);
setFontSelect("Fasthand");
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
//function for clear signature image
const handleClear = () => {
setCurrWidgetsDetails({});
if (isTab === "draw") {
if (canvasRef.current) {
canvasRef.current.clear();
Expand All @@ -72,7 +67,7 @@ function SignPad({
} else if (isTab === "uploadImage") {
setImage("");
}
setIsInitial(false);
// setIsInitial(false);
};
//function for set signature url
const handleSignatureChange = () => {
Expand Down Expand Up @@ -100,27 +95,28 @@ function SignPad({

<button
onClick={() => {
setCurrWidgetsDetails({});
if (!image) {
if (isTab === "mysignature") {
setIsSignImg("");
if (isInitial) {
onSaveSign("initials");
onSaveSign(signatureType, "initials");
} else {
onSaveSign("default");
onSaveSign(null, "default");
}
} else {
if (isTab === "type") {
setIsSignImg("");
onSaveSign(false, textWidth, textHeight);
onSaveSign(null, false, textWidth, textHeight);
} else {
onSaveSign();
onSaveSign(signatureType);
}
}

setPenColor("blue");
} else {
setIsSignImg("");
onSaveImage();
onSaveImage(signatureType);
}
setIsSignPad(false);
setIsInitial(false);
Expand Down Expand Up @@ -150,11 +146,27 @@ function SignPad({
</div>
);
};

//useEffect for set already draw or save signature url/text url of signature text type and draw type for initial type and signature type widgets
useEffect(() => {
if (canvasRef.current && isSignImg) {
canvasRef.current.fromDataURL(isSignImg);
if (currWidgetsDetails && canvasRef.current) {
const isWidgetType = currWidgetsDetails?.type;
const signatureType = currWidgetsDetails?.signatureType;
const url = currWidgetsDetails?.SignUrl;

//checking widget type and draw type signature url
if (isInitial) {
if (isWidgetType === "initials" && signatureType === "draw" && url) {
canvasRef.current.fromDataURL(url);
}
} else if (
isWidgetType === "signature" &&
signatureType === "draw" &&
url
) {
canvasRef.current.fromDataURL(url);
}
}

const trimmedName = currentUserName.trim();
const firstCharacter = trimmedName.charAt(0);
const userName = isInitial ? firstCharacter : currentUserName;
Expand Down Expand Up @@ -349,6 +361,7 @@ function SignPad({
setIsDefaultSign(false);
setIsImageSelect(true);
setIsTab("uploadImage");
setSignatureType("");
}}
style={{
color:
Expand All @@ -373,6 +386,7 @@ function SignPad({
setIsDefaultSign(false);
setIsImageSelect(false);
setIsTab("type");
setSignatureType("");
setImage();
}}
style={{
Expand Down Expand Up @@ -400,6 +414,7 @@ function SignPad({
setIsDefaultSign(true);
setIsImageSelect(true);
setIsTab("mysignature");
setSignatureType("");
setImage();
}}
style={{
Expand Down Expand Up @@ -430,6 +445,7 @@ function SignPad({
setIsDefaultSign(true);
setIsImageSelect(true);
setIsTab("mysignature");
setSignatureType("");
setImage();
}}
style={{
Expand Down Expand Up @@ -469,6 +485,7 @@ function SignPad({
setIsDefaultSign(false);
setImage();
setIsTab("draw");
setSignatureType("draw");
setSignValue("");
setIsStamp(false);
}}
Expand Down
4 changes: 4 additions & 0 deletions apps/OpenSign/src/components/pdf/SignerListPlace.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ function SignerListPlace(props) {
data-tut="reactourAddbtn"
className="p-[10px] my-[2px] flex flex-row items-center justify-center border-[1px] border-[#47a3ad] hover:bg-[#47a3ad] text-[#47a3ad] hover:text-white cursor-pointer"
onClick={() => props.handleAddSigner()}
style={{
opacity: props.isMailSend && "0.5",
pointerEvents: props.isMailSend && "none"
}}
>
<i className="fa-solid fa-plus"></i>
<span style={{ marginLeft: 2 }}>Add role</span>
Expand Down
7 changes: 6 additions & 1 deletion apps/OpenSign/src/components/pdf/WidgetComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,12 @@ function WidgetComponent({
</div>
)
) : (
<div data-tut={dataTut} className="signerComponent">
<div
data-tut={dataTut}
className={
isMailSend ? "disabled signerComponent " : "signerComponent"
}
>
<div
style={{
background: themeColor,
Expand Down
2 changes: 2 additions & 0 deletions apps/OpenSign/src/constant/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,7 @@ export const embedDocId = async (pdfDoc, documentId, allPages) => {

//function for save button to save signature or image url
export function onSaveSign(
type,
xyPostion,
index,
signKey,
Expand Down Expand Up @@ -975,6 +976,7 @@ export function onSaveSign(
Width: posWidth,
Height: posHeight,
SignUrl: signatureImg,
signatureType: type && type,
options: {
...position.options,
response: signatureImg
Expand Down
Loading