diff --git a/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js b/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js
index d9d7a7a6b..19d616dc9 100644
--- a/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js
+++ b/apps/OpenSign/src/components/pdf/DropdownWidgetOption.js
@@ -15,6 +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);
+ setMinCount(0);
+ setMaxCount(0);
+ setDefaultCheckbox([]);
+ setDefaultValue("");
+ };
+
useEffect(() => {
if (
props.currWidgetsDetails?.options?.name &&
@@ -34,7 +44,9 @@ function DropdownWidgetOption(props) {
setDefaultCheckbox(props.currWidgetsDetails?.options?.defaultValue || []);
} else {
setStatus("required");
+ resetState();
}
+ // eslint-disable-next-line react-hooks/exhaustive-deps
}, [props.currWidgetsDetails]);
const handleInputChange = (index, value) => {
setDropdownOptionList((prevInputs) => {
@@ -44,19 +56,39 @@ function DropdownWidgetOption(props) {
});
};
+ //function add add checkbox option and add width of checkbox
const handleAddInput = () => {
- const flage = true;
+ const deleteOption = false;
+ const addOption = true;
setDropdownOptionList((prevInputs) => [...prevInputs, ""]);
- props.handleSaveWidgetsOptions(null, null, null, null, null, flage, false);
+ props.handleSaveWidgetsOptions(
+ null,
+ null,
+ null,
+ null,
+ null,
+ addOption,
+ deleteOption
+ );
};
+ //function add add checkbox option and delete width of checkbox
const handleDeleteInput = (ind) => {
- const flage = true;
+ const deleteOption = true;
+ const addOption = false;
const getUpdatedOptions = dropdownOptionList.filter(
(data, index) => index !== ind
);
setDropdownOptionList(getUpdatedOptions);
- props.handleSaveWidgetsOptions(null, null, null, null, null, false, flage);
+ props.handleSaveWidgetsOptions(
+ null,
+ null,
+ null,
+ null,
+ null,
+ addOption,
+ deleteOption
+ );
};
const handleSaveOption = () => {
@@ -76,10 +108,10 @@ 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);
@@ -354,12 +386,8 @@ function DropdownWidgetOption(props) {
type="submit"
className="finishBtn cancelBtn"
onClick={() => {
- setDropdownOptionList(["option-1", "option-2"]);
- setDropdownName(props.type);
- props.setCurrWidgetsDetails([]);
- props.setShowDropdown(false);
- setDefaultCheckbox([]);
- setDefaultValue("");
+ props.handleClose && props.handleClose();
+ resetState();
}}
>
Cancel
diff --git a/apps/OpenSign/src/components/pdf/Placeholder.js b/apps/OpenSign/src/components/pdf/Placeholder.js
index ea047b17b..4fe300cd0 100644
--- a/apps/OpenSign/src/components/pdf/Placeholder.js
+++ b/apps/OpenSign/src/components/pdf/Placeholder.js
@@ -55,6 +55,21 @@ function Placeholder(props) {
}
};
+ useEffect(() => {
+ //set default current date and default format MM/dd/yyyy
+ if (props.isPlaceholder || props.isSignYourself) {
+ const date = new Date();
+ const milliseconds = date.getTime();
+ const newDate = moment(milliseconds).format("MM/DD/YYYY");
+ const dateObj = {
+ date: newDate,
+ format: "MM/dd/YYYY"
+ };
+ setSelectDate(dateObj);
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
+
//function for add selected date and format in selectFormat
const changeDateFormat = () => {
const updateDate = [];
@@ -410,10 +425,11 @@ function Placeholder(props) {
//ref={nodeRef}
key={props.pos.key}
lockAspectRatio={
- props.pos.Width
+ props.pos.type !== "label" &&
+ (props.pos.Width
? props.pos.Width / props.pos.Height
: defaultWidthHeight(props.pos.type).width /
- defaultWidthHeight(props.pos.type).height
+ defaultWidthHeight(props.pos.type).height)
}
enableResizing={{
top: false,
@@ -458,7 +474,7 @@ function Placeholder(props) {
? props.pos.zIndex
: "5",
background: props.data
- ? props.pos.type !== "checkbox" && props.data.blockColor
+ ? props.data.blockColor
: props.pos.type !== "checkbox" && "rgb(203 233 237)"
}}
onDrag={() => {
diff --git a/apps/OpenSign/src/components/pdf/PlaceholderBorder.js b/apps/OpenSign/src/components/pdf/PlaceholderBorder.js
index 10cec89aa..543d17ac7 100644
--- a/apps/OpenSign/src/components/pdf/PlaceholderBorder.js
+++ b/apps/OpenSign/src/components/pdf/PlaceholderBorder.js
@@ -14,6 +14,7 @@ function PlaceholderBorder(props) {
return (
{
@@ -105,7 +107,9 @@ function PlaceholderType(props) {
const [day, month, year] = props.saveDateFormat.split("-");
updateDate = new Date(`${year}-${month}-${day}`);
} else {
- updateDate = new Date();
+ if (props?.saveDateFormat) {
+ updateDate = new Date(props.saveDateFormat);
+ }
}
// const updateDate = new Date(props.saveDateFormat);
setStartDate(updateDate);
@@ -156,7 +160,20 @@ function PlaceholderType(props) {
ExampleCustomInput.displayName = "ExampleCustomInput";
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);
+ }
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [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);
@@ -220,8 +237,9 @@ function PlaceholderType(props) {
let updateSelectedCheckbox = [],
checkedList;
let isDefaultValue, isDefaultEmpty;
- if (props.pos?.type && ["checkbox", "radio"].includes(props.pos.type)) {
- updateSelectedCheckbox = selectedCheckbox;
+ if (props.pos?.type === "checkbox") {
+ updateSelectedCheckbox = selectedCheckbox ? selectedCheckbox : [];
+
if (isChecked) {
updateSelectedCheckbox.push(ind);
setSelectedCheckbox(updateSelectedCheckbox);
@@ -244,8 +262,6 @@ function PlaceholderType(props) {
props.data && props.data.Id,
false,
null,
- null,
- null,
isDefaultEmpty
);
}
@@ -253,7 +269,9 @@ function PlaceholderType(props) {
//function to handle select radio widget and set value seletced by user
const handleCheckRadio = (isChecked, data) => {
- let isDefaultValue, isDefaultEmpty;
+ let isDefaultValue,
+ isDefaultEmpty,
+ isRadio = true;
if (props.isNeedSign) {
isDefaultValue = props.pos.options?.defaultValue;
}
@@ -266,7 +284,7 @@ function PlaceholderType(props) {
setTextValue("");
}
onChangeInput(
- textValue,
+ data,
props.pos.key,
props.xyPostion,
props.index,
@@ -274,9 +292,8 @@ function PlaceholderType(props) {
props.data && props.data.Id,
false,
null,
- null,
- null,
- isDefaultEmpty
+ isDefaultEmpty,
+ isRadio
);
};
switch (props.pos.type) {
@@ -339,22 +356,28 @@ function PlaceholderType(props) {
onBlur={handleInputBlur}
disabled={
props.isNeedSign &&
- props.pos.options?.isReadOnly &&
- props.pos.options?.isReadOnly
+ (props.pos.options?.isReadOnly ||
+ props.data?.signerObjId !== props.signerObjId)
}
type="checkbox"
checked={selectCheckbox(ind)}
onChange={(e) => {
- if (e.target.checked && !props.isPlaceholder) {
- const maxRequired =
- props.pos.options?.validation?.maxRequiredCount;
- const maxCountInt = maxRequired && parseInt(maxRequired);
- if (maxCountInt > 0) {
- if (selectedCheckbox.length <= maxCountInt - 1) {
+ if (e.target.checked) {
+ if (!props.isPlaceholder) {
+ const maxRequired =
+ props.pos.options?.validation?.maxRequiredCount;
+ const maxCountInt = maxRequired && parseInt(maxRequired);
+
+ if (maxCountInt > 0) {
+ if (
+ selectedCheckbox &&
+ selectedCheckbox?.length <= maxCountInt - 1
+ ) {
+ handleCheckboxValue(e.target.checked, ind);
+ }
+ } else {
handleCheckboxValue(e.target.checked, ind);
}
- } else {
- handleCheckboxValue(e.target.checked, ind);
}
} else {
handleCheckboxValue(e.target.checked, ind);
@@ -597,7 +620,7 @@ function PlaceholderType(props) {
? props.selectDate?.format
: props.pos?.options?.validation?.format
? props.pos?.options?.validation?.format
- : "dd MMMM, YYYY"
+ : "MM/dd/YYYY"
}
/>
@@ -674,12 +697,10 @@ function PlaceholderType(props) {
type="radio"
disabled={
props.isNeedSign &&
- props.pos.options?.isReadOnly &&
- props.pos.options?.isReadOnly
+ (props.pos.options?.isReadOnly ||
+ props.data?.signerObjId !== props.signerObjId)
}
- // disabled={props.isPlaceholder}
checked={handleRadioCheck(data)}
- // checked={isCheckedRadio.isChecked}
onChange={(e) => {
if (!props.isPlaceholder) {
handleCheckRadio(e.target.checked, data);
@@ -706,6 +727,7 @@ function PlaceholderType(props) {
);
}}
className="labelTextArea"
+ style={{ whiteSpace: "pre-wrap" }}
cols="50"
/>
);
diff --git a/apps/OpenSign/src/components/pdf/RenderPdf.js b/apps/OpenSign/src/components/pdf/RenderPdf.js
index 7d89ab006..af72c3729 100644
--- a/apps/OpenSign/src/components/pdf/RenderPdf.js
+++ b/apps/OpenSign/src/components/pdf/RenderPdf.js
@@ -441,6 +441,7 @@ function RenderPdf({
selectWidgetId={selectWidgetId}
handleUserName={handleUserName}
setIsCheckbox={setIsCheckbox}
+ setValidateAlert={setValidateAlert}
setCurrWidgetsDetails={setCurrWidgetsDetails}
/>
)
@@ -624,6 +625,7 @@ function RenderPdf({
selectWidgetId={selectWidgetId}
handleUserName={handleUserName}
setIsCheckbox={setIsCheckbox}
+ setValidateAlert={setValidateAlert}
setCurrWidgetsDetails={
setCurrWidgetsDetails
}
diff --git a/apps/OpenSign/src/components/pdf/SignPad.js b/apps/OpenSign/src/components/pdf/SignPad.js
index b709ec88f..6557ecd7e 100644
--- a/apps/OpenSign/src/components/pdf/SignPad.js
+++ b/apps/OpenSign/src/components/pdf/SignPad.js
@@ -281,7 +281,6 @@ function SignPad({
}}
style={{
color: isTab === "draw" ? themeColor : "#515252",
-
marginLeft: "2px"
}}
className="signTab"
@@ -332,7 +331,6 @@ function SignPad({
}}
style={{
color: isTab === "type" ? themeColor : "#515252",
-
marginLeft: "2px"
}}
className="signTab"
diff --git a/apps/OpenSign/src/components/pdf/Signedby.js b/apps/OpenSign/src/components/pdf/Signedby.js
index 5f8b907a0..4728e095b 100644
--- a/apps/OpenSign/src/components/pdf/Signedby.js
+++ b/apps/OpenSign/src/components/pdf/Signedby.js
@@ -24,7 +24,6 @@ function Signedby({ pdfDetails }) {
display: "flex",
flexDirection: "row",
padding: "10px",
-
background: "#93a3db"
}}
>
@@ -49,7 +48,6 @@ function Signedby({ pdfDetails }) {
fontWeight: "bold"
}}
>
- {" "}
{getFirstLetter(pdfDetails.ExtUserPtr.Name)}
diff --git a/apps/OpenSign/src/components/pdf/WidgetNameModal.js b/apps/OpenSign/src/components/pdf/WidgetNameModal.js
index 340ec18ca..3d0ae2f01 100644
--- a/apps/OpenSign/src/components/pdf/WidgetNameModal.js
+++ b/apps/OpenSign/src/components/pdf/WidgetNameModal.js
@@ -13,7 +13,7 @@ const WidgetNameModal = (props) => {
});
const [isValid, setIsValid] = useState(true);
const statusArr = ["Required", "Optional"];
- const inputOpt = ["email", "number", "text"];
+ const inputOpt = ["email", "number"];
useEffect(() => {
if (props.defaultdata) {
@@ -144,7 +144,7 @@ const WidgetNameModal = (props) => {
placeholder="Enter custom expression"
value={formdata.textvalidate}
onChange={(e) => handleChange(e)}
- onBlur={() => handleBlurRegex()}
+ // onBlur={() => handleBlurRegex()}
/>