diff --git a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js index d0bc760b0..edb9d007c 100644 --- a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js +++ b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js @@ -9,7 +9,6 @@ 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 Tour from "reactour"; import { contractDocument, @@ -20,8 +19,7 @@ import { onImageSelect, onSaveSign, onSaveImage, - addDefaultSignatureImg, - getHostUrl + addDefaultSignatureImg } from "../utils/Utils"; import Loader from "./component/loader"; import HandleError from "./component/HandleError"; @@ -34,7 +32,6 @@ 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([]); @@ -377,8 +374,7 @@ function PdfRequestFiles() { (data) => data.signerObjId === signerObjectId ); if (checkUser && checkUser.length > 0) { - let unSignUrlData, - checkboxExist, + let checkboxExist, requiredRadio, showAlert = false, widgetKey, @@ -464,9 +460,6 @@ function PdfRequestFiles() { position.type !== "checkbox" ); if (requiredWidgets && requiredWidgets?.length > 0) { - unSignUrlData = checkUser[0].placeHolder[i].pos.filter( - (pos) => !pos?.SignUrl && !pos.options.response - ); let checkSigned; for (let i = 0; i < requiredWidgets?.length; i++) { checkSigned = requiredWidgets[i]?.options?.response; diff --git a/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js b/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js index 4fda21246..575a36373 100644 --- a/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js +++ b/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js @@ -451,8 +451,6 @@ function SignYourSelf() { const x = offset.x - containerRect.left; const y = offset.y - containerRect.top; - const ybottom = containerRect.bottom - offset.y; - dropObj = { xPosition: signBtnPosition[0] ? x - signBtnPosition[0].xPos : x, yPosition: signBtnPosition[0] ? y - signBtnPosition[0].yPos : y, diff --git a/microfrontends/SignDocuments/src/Component/WidgetComponent/dropdownWidgetOption.js b/microfrontends/SignDocuments/src/Component/WidgetComponent/dropdownWidgetOption.js index 0d1cbdeeb..6880baf54 100644 --- a/microfrontends/SignDocuments/src/Component/WidgetComponent/dropdownWidgetOption.js +++ b/microfrontends/SignDocuments/src/Component/WidgetComponent/dropdownWidgetOption.js @@ -15,17 +15,16 @@ function DropdownWidgetOption(props) { const statusArr = ["required", "optional"]; const [defaultCheckbox, setDefaultCheckbox] = useState([]); - const resetState = () => { setDropdownOptionList(["option-1", "option-2"]); setDropdownName(props.type); - setIsReadOnly(false); + setIsReadOnly(false); setMinCount(0); setMaxCount(0); setDefaultCheckbox([]); - setDefaultValue("") + setDefaultValue(""); }; - + useEffect(() => { if ( props.currWidgetsDetails?.options?.name && @@ -42,14 +41,14 @@ function DropdownWidgetOption(props) { setIsReadOnly(props.currWidgetsDetails?.options?.isReadOnly); setStatus(props.currWidgetsDetails?.options?.status || "required"); setDefaultValue(props.currWidgetsDetails?.options?.defaultValue || ""); - setDefaultCheckbox(props.currWidgetsDetails?.options?.defaultValue|| []); + setDefaultCheckbox(props.currWidgetsDetails?.options?.defaultValue || []); } else { setStatus("required"); - resetState(); + resetState(); } }, [props.currWidgetsDetails]); - - const handleInputChange = (index, value) => { + + const handleInputChange = (index, value) => { setDropdownOptionList((prevInputs) => { const newInputs = [...prevInputs]; newInputs[index] = value; @@ -57,32 +56,50 @@ function DropdownWidgetOption(props) { }); }; -//function add add checkbox option and add width of checkbox + //function add add checkbox option and add width of checkbox const handleAddInput = () => { const deleteOption = false; - const addOption = true - setDropdownOptionList((prevInputs) => [...prevInputs, ""]); - props.handleSaveWidgetsOptions(null, null, null, null, null, addOption, deleteOption); + const addOption = true; + setDropdownOptionList((prevInputs) => [...prevInputs, ""]); + props.handleSaveWidgetsOptions( + null, + null, + null, + null, + null, + addOption, + deleteOption + ); }; -//function add add checkbox option and delete width of checkbox + //function add add checkbox option and delete width of checkbox const handleDeleteInput = (ind) => { const deleteOption = true; - const addOption = false + const addOption = false; const getUpdatedOptions = dropdownOptionList.filter( (data, index) => index !== ind ); setDropdownOptionList(getUpdatedOptions); - props.handleSaveWidgetsOptions(null, null, null, null, null, addOption, deleteOption); + props.handleSaveWidgetsOptions( + null, + null, + null, + null, + null, + addOption, + deleteOption + ); }; - - + const handleSaveOption = () => { - const defaultData = - defaultCheckbox && defaultCheckbox.length > 0 - ? defaultCheckbox - : defaultValue; - + let defaultData; + if (props.type === "checkbox") { + defaultData = + defaultCheckbox && defaultCheckbox.length > 0 ? defaultCheckbox : []; + } else { + defaultData = defaultValue ? defaultValue : ""; + } + props.handleSaveWidgetsOptions( dropdownName, dropdownOptionList, @@ -94,15 +111,15 @@ function DropdownWidgetOption(props) { status, defaultData ); - // props.setShowDropdown(false); + // props.setShowDropdown(false); setDropdownOptionList(["option-1", "option-2"]); setDropdownName(props.type); - // props.setCurrWidgetsDetails({}); + // props.setCurrWidgetsDetails({}); setIsReadOnly(false); setMinCount(0); setMaxCount(0); setDefaultCheckbox([]); - setDefaultValue("") + setDefaultValue(""); }; const handleSetMinMax = (e) => { @@ -121,9 +138,8 @@ function DropdownWidgetOption(props) { } else { return false; } - }; - + return ( //props.showDropdown
- -
{ e.preventDefault(); @@ -142,19 +156,20 @@ function DropdownWidgetOption(props) { }} >
- {["checkbox","radio"].includes(props.type) && !props.isSignYourself && ( -
- { - setIsReadOnly(e.target.checked); - }} - /> + {["checkbox", "radio"].includes(props.type) && + !props.isSignYourself && ( +
+ { + setIsReadOnly(e.target.checked); + }} + /> - -
- )} + +
+ )} @@ -165,8 +180,7 @@ function DropdownWidgetOption(props) { onChange={(e) => setDropdownName(e.target.value)} className="drodown-input" /> - - + {props.type === "checkbox" && !props.isSignYourself && ( <>
- {["dropdown","radio"].includes(props.type) && ( + {["dropdown", "radio"].includes(props.type) && ( <> - + - - + name="defaultvalue" + value={defaultValue} + placeholder="select default value" + > + + {dropdownOptionList.map((data, ind) => { + return ( + + ); + })} + )} - {props.type !== "checkbox" && props.type !== 'radio' && ( + {props.type !== "checkbox" && props.type !== "radio" && ( <>
-
-
- ); -} - -export default InputValidation; diff --git a/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholderType.js b/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholderType.js index 520c3f07b..7a7a8494a 100644 --- a/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholderType.js +++ b/microfrontends/SignDocuments/src/Component/WidgetComponent/placeholderType.js @@ -6,7 +6,7 @@ import "../../css/signature.css"; import RegexParser from "regex-parser"; function PlaceholderType(props) { - const type = props.pos.type; + const type = props?.pos?.type; const [selectOption, setSelectOption] = useState( props.pos?.options?.defaultValue ? props.pos?.options?.defaultValue : "" ); @@ -73,34 +73,41 @@ function PlaceholderType(props) { setValidatePlaceholder("enter text"); } } - useEffect(() => { - if (props.pos?.options?.hint) { - setValidatePlaceholder(props.pos?.options.hint); - } else if (props.pos?.options?.validation?.type) { - checkRegularExpress(props.pos?.options?.validation?.type); - } - }, []); useEffect(() => { - if (props.isNeedSign && props.pos.type === "date") { + if (props.isNeedSign && type === "date") { const updateDate = new Date(); setStartDate(updateDate); + } else if (type && type === "checkbox" && props.isNeedSign) { + const isDefaultValue = props.pos.options?.defaultValue; + if (isDefaultValue) { + setSelectedCheckbox(isDefaultValue); + } + } else if (props.pos?.options?.hint) { + setValidatePlaceholder(props.pos?.options.hint); + } else if (props.pos?.options?.validation?.type) { + checkRegularExpress(props.pos?.options?.validation?.type); } setTextValue( props.pos?.options?.defaultValue ? props.pos?.options?.defaultValue : "" ); }, []); - //for handle default checked options + useEffect(() => { - if (props.pos?.type && props.pos.type === "checkbox" && props.isNeedSign) { - const isDefaultValue = props.pos.options?.defaultValue; - if (isDefaultValue) { - setSelectedCheckbox(isDefaultValue); + 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 (props.pos?.type && props.pos.type === "date") { + if (type && type === "date") { if (props.selectDate) { let updateDate; if (props.selectDate.format === "dd-MM-yyyy") { @@ -122,22 +129,21 @@ function PlaceholderType(props) { : "MM/dd/YYYY" }; props.setSelectDate(dateObj); + onChangeInput( + props.saveDateFormat, + props.pos.key, + props.xyPostion, + props.index, + props.setXyPostion, + props.data && props.data.Id, + false, + props.selectDate?.format + ? props.selectDate.format + : props.pos?.options?.validation?.format + ? props.pos?.options?.validation?.format + : "MM/dd/YYYY" + ); } - - onChangeInput( - props.saveDateFormat, - props.pos.key, - props.xyPostion, - props.index, - props.setXyPostion, - props.data && props.data.Id, - false, - props.selectDate?.format - ? props.selectDate.format - : props.pos?.options?.validation?.format - ? props.pos?.options?.validation?.format - : "MM/dd/YYYY" - ); } }, [props.saveDateFormat]); @@ -159,32 +165,22 @@ function PlaceholderType(props) { useEffect(() => { if ( - ["name", "email", "job title", "company"].includes(props.pos?.type) && + ["name", "email", "job title", "company"].includes(type) && props.isNeedSign && - props.data?.signerObjId === props?.signerObjId + 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 isDefault = true; const senderUser = localStorage.getItem(`Extand_Class`); const jsonSender = JSON.parse(senderUser); - - if (props.isNeedSign && props.data?.signerObjId === props.signerObjId) { - onChangeInput( - jsonSender && jsonSender[0], - null, - props.xyPostion, - null, - props.setXyPostion, - props.data.Id, - true - ); - } + onChangeInput( + jsonSender && jsonSender[0], + null, + props.xyPostion, + null, + props.setXyPostion, + props.data.Id, + isDefault + ); } }, [type]); @@ -233,7 +229,7 @@ function PlaceholderType(props) { let updateSelectedCheckbox = [], checkedList; let isDefaultValue, isDefaultEmpty; - if (props.pos?.type === "checkbox") { + if (type === "checkbox") { updateSelectedCheckbox = selectedCheckbox ? selectedCheckbox : []; if (isChecked) { @@ -293,7 +289,7 @@ function PlaceholderType(props) { ); }; - switch (props.pos.type) { + switch (type) { case "signature": return props.pos.SignUrl ? ( - {props.pos.type} + {type} ); case "dropdown": @@ -463,7 +459,7 @@ function PlaceholderType(props) { className="inputPlaceholder" style={{ fontSize: calculateFontSize() }} > - {props.pos?.options?.name ? props.pos.options.name : props.pos.type} + {props.pos?.options?.name ? props.pos.options.name : type} ); case "initials": @@ -500,6 +496,7 @@ function PlaceholderType(props) { value={textValue} onBlur={handleInputBlur} onChange={(e) => { + const isDefault = false; handleTextValid(e); onChangeInput( e.target.value, @@ -508,7 +505,7 @@ function PlaceholderType(props) { props.index, props.setXyPostion, props.data && props.data?.Id, - false + isDefault ); }} /> @@ -519,7 +516,7 @@ function PlaceholderType(props) { fontSize: calculateFontSize() }} > - {props.pos.type} + {type} ); case "company": @@ -553,7 +550,7 @@ function PlaceholderType(props) { fontSize: calculateFontSize() }} > - {props.pos.type} + {type} ); case "job title": @@ -587,7 +584,7 @@ function PlaceholderType(props) { fontSize: calculateFontSize() }} > - {props.pos.type} + {type} ); case "date": @@ -674,7 +671,7 @@ function PlaceholderType(props) { fontSize: calculateFontSize() }} > - {props.pos.type} + {type} ); case "radio": @@ -713,6 +710,7 @@ function PlaceholderType(props) {