diff --git a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js
index 2b23e9384..91266cffd 100644
--- a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js
+++ b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js
@@ -9,6 +9,7 @@ import { HTML5Backend } from "react-dnd-html5-backend";
import { useParams } from "react-router-dom";
import SignPad from "./component/signPad";
import RenderAllPdfPage from "./component/renderAllPdfPage";
+import { useNavigate } from "react-router-dom";
import {
contractDocument,
multiSignEmbed,
@@ -18,7 +19,8 @@ import {
onImageSelect,
onSaveSign,
onSaveImage,
- addDefaultSignatureImg
+ addDefaultSignatureImg,
+ getHostUrl
} from "../utils/Utils";
import Loader from "./component/loader";
import HandleError from "./component/HandleError";
@@ -31,6 +33,7 @@ import DefaultSignature from "./component/defaultSignature";
import ModalUi from "../premitives/ModalUi";
function PdfRequestFiles() {
+ const navigate = useNavigate();
const { docId } = useParams();
const [pdfDetails, setPdfDetails] = useState([]);
const [signedSigners, setSignedSigners] = useState([]);
@@ -63,6 +66,7 @@ function PdfRequestFiles() {
const [isDecline, setIsDecline] = useState({ isDeclined: false });
const [currentSigner, setCurrentSigner] = useState(false);
const [isAlert, setIsAlert] = useState({ isShow: false, alertMessage: "" });
+ const [isInitialSign, setIsInitialSign] = useState(false);
const [defaultSignAlert, setDefaultSignAlert] = useState({
isShow: false,
alertMessage: ""
@@ -116,9 +120,20 @@ function PdfRequestFiles() {
});
}
}, [divRef.current]);
-
+ // Function to check if the given initial value exists in the array
+ const isInitialValueExist = (array, initialValue) => {
+ for (const item of array) {
+ for (const pos of item.pos) {
+ if (pos.type === "initials") {
+ return true;
+ }
+ }
+ }
+ return false;
+ };
//function for get document details for perticular signer with signer'object id
const getDocumentDetails = async () => {
+ let currUserId;
//getting document details
const documentData = await contractDocument(documentId);
if (documentData && documentData.length > 0) {
@@ -135,9 +150,7 @@ function PdfRequestFiles() {
(data) => data.UserId.objectId === jsonSender.objectId
);
- const currUserId = getCurrentSigner[0]
- ? getCurrentSigner[0].objectId
- : "";
+ currUserId = getCurrentSigner[0] ? getCurrentSigner[0].objectId : "";
setSignerObjectId(currUserId);
if (documentData[0].SignedUrl) {
setPdfUrl(documentData[0].SignedUrl);
@@ -269,7 +282,17 @@ function PdfRequestFiles() {
if (res[0] && res.length > 0) {
setDefaultSignImg(res[0].ImageURL);
- setInitial(res[0]?.Initials);
+ const getcurrentUserPosition = documentData[0].Placeholders.filter(
+ (data) => data.signerObjId === currUserId
+ );
+ const getPlacecholder = getcurrentUserPosition[0].placeHolder;
+ const checkInitialExist = isInitialValueExist(getPlacecholder);
+
+ if (res[0].Initials) {
+ setInitial(res[0]?.Initials);
+ } else if (checkInitialExist) {
+ setIsInitialSign(true);
+ }
}
const loadObj = {
isLoad: false
@@ -568,6 +591,11 @@ function PdfRequestFiles() {
});
};
+ const handleAddInitial = () => {
+ const hostUrl = getHostUrl();
+ navigate(`${hostUrl}managesign`);
+ };
+
return (
@@ -1002,6 +1030,40 @@ function PdfRequestFiles() {
)}
+ {
+ setIsInitialSign(false);
+ }}
+ >
+
+
Please add your initial signature
+
+
+
+
+
+
);
}
diff --git a/microfrontends/SignDocuments/src/Component/TemplatePlaceholder.js b/microfrontends/SignDocuments/src/Component/TemplatePlaceholder.js
index f41b5d454..055cf9e2b 100644
--- a/microfrontends/SignDocuments/src/Component/TemplatePlaceholder.js
+++ b/microfrontends/SignDocuments/src/Component/TemplatePlaceholder.js
@@ -103,7 +103,7 @@ const TemplatePlaceholder = () => {
item: {
type: "BOX",
id: 1,
- text: "drag me"
+ text: "signature"
},
collect: (monitor) => ({
isDragSign: !!monitor.isDragging()
@@ -115,7 +115,7 @@ const TemplatePlaceholder = () => {
item: {
type: "BOX",
id: 2,
- text: "drag me"
+ text: "stamp"
},
collect: (monitor) => ({
isDragStamp: !!monitor.isDragging()
@@ -127,7 +127,7 @@ const TemplatePlaceholder = () => {
item: {
type: "BOX",
id: 3,
- text: "drag me"
+ text: "signature"
},
collect: (monitor) => ({
isDragSignatureSS: !!monitor.isDragging()
@@ -139,7 +139,7 @@ const TemplatePlaceholder = () => {
item: {
type: "BOX",
id: 4,
- text: "drag me"
+ text: "stamp"
},
collect: (monitor) => ({
isDragStampSS: !!monitor.isDragging()
@@ -349,13 +349,14 @@ const TemplatePlaceholder = () => {
const dropObj = {
xPosition: window.innerWidth / 2 - 100,
yPosition: window.innerHeight / 2 - 60,
- isStamp: monitor,
+ isStamp: monitor.type === "stamp" && true,
key: key,
isDrag: false,
scale: scale,
isMobile: isMobile,
yBottom: window.innerHeight / 2 - 60,
- zIndex: posZIndex
+ zIndex: posZIndex,
+ type: monitor.type
};
dropData.push(dropObj);
placeHolder = {
@@ -383,7 +384,8 @@ const TemplatePlaceholder = () => {
yBottom: ybottom,
scale: scale,
isMobile: isMobile,
- zIndex: posZIndex
+ zIndex: posZIndex,
+ type: item.text
};
dropData.push(dropObj);
@@ -458,6 +460,7 @@ const TemplatePlaceholder = () => {
}
}
};
+
//function for get pdf page details
const pageDetails = async (pdf) => {
const load = {
@@ -635,7 +638,7 @@ const TemplatePlaceholder = () => {
if (signerPos.length !== signersdata.length) {
setIsSendAlert(true);
} else {
- // handleSaveTemplate();
+ handleSaveTemplate();
}
};
const handleSaveTemplate = async () => {
@@ -1156,7 +1159,7 @@ const TemplatePlaceholder = () => {
dragStamp={dragStamp}
dragRef={dragRef}
isDragStamp={isDragStamp}
- isSignYourself={true}
+ isSignYourself={false}
isDragSignatureSS={isDragSignatureSS}
dragSignatureSS={dragSignatureSS}
dragStampSS={dragStampSS}
@@ -1179,42 +1182,49 @@ const TemplatePlaceholder = () => {
handleRoleChange={handleRoleChange}
handleOnBlur={handleOnBlur}
title={"Roles"}
+ initial={true}
/>
) : (
diff --git a/microfrontends/SignDocuments/src/Component/WidgetComponent/dropdownWidgetOption.js b/microfrontends/SignDocuments/src/Component/WidgetComponent/dropdownWidgetOption.js
index 8888a7c5b..f5f138640 100644
--- a/microfrontends/SignDocuments/src/Component/WidgetComponent/dropdownWidgetOption.js
+++ b/microfrontends/SignDocuments/src/Component/WidgetComponent/dropdownWidgetOption.js
@@ -1,7 +1,6 @@
import React, { useState } from "react";
-import Modal from "react-bootstrap/Modal";
-import ModalHeader from "react-bootstrap/esm/ModalHeader";
import { themeColor } from "../../utils/ThemeColor/backColor";
+import ModalUi from "../../premitives/ModalUi";
function DropdownWidgetOption(props) {
const [dropdownOptionList, setDropdownOptionList] = useState([
"option-1",
@@ -21,9 +20,7 @@ function DropdownWidgetOption(props) {
const handleAddInput = () => {
setDropdownOptionList((prevInputs) => [...prevInputs, ""]);
};
- const handleAddOption = () => {
- setDropdownOptionList([...dropdownOptionList, ""]);
- };
+
const handleDeleteInput = (ind) => {
const getUpdatedOptions = dropdownOptionList.filter(
(data, index) => index !== ind
@@ -46,11 +43,14 @@ function DropdownWidgetOption(props) {
return (
//props.showDropdown
-
-
- Dropdown options
-
-
+ props.setShowDropdown(false)}
+ >
+
{error}
-
-
-
-
+ {/* props.setShowDropdown(false)}
+ style={{
+ color: "black"
+ }}
+ type="button"
+ className="finishBtn"
+ >
+ cancel
+ */}
+
+
);
}
diff --git a/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholder.js b/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholder.js
index bce9dd82d..ef608842b 100644
--- a/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholder.js
+++ b/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholder.js
@@ -13,26 +13,26 @@ function Placeholder(props) {
if (props.pos.type === "text" || props.pos.type === "checkbox") {
setDraggingEnabled(false);
}
- if (props.isNeedSign && !props.isDragging) {
+ if ((props.isNeedSign || props.isSignYourself) && !props.isDragging) {
if (props.pos.type) {
if (props.pos.type === "signature" || props.pos.type === "stamp") {
props.setIsSignPad(true);
props.setSignKey(props.pos.key);
props.setIsStamp(props.pos.isStamp);
- } else if (props.pos.type === "dropdown" && !props.isNeedSign) {
- props?.setShowDropdown(true);
- props?.setSignKey(props.pos.key);
}
} else {
props.setIsSignPad(true);
props.setSignKey(props.pos.key);
props.setIsStamp(props.pos?.isStamp ? props.pos.isStamp : false);
}
- } else if (props.isPlaceholder && props.pos.type) {
- if (props.pos.type === "dropdown") {
- props.setShowDropdown(true);
- props.setSignKey(props.pos.key);
- }
+ } else if (
+ props.isPlaceholder &&
+ props.pos.type === "dropdown" &&
+ !props.isDragging
+ ) {
+ props?.setShowDropdown(true);
+ props?.setSignKey(props.pos.key);
+ props.setUniqueId(props.data.Id);
} else if (!props.pos.type) {
if (
!props.pos.type &&
@@ -114,8 +114,7 @@ function Placeholder(props) {
onResizeStop={() => {
props.setIsResize && props.setIsResize(false);
}}
- disableDragging={!isDraggingEnabled}
- // disableDragging={props.isNeedSign || (props.isRecipient && true)}
+ disableDragging={props.isNeedSign ? true : !isDraggingEnabled}
onDragStop={(event, dragElement) =>
props.handleStop &&
props.handleStop(event, dragElement, props.signerObjId, props.pos.key)
@@ -136,7 +135,13 @@ function Placeholder(props) {
false
);
}}
- onClick={() => handlePlaceholderClick()}
+ onClick={() => {
+ props.isNeedSign && props.data?.signerObjId === props.signerObjId
+ ? handlePlaceholderClick()
+ : props.isPlaceholder
+ ? handlePlaceholderClick()
+ : props.isSignYourself && handlePlaceholderClick();
+ }}
>
{props.isShowBorder ? (
diff --git a/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholderType.js b/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholderType.js
index 4852a6a8f..1b2a1f1e1 100644
--- a/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholderType.js
+++ b/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholderType.js
@@ -8,14 +8,14 @@ function PlaceholderType(props) {
props.setDraggingEnabled(true);
};
useEffect(() => {
- if (props.isNeedSign) {
+ if (props.isNeedSign && props.data?.signerObjId === props.signerObjId) {
onChangeInput(
props.pdfDetails,
null,
props.xyPostion,
null,
props.setXyPostion,
- props.data && props.data.signerObjId,
+ props.signerObjId,
props.initial
);
}
@@ -80,7 +80,11 @@ function PlaceholderType(props) {
className="inputPlaceholder"
style={{ outlineColor: "#007bff" }}
type="checkbox"
- disabled={props.isPlaceholder}
+ disabled={
+ props.isNeedSign && props.data?.signerObjId !== props.signerObjId
+ ? true
+ : props.isPlaceholder
+ }
onBlur={handleInputBlur}
onChange={(e) =>
onChangeInput(
@@ -101,7 +105,11 @@ function PlaceholderType(props) {
className="inputPlaceholder"
type="text"
tabIndex="0"
- disabled={props.isPlaceholder}
+ disabled={
+ props.isNeedSign && props.data?.signerObjId !== props.signerObjId
+ ? true
+ : props.isPlaceholder
+ }
onBlur={handleInputBlur}
onChange={(e) =>
onChangeInput(
@@ -117,7 +125,7 @@ function PlaceholderType(props) {
/>
);
case "dropdown":
- return !props.isPlaceholder ? (
+ return props.data?.signerObjId === props.signerObjId ? (