Merge pull request #1719 from OpenSignLabs/updates-14856876951

v2.20.1
This commit is contained in:
prafull-opensignlabs
2025-05-06 15:35:42 +05:30
committed by GitHub
3 changed files with 62 additions and 30 deletions
@@ -3,6 +3,7 @@ import BorderResize from "./BorderResize";
import PlaceholderBorder from "./PlaceholderBorder";
import { Rnd } from "react-rnd";
import {
changeDateToMomentFormat,
defaultWidthHeight,
fontColorArr,
fontsizeArr,
@@ -52,32 +53,6 @@ const selectFormat = (data) => {
}
};
const changeDateToMomentFormat = (format) => {
switch (format) {
case "MM/dd/yyyy":
return "L";
case "dd-MM-yyyy":
return "DD-MM-YYYY";
case "dd/MM/yyyy":
return "DD/MM/YYYY";
case "MMMM dd, yyyy":
return "LL";
case "dd MMM, yyyy":
return "DD MMM, YYYY";
case "yyyy-MM-dd":
return "YYYY-MM-DD";
case "MM-dd-yyyy":
return "MM-DD-YYYY";
case "MM.dd.yyyy":
return "MM.DD.YYYY";
case "MMM dd, yyyy":
return "MMM DD, YYYY";
case "dd MMMM, yyyy":
return "DD MMMM, YYYY";
default:
return "L";
}
};
//function to get default format
const getDefaultFormat = (dateFormat) => dateFormat || "MM/dd/yyyy";
+56
View File
@@ -272,6 +272,32 @@ export const selectFormat = (data) => {
}
};
export const changeDateToMomentFormat = (format) => {
switch (format) {
case "MM/dd/yyyy":
return "L";
case "dd-MM-yyyy":
return "DD-MM-YYYY";
case "dd/MM/yyyy":
return "DD/MM/YYYY";
case "MMMM dd, yyyy":
return "LL";
case "dd MMM, yyyy":
return "DD MMM, YYYY";
case "yyyy-MM-dd":
return "YYYY-MM-DD";
case "MM-dd-yyyy":
return "MM-DD-YYYY";
case "MM.dd.yyyy":
return "MM.DD.YYYY";
case "MMM dd, yyyy":
return "MMM DD, YYYY";
case "dd MMMM, yyyy":
return "DD MMMM, YYYY";
default:
return "L";
}
};
export const addWidgetOptions = (type, signer) => {
const defaultOpt = { name: type, status: "required" };
switch (type) {
@@ -3000,3 +3026,33 @@ export function formatDateTime(date, dateFormat, timeZone, is12Hour) {
)
: formatTimeInTimezone(date, timeZone);
}
export const updateDateWidgetsRes = (placeHolders, signerId) => {
return placeHolders?.map((item) => {
if (item?.signerObjId === signerId) {
return {
...item,
placeHolder: item.placeHolder.map((ph) => ({
...ph,
pos: ph.pos.map((widget) => {
// only for date widgets *and* missing response
if (widget.type === "date" && !widget.options.response) {
return {
...widget,
options: {
...widget.options,
response: getDate(
changeDateToMomentFormat(widget.options.validation.format)
)
}
};
}
return widget;
})
}))
};
} else {
return item;
}
});
};
+5 -4
View File
@@ -41,7 +41,8 @@ import {
addWidgetOptions,
textWidget,
compressedFileSize,
mailTemplate
mailTemplate,
updateDateWidgetsRes
} from "../constant/Utils";
import Header from "../components/pdf/PdfHeader";
import RenderPdf from "../components/pdf/RenderPdf";
@@ -403,7 +404,6 @@ function PdfRequestFiles() {
//condition to check already signed document by someone
if (audittrailData && audittrailData.length > 0) {
setIsDocId(true);
for (const item of placeholdersOrSigners) {
const checkEmail = item?.email;
//if email exist then compare user signed by using email else signers objectId
@@ -429,13 +429,14 @@ function PdfRequestFiles() {
}
setSignedSigners(signers);
setUnSignedSigners(unSignedSigner);
setSignerPos(documentData[0].Placeholders);
} else {
//else condition is show there are no details in audit trail then direct push all signers details
//in unsignedsigners array
setUnSignedSigners(placeholdersOrSigners);
setSignerPos(documentData[0].Placeholders);
}
setSignerPos(
updateDateWidgetsRes(documentData[0].Placeholders, currUserId)
);
setPdfDetails(documentData);
//checking if condition current user already sign or owner does not exist as a signer or document has been declined by someone or document has been expired
//then stop to display tour message