From c1be197346c276b76cb483037f05ace01f326129 Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs Date: Wed, 19 Feb 2025 19:22:54 +0000 Subject: [PATCH] Merge pull request #316 from OpenSignLabs/fix_emailresetdate fix: Adapter prototype don't match expected prototype --- .../public/locales/de/translation.json | 3 +- .../public/locales/en/translation.json | 3 +- .../public/locales/es/translation.json | 3 +- .../public/locales/fr/translation.json | 4 +- .../public/locales/it/translation.json | 3 +- .../src/components/pdf/AgreementSign.js | 3 + .../src/components/pdf/Placeholder.js | 450 ++++++++++-------- .../src/components/pdf/PlaceholderType.js | 13 +- .../src/components/pdf/TextFontSetting.js | 64 +-- .../src/components/pdf/WidgetNameModal.js | 40 +- apps/OpenSign/src/pages/Form.js | 5 - apps/OpenSign/src/pages/PdfRequestFiles.js | 59 +-- apps/OpenSign/src/pages/PlaceHolderSign.js | 18 +- .../OpenSign/src/pages/TemplatePlaceholder.js | 302 +++++++++--- apps/OpenSignServer/Utils.js | 15 +- apps/OpenSignServer/index.js | 2 + 16 files changed, 602 insertions(+), 385 deletions(-) diff --git a/apps/OpenSign/public/locales/de/translation.json b/apps/OpenSign/public/locales/de/translation.json index aa051eb6d..6239ac2fc 100644 --- a/apps/OpenSign/public/locales/de/translation.json +++ b/apps/OpenSign/public/locales/de/translation.json @@ -833,5 +833,6 @@ "variables-use": "Zu verwendende Variablen", "send-to-sign": "hat Sie gebeten zu unterschreiben", "use-template": "Vorlage verwenden", - "contact-already-exists": "Der Kontakt existiert bereits." + "contact-already-exists": "Der Kontakt existiert bereits.", + "agreement-note": "Hinweis: Durch Ihre Zustimmung unterzeichnen Sie das Dokument nicht sofort. Sie können das Dokument nur elektronisch einsehen. Sie haben die Möglichkeit, es vollständig zu lesen und anschließend zu entscheiden, ob Sie es unterzeichnen möchten." } diff --git a/apps/OpenSign/public/locales/en/translation.json b/apps/OpenSign/public/locales/en/translation.json index af5cf83c1..f134ba812 100644 --- a/apps/OpenSign/public/locales/en/translation.json +++ b/apps/OpenSign/public/locales/en/translation.json @@ -834,5 +834,6 @@ "variables-use": "Variables to use", "send-to-sign": "has requested you to sign", "use-template": "Use Template", - "contact-already-exists": "contact already exists." + "contact-already-exists": "contact already exists.", + "agreement-note": "Note: Agreeing to this does not mean you are signing the document immediately. This only allows you to review the document electronically. You will have the opportunity to read it in full and decide whether to sign it afterward." } diff --git a/apps/OpenSign/public/locales/es/translation.json b/apps/OpenSign/public/locales/es/translation.json index 6a5618946..c5a99c95e 100644 --- a/apps/OpenSign/public/locales/es/translation.json +++ b/apps/OpenSign/public/locales/es/translation.json @@ -834,5 +834,6 @@ "variables-use": "Variables para usar", "send-to-sign": "le ha solicitado que firme", "use-template": "Usar plantilla", - "contact-already-exists": "El contacto ya existe." + "contact-already-exists": "El contacto ya existe.", + "agreement-note": "Nota: Aceptar esto no significa que esté firmando el documento de inmediato. Esto solo le permite revisar el documento electrónicamente. Tendrá la oportunidad de leerlo en su totalidad y decidir si desea firmarlo después." } diff --git a/apps/OpenSign/public/locales/fr/translation.json b/apps/OpenSign/public/locales/fr/translation.json index cc8789a2a..a2b26b899 100644 --- a/apps/OpenSign/public/locales/fr/translation.json +++ b/apps/OpenSign/public/locales/fr/translation.json @@ -833,5 +833,7 @@ "variables-use": "Variables à utiliser", "send-to-sign": "vous a demandé de signer", "use-template": "Utiliser le modèle", - "contact-already-exists": "Le contact existe déjà." + "contact-already-exists": "Le contact existe déjà.", + "agreement-note": "Remarque : Accepter cela ne signifie pas que vous signez immédiatement le document. Cela vous permet uniquement de consulter le document électroniquement. Vous aurez l'opportunité de le lire entièrement et de décider ensuite si vous souhaitez le signer." + } diff --git a/apps/OpenSign/public/locales/it/translation.json b/apps/OpenSign/public/locales/it/translation.json index 5ce99f02a..5a54adb38 100644 --- a/apps/OpenSign/public/locales/it/translation.json +++ b/apps/OpenSign/public/locales/it/translation.json @@ -833,5 +833,6 @@ "variables-use": "Variabili da utilizzare", "send-to-sign": "ha richiesto la tua firma", "use-template": "Usa modello", - "contact-already-exists": "Il contatto esiste già." + "contact-already-exists": "Il contatto esiste già.", + "agreement-note": "Nota: Accettare questo non significa che stai firmando immediatamente il documento. Questo ti consente solo di esaminare il documento elettronicamente. Avrai l'opportunità di leggerlo per intero e decidere successivamente se firmarlo." } diff --git a/apps/OpenSign/src/components/pdf/AgreementSign.js b/apps/OpenSign/src/components/pdf/AgreementSign.js index 36f9715c9..31e70c0fa 100644 --- a/apps/OpenSign/src/components/pdf/AgreementSign.js +++ b/apps/OpenSign/src/components/pdf/AgreementSign.js @@ -54,6 +54,9 @@ function AgreementSign(props) { {t("agrre-button")} +
+ {t("agreement-note")} +
{isShowAgreeTerms && ( diff --git a/apps/OpenSign/src/components/pdf/Placeholder.js b/apps/OpenSign/src/components/pdf/Placeholder.js index 5e800a330..a8da8d33b 100644 --- a/apps/OpenSign/src/components/pdf/Placeholder.js +++ b/apps/OpenSign/src/components/pdf/Placeholder.js @@ -125,10 +125,7 @@ function Placeholder(props) { const [clickonWidget, setClickonWidget] = useState({}); const [startDate, setStartDate] = useState( props.pos.type === "date" && - getDefaultdate( - props?.pos?.options?.response, - props.pos?.options?.validation?.format - ) + getDefaultdate(new Date(), props.pos?.options?.validation?.format) ); const [getCheckboxRenderWidth, setGetCheckboxRenderWidth] = useState({ width: null, @@ -785,7 +782,8 @@ function Placeholder(props) { //enable dragging functionality only if isAlllowModify true on tab that widget and hold 1sec if ( props.isAlllowModify && - props?.assignedWidgetId.includes(props.pos.key) + props?.assignedWidgetId.includes(props.pos.key) && + props.data?.signerObjId === props.signerObjId ) { //if 'isTouchDevice' then handle dragging functionality conditionaly if (isTouchDevice) { @@ -797,7 +795,8 @@ function Placeholder(props) { } else if ( //condition when 'isAlllowModify' is true and user add new widgets then handle dragging functionality like signyourself flow props.isAlllowModify && - !props?.assignedWidgetId.includes(props.pos.key) + !props?.assignedWidgetId.includes(props.pos.key) && + props.data?.signerObjId === props.signerObjId ) { return !isDraggingEnabled; } else { @@ -808,8 +807,10 @@ function Placeholder(props) { else if (props.isPlaceholder && ![textWidget].includes(props.pos.type)) { return false; } //dragging depend on 'isDraggingEnabled' variable in self sign and signyourself flow - else { + else if (isTouchDevice) { return !isDraggingEnabled; + } else { + return false; } }; //function to handle widget background color @@ -868,183 +869,93 @@ function Placeholder(props) { } }, 1000); // Hold for 1 second before vibrating }; + const fontSize = calculateFont(props.pos.options?.fontSize); + const fontColor = props.pos.options?.fontColor || "black"; return ( <> - { - setDraggingEnabled(true); - props.handleTabDrag && props.handleTabDrag(props.pos.key); - }} - size={{ - width: - props.pos.type === radioButtonWidget || - props.pos.type === "checkbox" - ? "auto" - : props.posWidth(props.pos, props.isSignYourself), - height: - props.pos.type === radioButtonWidget || - props.pos.type === "checkbox" - ? "auto" - : props.posHeight(props.pos, props.isSignYourself) - }} - minHeight={calculateFont(props.pos.options?.fontSize, true)} - maxHeight="auto" - onResizeStart={() => { - setDraggingEnabled(true); - props.setIsResize && props.setIsResize(true); - }} - onResizeStop={(e, direction, ref) => { - setTimeout(() => { - props.setIsResize && props.setIsResize(false); - }, 50); - props.handleSignYourselfImageResize && - props.handleSignYourselfImageResize( - ref, - props.pos.key, - props.xyPosition, - props.setXyPosition, - props.index, - containerScale, - props.scale, - props.data && props.data.Id, - props.isResize - ); - }} - disableDragging={handleDragging()} - onDragStop={(event, dragElement) => { - setIsDisableDragging(true); - props.handleStop && - props.handleStop( - event, - dragElement, - props.data?.Id, - props.pos?.key - ); - }} - position={{ - x: xPos(props.pos, props.isSignYourself), - y: yPos(props.pos, props.isSignYourself) - }} - onResize={(e, direction, ref) => { - setPlaceholderBorder({ - w: ref.offsetWidth / (props.scale * containerScale), - h: ref.offsetHeight / (props.scale * containerScale) - }); - }} - // onClick={() => - // !props.isResize && !isMobile && handleOnClickPlaceholder() - // } - > - {props.pos.key === props.selectWidgetId && - ((props.isShowBorder && - ![radioButtonWidget, "checkbox"].includes(props.pos.type)) || - (props?.isAlllowModify && - !props?.assignedWidgetId.includes(props.pos.key))) ? ( - - ) : props.data && props.isNeedSign && props.pos.type !== "checkbox" ? ( - props.data?.signerObjId === props.signerObjId && - ![radioButtonWidget, "checkbox"].includes(props.pos.type) ? ( - - ) : ( - <> - ) - ) : ( - ![radioButtonWidget, "checkbox"].includes(props.pos.type) && - props.pos.key === props.selectWidgetId && - )} - - {/* 1- Show a border if props.pos.key === props.selectWidgetId, indicating the current user's selected widget. - 2- If props.isShowBorder is true, display borders for all widgets. - 3- Use the combination of props?.isAlllowModify and !props?.assignedWidgetId.includes(props.pos.key) to determine when to show borders: - 1- When isAlllowModify is true, show borders. - 2- Do not display border for widgets already assigned (props.assignedWidgetId.includes(props.pos.key) is true). - */} - {props.pos.key === props.selectWidgetId && - (props.isShowBorder || - !isDisableDragging || - (props?.isAlllowModify && - !props?.assignedWidgetId.includes(props.pos.key))) && ( - - )} -
{ + props.setSelectWidgetId && props.setSelectWidgetId(props.pos.key); + }} style={{ + fontFamily: "Arial, sans-serif", + position: "absolute", left: xPos(props.pos, props.isSignYourself), top: yPos(props.pos, props.isSignYourself), + fontSize: fontSize, + color: fontColor, + zIndex: 99 + }} + > + {props.pos?.options?.response} + + ) : ( + { + setDraggingEnabled(true); + props.handleTabDrag && props.handleTabDrag(props.pos.key); + }} + size={{ width: props.pos.type === radioButtonWidget || props.pos.type === "checkbox" @@ -1054,40 +965,157 @@ function Placeholder(props) { props.pos.type === radioButtonWidget || props.pos.type === "checkbox" ? "auto" - : props.posHeight(props.pos, props.isSignYourself), - zIndex: "10" + : props.posHeight(props.pos, props.isSignYourself) + }} + minHeight={calculateFont(props.pos.options?.fontSize, true)} + maxHeight="auto" + onResizeStart={() => { + setDraggingEnabled(true); + props.setIsResize && props.setIsResize(true); + }} + onResizeStop={(e, direction, ref) => { + setTimeout(() => { + props.setIsResize && props.setIsResize(false); + }, 50); + props.handleSignYourselfImageResize && + props.handleSignYourselfImageResize( + ref, + props.pos.key, + props.xyPosition, + props.setXyPosition, + props.index, + containerScale, + props.scale, + props.data && props.data.Id, + props.isResize + ); }} - onTouchEnd={() => handleTouchEnd()} - onClick={() => handleOnClickPlaceholder()} - onTouchStart={() => handleTouchStart()} + disableDragging={handleDragging()} + onDragStop={(event, dragElement) => { + setIsDisableDragging(true); + props.handleStop && + props.handleStop( + event, + dragElement, + props.data?.Id, + props.pos?.key + ); + }} + position={{ + x: xPos(props.pos, props.isSignYourself), + y: yPos(props.pos, props.isSignYourself) + }} + onResize={(e, direction, ref) => { + setPlaceholderBorder({ + w: ref.offsetWidth / (props.scale * containerScale), + h: ref.offsetHeight / (props.scale * containerScale) + }); + }} + // onClick={() => + // !props.isResize && !isMobile && handleOnClickPlaceholder() + // } > - {props.pos.key === props.selectWidgetId && } - -
-
+ {props.pos.key === props.selectWidgetId && + ((props.isShowBorder && + ![radioButtonWidget, "checkbox"].includes(props.pos.type)) || + (props?.isAlllowModify && + !props?.assignedWidgetId.includes(props.pos.key))) ? ( + + ) : props.data && + props.isNeedSign && + props.pos.type !== "checkbox" ? ( + props.data?.signerObjId === props.signerObjId && + ![radioButtonWidget, "checkbox"].includes(props.pos.type) ? ( + + ) : ( + <> + ) + ) : ( + ![radioButtonWidget, "checkbox"].includes(props.pos.type) && + props.pos.key === props.selectWidgetId && + )} + + {/* 1- Show a border if props.pos.key === props.selectWidgetId, indicating the current user's selected widget. + 2- If props.isShowBorder is true, display borders for all widgets. + 3- Use the combination of props?.isAlllowModify and !props?.assignedWidgetId.includes(props.pos.key) to determine when to show borders: + 1- When isAlllowModify is true, show borders. + 2- Do not display border for widgets already assigned (props.assignedWidgetId.includes(props.pos.key) is true). + */} + {props.pos.key === props.selectWidgetId && + (props.isShowBorder || + !isDisableDragging || + (props?.isAlllowModify && + !props?.assignedWidgetId.includes(props.pos.key))) && ( + + )} +
handleTouchEnd()} + onClick={() => handleOnClickPlaceholder()} + onTouchStart={() => handleTouchStart()} + > + {props.pos.key === props.selectWidgetId && } + +
+ + )} +
diff --git a/apps/OpenSign/src/components/pdf/PlaceholderType.js b/apps/OpenSign/src/components/pdf/PlaceholderType.js index cacec7a61..788c17d52 100644 --- a/apps/OpenSign/src/components/pdf/PlaceholderType.js +++ b/apps/OpenSign/src/components/pdf/PlaceholderType.js @@ -513,10 +513,14 @@ function PlaceholderType(props) { })} ) : ( -
+
{props.pos?.options?.name ? props.pos.options.name : widgetTypeTraslation} +
); case "initials": @@ -672,12 +676,7 @@ function PlaceholderType(props) { onBlur={handleInputBlur} closeOnScroll={true} className={`${selectWidgetCls} outline-[#007bff]`} - selected={ - props?.startDate - ? props?.startDate - : props.pos.options?.response && - new Date(props.pos.options.response) - } + selected={props?.startDate} onChange={(date) => handleOnDateChange(date)} popperPlacement="top-end" customInput={} diff --git a/apps/OpenSign/src/components/pdf/TextFontSetting.js b/apps/OpenSign/src/components/pdf/TextFontSetting.js index 23ed8dc64..d13a95c23 100644 --- a/apps/OpenSign/src/components/pdf/TextFontSetting.js +++ b/apps/OpenSign/src/components/pdf/TextFontSetting.js @@ -14,53 +14,53 @@ function TextFontSetting(props) { handleClose={() => props.setIsTextSetting(false)} >
-
- {t("font-size")} : - props.setFontSize(parseInt(e.target.value))} + > + {fontsizeArr.map((size, ind) => ( + - ); - })} - -
- {t("color")}: + ))} + +
+ {/* Font Color Selector */} +
+ {t("color")}: + {/* Color Preview Box */}
diff --git a/apps/OpenSign/src/components/pdf/WidgetNameModal.js b/apps/OpenSign/src/components/pdf/WidgetNameModal.js index 96bdf0dda..eed114125 100644 --- a/apps/OpenSign/src/components/pdf/WidgetNameModal.js +++ b/apps/OpenSign/src/components/pdf/WidgetNameModal.js @@ -293,24 +293,26 @@ const WidgetNameModal = (props) => { "job title", "email" ].includes(props.defaultdata?.type) && ( -
- {t("font-size")}: - -
+
+
+ {t("font-size")}: + +
+
{t("color")}: