diff --git a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js index 8d146c594..d0bc760b0 100644 --- a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js +++ b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js @@ -388,10 +388,6 @@ function PdfRequestFiles() { for (let j = 0; j < checkUser[0].placeHolder[i].pos.length; j++) { checkboxExist = checkUser[0].placeHolder[i].pos[j].type === "checkbox"; - - // radioExist = checkUser[0].placeHolder[i].pos[i].some( - // (data) => data.type === "radio" - // ); radioExist = checkUser[0].placeHolder[i].pos[j].type === "radio"; if (checkboxExist) { requiredCheckbox = checkUser[0].placeHolder[i].pos.filter( diff --git a/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js b/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js index f8d126eef..4fda21246 100644 --- a/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js +++ b/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js @@ -518,16 +518,30 @@ function SignYourSelf() { //function for send placeholder's co-ordinate(x,y) position embed signature url or stamp url async function embedWidgetsData() { - let checkSigned = 0; - let allXyPos = 0; + let showAlert = false; - for (let i = 0; i < xyPostion.length; i++) { - const posWidgetData = xyPostion[i].pos.filter( - (pos) => pos.options.response + for (let i = 0; i < xyPostion?.length; i++) { + const requiredWidgets = xyPostion[i].pos.filter( + (position) => position.type !== "checkbox" ); - - checkSigned = checkSigned + posWidgetData.length; - allXyPos = allXyPos + xyPostion[i].pos.length; + if (requiredWidgets && requiredWidgets?.length > 0) { + let checkSigned; + for (let i = 0; i < requiredWidgets?.length; i++) { + checkSigned = requiredWidgets[i]?.options?.response; + if (!checkSigned) { + const checkSignUrl = requiredWidgets[i]?.pos?.SignUrl; + + let checkDefaultSigned = requiredWidgets[i]?.options?.defaultValue; + if (!checkSignUrl) { + if (!checkDefaultSigned) { + if (!showAlert) { + showAlert = true; + } + } + } + } + } + } } if (xyPostion.length === 0) { setIsAlert({ @@ -535,7 +549,7 @@ function SignYourSelf() { alertMessage: "Please complete your signature!" }); return; - } else if (xyPostion.length > 0 && allXyPos !== checkSigned) { + } else if (showAlert) { setIsAlert({ isShow: true, alertMessage: "Please complete your signature!" diff --git a/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholderType.js b/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholderType.js index 864d6cad8..520c3f07b 100644 --- a/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholderType.js +++ b/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholderType.js @@ -15,7 +15,6 @@ function PlaceholderType(props) { const inputRef = useRef(null); const [textValue, setTextValue] = useState(); const [selectedCheckbox, setSelectedCheckbox] = useState([]); - const validateExpression = (regexValidation) => { let regexObject = regexValidation; if (props.pos?.options.validation.type === "regex") { @@ -159,7 +158,19 @@ function PlaceholderType(props) { )); useEffect(() => { - if (props.pos?.type) { + if ( + ["name", "email", "job title", "company"].includes(props.pos?.type) && + props.isNeedSign && + props.data?.signerObjId === props?.signerObjId + ) { + const defaultData = props.pos?.options?.defaultValue; + if (defaultData) { + setTextValue(defaultData); + } + } + }, [props.pos?.options?.defaultValue]); + useEffect(() => { + if (["name", "email", "job title", "company"].includes(props.pos?.type)) { const senderUser = localStorage.getItem(`Extand_Class`); const jsonSender = JSON.parse(senderUser); @@ -486,7 +497,7 @@ function PlaceholderType(props) { style={{ fontSize: calculateFontSize() }} className="inputPlaceholder" type="text" - value={textValue ? textValue : props.pos?.options?.defaultValue} + value={textValue} onBlur={handleInputBlur} onChange={(e) => { handleTextValid(e); @@ -520,7 +531,7 @@ function PlaceholderType(props) { ref={inputRef} placeholder={"company"} style={{ fontSize: calculateFontSize() }} - value={textValue ? textValue : props.pos?.options?.defaultValue} + value={textValue} onBlur={handleInputBlur} onChange={(e) => { handleTextValid(e); @@ -554,7 +565,7 @@ function PlaceholderType(props) { ref={inputRef} placeholder={"job title"} style={{ fontSize: calculateFontSize() }} - value={textValue ? textValue : props.pos?.options?.defaultValue} + value={textValue} onBlur={handleInputBlur} onChange={(e) => { handleTextValid(e); @@ -641,7 +652,7 @@ function PlaceholderType(props) { ref={inputRef} placeholder={"email"} style={{ fontSize: calculateFontSize() }} - value={textValue ? textValue : props.pos?.options?.defaultValue} + value={textValue} onBlur={handleInputBlur} onChange={(e) => { handleTextValid(e);