mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-17 21:25:54 +02:00
fix: checkbox optional type issue
This commit is contained in:
@@ -314,16 +314,26 @@ function PdfRequestFiles() {
|
||||
|
||||
if (checkboxExist) {
|
||||
isReadOnly = checkUser[0].placeHolder[i].pos.filter(
|
||||
(position) => !position.options.isReadOnly
|
||||
(position) => !position.options?.isReadOnly
|
||||
);
|
||||
|
||||
if (isReadOnly && isReadOnly.length > 0) {
|
||||
for (let i = 0; i < isReadOnly.length; i++) {
|
||||
const minCount =
|
||||
isReadOnly[i].options.validation?.minRequiredCount;
|
||||
isReadOnly[i].options?.validation?.minRequiredCount;
|
||||
const maxCount =
|
||||
isReadOnly[i].options?.validation?.maxRequiredCount;
|
||||
const response = isReadOnly[i].options?.response?.length;
|
||||
const defaultValue = isReadOnly[i].options?.defaultValue?.length;
|
||||
if (!response) {
|
||||
if (minCount === 0 && maxCount === 0) {
|
||||
if (!minCountAlert) {
|
||||
minCountAlert = false;
|
||||
}
|
||||
} else if (minCount === 0 && maxCount > 0) {
|
||||
if (!minCountAlert) {
|
||||
minCountAlert = false;
|
||||
}
|
||||
} else if (!response) {
|
||||
if (!defaultValue) {
|
||||
if (!minCountAlert) {
|
||||
minCountAlert = true;
|
||||
@@ -346,6 +356,7 @@ function PdfRequestFiles() {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (checkboxExist && isReadOnly && minCountAlert) {
|
||||
setUnSignedWidgetId(checkboxKey);
|
||||
setWidgetsTour(true);
|
||||
@@ -382,34 +393,34 @@ function PdfRequestFiles() {
|
||||
);
|
||||
|
||||
//function for call to embed signature in pdf and get digital signature pdf
|
||||
try {
|
||||
const res = await signPdfFun(
|
||||
pdfBytes,
|
||||
documentId,
|
||||
signerObjectId,
|
||||
pdfOriginalWidth,
|
||||
pngUrl,
|
||||
containerWH,
|
||||
setIsAlert
|
||||
);
|
||||
if (res && res.status === "success") {
|
||||
setPdfUrl(res.data);
|
||||
setIsSigned(true);
|
||||
setSignedSigners([]);
|
||||
setUnSignedSigners([]);
|
||||
getDocumentDetails();
|
||||
} else {
|
||||
setIsAlert({
|
||||
isShow: true,
|
||||
alertMessage: "something went wrong"
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
setIsAlert({
|
||||
isShow: true,
|
||||
alertMessage: "something went wrong"
|
||||
});
|
||||
}
|
||||
// try {
|
||||
// const res = await signPdfFun(
|
||||
// pdfBytes,
|
||||
// documentId,
|
||||
// signerObjectId,
|
||||
// pdfOriginalWidth,
|
||||
// pngUrl,
|
||||
// containerWH,
|
||||
// setIsAlert
|
||||
// );
|
||||
// if (res && res.status === "success") {
|
||||
// setPdfUrl(res.data);
|
||||
// setIsSigned(true);
|
||||
// setSignedSigners([]);
|
||||
// setUnSignedSigners([]);
|
||||
// getDocumentDetails();
|
||||
// } else {
|
||||
// setIsAlert({
|
||||
// isShow: true,
|
||||
// alertMessage: "something went wrong"
|
||||
// });
|
||||
// }
|
||||
// } catch (err) {
|
||||
// setIsAlert({
|
||||
// isShow: true,
|
||||
// alertMessage: "something went wrong"
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
setIsSignPad(false);
|
||||
|
||||
@@ -24,7 +24,6 @@ function PlaceholderType(props) {
|
||||
if (props.pos?.options.validation.type === "regex") {
|
||||
regexObject = RegexParser(regexValidation);
|
||||
}
|
||||
|
||||
// new RegExp(regexValidation);
|
||||
let isValidate = regexObject.test(textValue);
|
||||
if (!isValidate) {
|
||||
@@ -62,6 +61,7 @@ function PlaceholderType(props) {
|
||||
const handleTextValid = (e, regx) => {
|
||||
const textInput = e.target.value;
|
||||
setTextValue(textInput);
|
||||
|
||||
// console.log('textInput',textInput)
|
||||
// let isValidate = regx.test(textValue);
|
||||
// console.log('isValidate',isValidate,regx)
|
||||
|
||||
@@ -22,7 +22,7 @@ const EditTemplate = ({ template, onSuccess }) => {
|
||||
const handleSubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const data = {...formData }
|
||||
const data = { ...formData };
|
||||
onSuccess(data);
|
||||
};
|
||||
|
||||
@@ -43,7 +43,7 @@ const EditTemplate = ({ template, onSuccess }) => {
|
||||
fontWeight: "700"
|
||||
}}
|
||||
>
|
||||
{template.URL?.split("/")[3]?.split("_")[1]}
|
||||
{template.URL?.split("/")?.pop()?.split("_")[1]}
|
||||
</div>
|
||||
</div>
|
||||
<div className="form-section">
|
||||
|
||||
@@ -216,22 +216,25 @@ function RenderPdf({
|
||||
if (data.signerObjId === signerObjectId) {
|
||||
setCurrentSigner(true);
|
||||
}
|
||||
const handleAllUserName = () => {
|
||||
pdfDetails[0].Signers.map((signerData, key) => {
|
||||
const handleAllUserName = (Id, Role, type) => {
|
||||
return pdfDetails[0].Signers.map((signerData, key) => {
|
||||
return (
|
||||
signerData.objectId === data.signerObjId && (
|
||||
<div
|
||||
key={key}
|
||||
style={{
|
||||
fontSize: "12px",
|
||||
color: "black",
|
||||
fontWeight: "600",
|
||||
|
||||
marginTop: "0px"
|
||||
}}
|
||||
>
|
||||
{signerData.Name}
|
||||
</div>
|
||||
<React.Fragment key={key}>
|
||||
{signerData?.Name && (
|
||||
<div style={{ color: "black", fontSize: 8, fontWeight: "500" }}>
|
||||
{signerData.Name}
|
||||
</div>
|
||||
)}
|
||||
{type && (
|
||||
<div style={{ fontWeight: "700", fontSize: 11 }}>{type}</div>
|
||||
)}
|
||||
{Role && (
|
||||
<div style={{ color: "black", fontSize: 8, fontWeight: "500" }}>
|
||||
{`(${Role})`}
|
||||
</div>
|
||||
)}
|
||||
</React.Fragment>
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
@@ -308,7 +308,7 @@ export const addWidgetOptions = (type) => {
|
||||
case "checkbox":
|
||||
return defaultOpt;
|
||||
case "text":
|
||||
return defaultOpt;
|
||||
return { ...defaultOpt, validation: { type: "text", pattern: "" } };
|
||||
case "initials":
|
||||
return defaultOpt;
|
||||
case "name":
|
||||
@@ -326,7 +326,7 @@ export const addWidgetOptions = (type) => {
|
||||
case "dropdown":
|
||||
return defaultOpt;
|
||||
case "radio":
|
||||
return defaultOpt;
|
||||
return { ...defaultOpt, values: [] };
|
||||
case "label":
|
||||
return defaultOpt;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user