Skip to content

🔥 The free & Open Source DocuSign alternative

v2.20.1

prafull-opensignlabs5819103f57f8
diff --git a/apps/OpenSign/src/components/pdf/Placeholder.js b/apps/OpenSign/src/components/pdf/Placeholder.js
index b7fdc9667..2b68eb3e1 100644
--- a/apps/OpenSign/src/components/pdf/Placeholder.js
+++ b/apps/OpenSign/src/components/pdf/Placeholder.js
@@ -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";
diff --git a/apps/OpenSign/src/constant/Utils.js b/apps/OpenSign/src/constant/Utils.js
index 2bbd854d7..8a356ff29 100644
--- a/apps/OpenSign/src/constant/Utils.js
+++ b/apps/OpenSign/src/constant/Utils.js
@@ -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;
+ }
+ });
+};
diff --git a/apps/OpenSign/src/pages/PdfRequestFiles.js b/apps/OpenSign/src/pages/PdfRequestFiles.js
index 4e34197a2..eef566510 100644
--- a/apps/OpenSign/src/pages/PdfRequestFiles.js
+++ b/apps/OpenSign/src/pages/PdfRequestFiles.js
@@ -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