diff --git a/apps/OpenSign/src/components/pdf/Placeholder.js b/apps/OpenSign/src/components/pdf/Placeholder.js index d1ec47e01..f21cb988f 100644 --- a/apps/OpenSign/src/components/pdf/Placeholder.js +++ b/apps/OpenSign/src/components/pdf/Placeholder.js @@ -54,7 +54,7 @@ function Placeholder(props) { useEffect(() => { //set default current date and default format MM/dd/yyyy - if (props.isPlaceholder || props.isSignYourself) { + if (props.isSignYourself) { const date = new Date(); const milliseconds = date.getTime(); const newDate = moment(milliseconds).format("MM/DD/YYYY"); @@ -63,6 +63,22 @@ function Placeholder(props) { format: "MM/dd/YYYY" }; setSelectDate(dateObj); + } else { + const defaultRes = props?.pos?.options?.response; + const defaultFormat = props.pos?.options?.validation?.format; + const updateDate = defaultRes + ? new Date(props?.pos?.options?.response) + : new Date(); + const dateFormat = defaultFormat ? defaultFormat : "MM/DD/YYYY"; + const milliseconds = updateDate.getTime(); + const newDate = moment(milliseconds).format(dateFormat); + const dateObj = { + date: newDate, + format: props.pos?.options?.validation?.format + ? props.pos?.options?.validation?.format + : "MM/dd/YYYY" + }; + setSelectDate(dateObj); } // eslint-disable-next-line react-hooks/exhaustive-deps }, []); diff --git a/apps/OpenSign/src/components/pdf/PlaceholderType.js b/apps/OpenSign/src/components/pdf/PlaceholderType.js index 32ab4aa87..795d942bd 100644 --- a/apps/OpenSign/src/components/pdf/PlaceholderType.js +++ b/apps/OpenSign/src/components/pdf/PlaceholderType.js @@ -1,5 +1,5 @@ import React, { useEffect, useState, forwardRef, useRef } from "react"; -import { onChangeInput } from "../../constant/Utils"; +import { getMonth, getYear, onChangeInput, range } from "../../constant/Utils"; import DatePicker from "react-datepicker"; import "react-datepicker/dist/react-datepicker.css"; import "../../styles/signature.css"; @@ -15,6 +15,21 @@ function PlaceholderType(props) { const inputRef = useRef(null); const [textValue, setTextValue] = useState(); const [selectedCheckbox, setSelectedCheckbox] = useState([]); + const years = range(1990, getYear(new Date()) + 16, 1); + const months = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" + ]; const validateExpression = (regexValidation) => { let regexObject = regexValidation; if (props.pos?.options.validation.type === "regex") { @@ -31,7 +46,6 @@ function PlaceholderType(props) { const handleInputBlur = () => { props.setDraggingEnabled(true); const validateType = props.pos?.options?.validation?.type; - let regexValidation; if (validateType) { switch (validateType) { @@ -293,6 +307,7 @@ function PlaceholderType(props) { isRadio ); }; + switch (type) { case "signature": return props.pos.SignUrl ? ( @@ -595,6 +610,34 @@ function PlaceholderType(props) { return (
( +
+ + +
+ )} disabled={ props.isNeedSign && props.data?.signerObjId !== props.signerObjId } @@ -712,6 +755,7 @@ function PlaceholderType(props) { case "label": return (