From db1fb1c0e1103b6d4021d74163aa9c576dd9326b Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs Date: Thu, 7 Nov 2024 18:56:42 +0530 Subject: [PATCH] fix: issue of signature types --- .../public/locales/en/translation.json | 12 ++++- .../public/locales/es/translation.json | 12 ++++- .../public/locales/fr/translation.json | 12 ++++- .../src/components/pdf/DefaultSignature.js | 12 ++--- .../src/components/pdf/WidgetNameModal.js | 2 +- apps/OpenSign/src/pages/DraftTemplate.js | 18 ++++--- apps/OpenSign/src/pages/PlaceHolderSign.js | 27 +++++++--- apps/OpenSign/src/pages/Preferences.js | 51 ++++++++++++++++--- .../OpenSign/src/pages/TemplatePlaceholder.js | 12 ++++- .../src/script/locales/en/translation.json | 12 ++++- .../src/script/locales/es/translation.json | 12 ++++- .../src/script/locales/fr/translation.json | 12 ++++- 12 files changed, 152 insertions(+), 42 deletions(-) diff --git a/apps/OpenSign/public/locales/en/translation.json b/apps/OpenSign/public/locales/en/translation.json index 16e7cc046..6fcffe921 100644 --- a/apps/OpenSign/public/locales/en/translation.json +++ b/apps/OpenSign/public/locales/en/translation.json @@ -446,7 +446,8 @@ "cutomize-email": "Cutomize Email", "upgrade-to-customize-email": "Upgrade to customize Email", "sign-url": "Sign url", - "Mails Sent": "Mails Sent", + "mails-sent": "Mails sent", + "mail-not-delivered": "Mail not delivered", "document-alert": "Document Alert", "owner-subscription-expired": "Owner's subscription has expired.", "subscription-expired": "Subscription Expired", @@ -687,5 +688,12 @@ "text-field-tour":"Fields of type 'Text' must be filled in advance before the document is sent. If you need the signers to provide input, use the 'Text Input' field instead.", "attach-signer-tour":"You need to attach a Signer to every role. You can do that by clicking this icon. Once you select a Signer it will be attached to all the fields associated with that role which appear in the same colour.", "allowed-signature-types": "Allowed signature types", - "at-least-one-signature-type": "At least one signature type should be enabled." + "at-least-one-signature-type": "At least one signature type should be enabled.", + "allowed-signature-types-help": { + "p1": "This signature preference controls which signing options are available to your signers. Only the signature types you select will appear in the signature widget when a document is signed. For example, if you choose only the 'Draw' option in preferences, your signer will see only the 'Draw' option in the signature widget, while the other three options will not be available.", + "l1": "Create a handwritten signature directly on the screen using your finger or a stylus.", + "l2": "Enter your name and choose from various font styles to create a signature.", + "l3": "Upload an existing digital version of your signature.", + "l4": "Use a pre-set signature style saved under 'My Signature' in your settings." + } } diff --git a/apps/OpenSign/public/locales/es/translation.json b/apps/OpenSign/public/locales/es/translation.json index 743baaddd..364165ef6 100644 --- a/apps/OpenSign/public/locales/es/translation.json +++ b/apps/OpenSign/public/locales/es/translation.json @@ -446,7 +446,8 @@ "cutomize-email": "Personalizar correo", "upgrade-to-customize-email": "Mejora para personalizar el correo", "sign-url": "URL de firma", - "Mails Sent": "Correos enviados", + "mails-sent": "Correos enviados", + "mail-not-delivered": "correo no entregado", "document-alert": "Alerta de documento", "owner-subscription-expired": "La suscripción del propietario ha expirado.", "subscription-expired": "Suscripción expirada", @@ -687,5 +688,12 @@ "text-field-tour":"Los campos de tipo 'Texto' deben completarse con anticipación antes de enviar el documento. Si necesita que los firmantes proporcionen información, utilice el campo 'Entrada de texto'", "attach-signer-tour" :"Debe adjuntar un firmante a cada función. Puede hacerlo haciendo clic en este icono. Una vez que seleccione un Firmante, se adjuntará a todos los campos asociados con ese rol que aparecen en el mismo color.", "allowed-signature-types": "Tipos de firma permitidos", - "at-least-one-signature-type": "Se debe habilitar al menos un tipo de firma." + "at-least-one-signature-type": "Se debe habilitar al menos un tipo de firma.", + "allowed-signature-types-help": { + "p1": "Esta preferencia de firma controla qué opciones de firma están disponibles para sus firmantes. Solo los tipos de firma que seleccione aparecerán en el widget de firma cuando se firme un documento. Por ejemplo, si elige sólo la opción 'Draw' en las preferencias, su firmante verá sólo la opción 'Draw' en el widget de firma, mientras que las otras tres opciones no estarán disponibles.", + "l1": "Cree una firma manuscrita directamente en la pantalla usando su dedo o un lápiz.", + "l2": "Ingrese su nombre y elija entre varios estilos de fuente para crear una firma.", + "l3": "Cargue una versión digital existente de su firma.", + "l4": "Utilice un estilo de firma preestablecido guardado en 'Mi firma' en su configuración." + } } diff --git a/apps/OpenSign/public/locales/fr/translation.json b/apps/OpenSign/public/locales/fr/translation.json index 5595b02d1..b51a9ab75 100644 --- a/apps/OpenSign/public/locales/fr/translation.json +++ b/apps/OpenSign/public/locales/fr/translation.json @@ -445,7 +445,8 @@ "cutomize-email": "Personnaliser l'e-mail", "upgrade-to-customize-email": "Mise à niveau pour personnaliser l'e-mail", "sign-url": "Signer l'URL", - "Mails Sent": "Mails envoyés avec succès !", + "mails-sent": "Mails envoyés avec succès !", + "mail-not-delivered": "Courrier non distribué", "document-alert": "Alerte document", "owner-subscription-expired": "L'abonnement du propriétaire a expiré.", "subscription-expired": "Abonnement expiré", @@ -686,5 +687,12 @@ "text-field-tour" :"Les champs de type 'Texte' doivent être remplis à l'avance avant l'envoi du document. Si vous avez besoin que les signataires fournissent des informations, utilisez plutôt le champ 'Saisie de texte'.", "attach-signer-tour" :"Vous devez associer un signataire à chaque rôle. Vous pouvez le faire en cliquant sur cette icône. Une fois que vous avez sélectionné un signataire, il sera attaché à tous les champs associés à ce rôle qui apparaissent dans la même couleur.", "allowed-signature-types": "Types de signature autorisés", - "at-least-one-signature-type": "Au moins un type de signature doit être activé." + "at-least-one-signature-type": "Au moins un type de signature doit être activé.", + "allowed-signature-types-help": { + "p1": "Cette préférence de signature contrôle les options de signature disponibles pour vos signataires. Seuls les types de signature que vous sélectionnez apparaîtront dans le widget de signature lorsqu'un document est signé. Par exemple, si vous choisissez uniquement l'option 'Draw' dans les préférences, votre signataire ne verra que l'option 'Draw' dans le widget de signature, tandis que les trois autres options ne seront pas disponibles.", + "l1": "Créez une signature manuscrite directement sur l'écran à l'aide de votre doigt ou d'un stylet.", + "l2": "Entrez votre nom et choisissez parmi différents styles de police pour créer une signature.", + "l3": "Téléchargez une version numérique existante de votre signature.", + "l4": "Utilisez un style de signature prédéfini enregistré sous 'Ma signature' ​​dans vos paramètres." + } } diff --git a/apps/OpenSign/src/components/pdf/DefaultSignature.js b/apps/OpenSign/src/components/pdf/DefaultSignature.js index 4184945d5..c941bcd38 100644 --- a/apps/OpenSign/src/components/pdf/DefaultSignature.js +++ b/apps/OpenSign/src/components/pdf/DefaultSignature.js @@ -22,11 +22,7 @@ function DefaultSignature(props) {
{t("signature")}
-
+

{t("Your-Signature")}

{!props.isDefault && ( -
- Document creator has disabled this option +
+ + Document creator has disabled this option +
)}
diff --git a/apps/OpenSign/src/components/pdf/WidgetNameModal.js b/apps/OpenSign/src/components/pdf/WidgetNameModal.js index 51e0a4bae..f64d7140f 100644 --- a/apps/OpenSign/src/components/pdf/WidgetNameModal.js +++ b/apps/OpenSign/src/components/pdf/WidgetNameModal.js @@ -304,7 +304,7 @@ const WidgetNameModal = (props) => { checked={type.enabled} />
{type.name} diff --git a/apps/OpenSign/src/pages/DraftTemplate.js b/apps/OpenSign/src/pages/DraftTemplate.js index 50481685b..7c704d81e 100644 --- a/apps/OpenSign/src/pages/DraftTemplate.js +++ b/apps/OpenSign/src/pages/DraftTemplate.js @@ -195,14 +195,9 @@ const DraftTemplate = () => { } //function to fetch tenant Details const fetchTenantDetails = async () => { - const user = JSON.parse( - localStorage.getItem( - `Parse/${localStorage.getItem("parseAppId")}/currentUser` - ) - ); - if (user) { + if (jwttoken) { try { - const tenantDetails = await getTenantDetails(user?.objectId); + const tenantDetails = await getTenantDetails("", jwttoken); if (tenantDetails && tenantDetails === "user does not exist!") { alert(t("user-not-exist")); } else if (tenantDetails) { @@ -262,7 +257,9 @@ const DraftTemplate = () => { if (isEnableSubscription) { checkIsSubscribed(documentData[0]?.ExtUserPtr?.Email); } - setPdfDetails(documentData); + const updatedPdfDetails = [...documentData]; + updatedPdfDetails[0].SignatureType = updatedSignatureType; + setPdfDetails(updatedPdfDetails); setIsSigners(true); if (documentData[0].Signers && documentData[0].Signers.length > 0) { setIsSelectId(0); @@ -338,6 +335,11 @@ const DraftTemplate = () => { docSignTypes ); setSignatureType(updatedSignatureType); + if (documentData?.length && documentData?.[0]?.objectId) { + const updatedPdfDetails = [...documentData]; + updatedPdfDetails[0].SignatureType = updatedSignatureType; + setPdfDetails(updatedPdfDetails); + } setSignerUserId(res[0].objectId); const tourstatus = res[0].TourStatus && res[0].TourStatus; if (tourstatus && tourstatus.length > 0) { diff --git a/apps/OpenSign/src/pages/PlaceHolderSign.js b/apps/OpenSign/src/pages/PlaceHolderSign.js index 369aa6551..2f518cf42 100644 --- a/apps/OpenSign/src/pages/PlaceHolderSign.js +++ b/apps/OpenSign/src/pages/PlaceHolderSign.js @@ -320,7 +320,9 @@ function PlaceHolderSign() { }); } } - setPdfDetails(documentData); + const updatedPdfDetails = [...documentData]; + updatedPdfDetails[0].SignatureType = updatedSignatureType; + setPdfDetails(updatedPdfDetails); //condition when placeholder have empty array with role details and signers array have signers data //and both array length are same //this case happen using placeholder form in auto save funtionality to save draft type document without adding any placehlder @@ -451,6 +453,11 @@ function PlaceHolderSign() { docSignTypes ); setSignatureType(updatedSignatureType); + if (documentData?.length && documentData?.[0]?.objectId) { + const updatedPdfDetails = [...documentData]; + updatedPdfDetails[0].SignatureType = updatedSignatureType; + setPdfDetails(updatedPdfDetails); + } setActiveMailAdapter(res[0]?.active_mail_adapter); setSignerUserId(res[0].objectId); const tourstatus = res[0].TourStatus && res[0].TourStatus; @@ -931,7 +938,7 @@ function PlaceHolderSign() { }, 2000); return () => clearTimeout(timer); // eslint-disable-next-line react-hooks/exhaustive-deps - }, [signerPos, signersdata]); + }, [signerPos, signersdata, signatureType]); // `autosavedetails` is used to save doc details after every 2 sec when changes are happern in placeholder like drag-drop widgets, remove signers const autosavedetails = async () => { @@ -950,6 +957,7 @@ function PlaceHolderSign() { docCls.id = documentId; docCls.set("Placeholders", signerPos); docCls.set("Signers", signers); + docCls.set("SignatureType", signatureType); await docCls.save(); } catch (e) { console.log("error", e); @@ -1906,9 +1914,11 @@ function PlaceHolderSign() { { setIsSend(false); @@ -1935,7 +1945,12 @@ function PlaceHolderSign() {
{handleShareList()}
) : ( -

{t("placeholder-alert-6")}

+
+

{t("placeholder-alert-6")}

+ {isCurrUser && ( +

{t("placeholder-alert-5")}

+ )} +
)} {!mailStatus && (
diff --git a/apps/OpenSign/src/pages/Preferences.js b/apps/OpenSign/src/pages/Preferences.js index 07792cd8d..3d098d4d0 100644 --- a/apps/OpenSign/src/pages/Preferences.js +++ b/apps/OpenSign/src/pages/Preferences.js @@ -10,7 +10,7 @@ import { signatureTypes } from "../constant/Utils"; import Parse from "parse"; - +import { Tooltip as ReactTooltip } from "react-tooltip"; const Preferences = () => { const { t } = useTranslation(); const [isalert, setIsAlert] = useState({ type: "success", msg: "" }); @@ -84,7 +84,7 @@ const Preferences = () => { } else { setIsAlert({ type: "danger", - msg: "please enable at least one signature type" + msg: "Please enable at least one signature type" }); setTimeout(() => setIsAlert({ type: "success", msg: "" }), 1500); setIsLoader(false); @@ -112,7 +112,6 @@ const Preferences = () => {
)} -

OpenSign™ {t("Preferences")}{" "} @@ -128,7 +127,48 @@ const Preferences = () => { htmlFor="signaturetype" className="text-[14px] mb-[0.7rem] font-medium" > - Allowed signature types + {t("allowed-signature-types")} + + + + + + +
+

+ {t("allowed-signature-types")} +

+

{t("allowed-signature-types-help.p1")}

+

+

    +
  1. + Draw: + + {t("allowed-signature-types-help.l1")} + +
  2. +
  3. + Typed: + + {t("allowed-signature-types-help.l2")} + +
  4. +
  5. + Upload: + + {t("allowed-signature-types-help.l3")} + +
  6. +
  7. + Default: + + {t("allowed-signature-types-help.l4")} + +
  8. +
+

+
+
{signatureType.map((type, i) => ( @@ -144,10 +184,9 @@ const Preferences = () => { checked={type.enabled} />
- {/* {t(`widget-status.${data}`)} */} {type.name}
diff --git a/apps/OpenSign/src/pages/TemplatePlaceholder.js b/apps/OpenSign/src/pages/TemplatePlaceholder.js index eeb8909de..41b15b89f 100644 --- a/apps/OpenSign/src/pages/TemplatePlaceholder.js +++ b/apps/OpenSign/src/pages/TemplatePlaceholder.js @@ -245,7 +245,9 @@ const TemplatePlaceholder = () => { if (isEnableSubscription) { checkIsSubscribed(documentData[0]?.ExtUserPtr?.Email); } - setPdfDetails(documentData); + const updatedPdfDetails = [...documentData]; + updatedPdfDetails[0].SignatureType = updatedSignatureType; + setPdfDetails(updatedPdfDetails); setIsSigners(true); if (documentData[0].Signers && documentData[0].Signers.length > 0) { setIsSelectId(0); @@ -320,6 +322,11 @@ const TemplatePlaceholder = () => { docSignTypes ); setSignatureType(updatedSignatureType); + if (documentData?.length && documentData?.[0]?.objectId) { + const updatedPdfDetails = [...documentData]; + updatedPdfDetails[0].SignatureType = updatedSignatureType; + setPdfDetails(updatedPdfDetails); + } setSignerUserId(res[0].objectId); setCurrentEmail(res[0].Email); const tourstatus = res[0].TourStatus && res[0].TourStatus; @@ -693,7 +700,7 @@ const TemplatePlaceholder = () => { }, 2000); return () => clearTimeout(timer); // eslint-disable-next-line react-hooks/exhaustive-deps - }, [signerPos]); + }, [signerPos, signatureType]); // `autosavedetails` is used to save template details after every 2 sec when changes are happern in placeholder like drag-drop widgets, remove signers const autosavedetails = async () => { @@ -715,6 +722,7 @@ const TemplatePlaceholder = () => { templateCls.id = templateId; templateCls.set("Placeholders", signerPos); templateCls.set("Signers", signers); + templateCls.set("SignatureType", signatureType); await templateCls.save(); } catch (err) { console.log("error in autosave template", err); diff --git a/apps/OpenSign/src/script/locales/en/translation.json b/apps/OpenSign/src/script/locales/en/translation.json index a59dcf198..554d46629 100644 --- a/apps/OpenSign/src/script/locales/en/translation.json +++ b/apps/OpenSign/src/script/locales/en/translation.json @@ -446,7 +446,8 @@ "cutomize-email": "Cutomize Email", "upgrade-to-customize-email": "Upgrade to customize Email", "sign-url": "Sign url", - "Mails Sent": "Mails Sent", + "mails-sent": "Mails Sent", + "mail-not-delivered": "Mail not delivered", "document-alert": "Document Alert", "owner-subscription-expired": "Owner's subscription has expired.", "subscription-expired": "Subscription Expired", @@ -687,5 +688,12 @@ "text-field-tour": "Fields of type 'Text' must be filled in advance before the document is sent. If you need the signers to provide input, use the 'Text Input' field instead.", "attach-signer-tour": "You need to attach a Signer to every role. You can do that by clicking this icon. Once you select a Signer it will be attached to all the fields associated with that role which appear in the same colour.", "allowed-signature-types": "Allowed signature types", - "at-least-one-signature-type": "At least one signature type should be enabled." + "at-least-one-signature-type": "At least one signature type should be enabled.", + "allowed-signature-types-help": { + "p1": "This signature preference controls which signing options are available to your signers. Only the signature types you select will appear in the signature widget when a document is signed. For example, if you choose only the 'Draw' option in preferences, your signer will see only the 'Draw' option in the signature widget, while the other three options will not be available.", + "l1": "Create a handwritten signature directly on the screen using your finger or a stylus.", + "l2": "Enter your name and choose from various font styles to create a signature.", + "l3": "Upload an existing digital version of your signature.", + "l4": "Use a pre-set signature style saved under 'My Signature' in your settings." + } } diff --git a/apps/OpenSign/src/script/locales/es/translation.json b/apps/OpenSign/src/script/locales/es/translation.json index 8669131b0..f1c830645 100644 --- a/apps/OpenSign/src/script/locales/es/translation.json +++ b/apps/OpenSign/src/script/locales/es/translation.json @@ -446,7 +446,8 @@ "cutomize-email": "Personalizar correo", "upgrade-to-customize-email": "Mejora para personalizar el correo", "sign-url": "URL de firma", - "Mails Sent": "Correos enviados", + "mails-sent": "Correos enviados", + "mail-not-delivered": "correo no entregado", "document-alert": "Alerta de documento", "owner-subscription-expired": "La suscripción del propietario ha expirado.", "subscription-expired": "Suscripción expirada", @@ -687,5 +688,12 @@ "text-field-tour": "Los campos de tipo 'Texto' deben completarse con anticipación antes de enviar el documento. Si necesita que los firmantes proporcionen información, utilice el campo 'Entrada de texto'", "attach-signer-tour": "Debe adjuntar un firmante a cada función. Puede hacerlo haciendo clic en este icono. Una vez que seleccione un Firmante, se adjuntará a todos los campos asociados con ese rol que aparecen en el mismo color.", "allowed-signature-types": "Tipos de firma permitidos", - "at-least-one-signature-type": "Se debe habilitar al menos un tipo de firma." + "at-least-one-signature-type": "Se debe habilitar al menos un tipo de firma.", + "allowed-signature-types-help": { + "p1": "Esta preferencia de firma controla qué opciones de firma están disponibles para sus firmantes. Solo los tipos de firma que seleccione aparecerán en el widget de firma cuando se firme un documento. Por ejemplo, si elige sólo la opción 'Draw' en las preferencias, su firmante verá sólo la opción 'Draw' en el widget de firma, mientras que las otras tres opciones no estarán disponibles.", + "l1": "Cree una firma manuscrita directamente en la pantalla usando su dedo o un lápiz.", + "l2": "Ingrese su nombre y elija entre varios estilos de fuente para crear una firma.", + "l3": "Cargue una versión digital existente de su firma.", + "l4": "Utilice un estilo de firma preestablecido guardado en 'Mi firma' en su configuración." + } } diff --git a/apps/OpenSign/src/script/locales/fr/translation.json b/apps/OpenSign/src/script/locales/fr/translation.json index 3c7fe6cf7..9c9236384 100644 --- a/apps/OpenSign/src/script/locales/fr/translation.json +++ b/apps/OpenSign/src/script/locales/fr/translation.json @@ -445,7 +445,8 @@ "cutomize-email": "Personnaliser l'e-mail", "upgrade-to-customize-email": "Mise à niveau pour personnaliser l'e-mail", "sign-url": "Signer l'URL", - "Mails Sent": "Mails envoyés avec succès !", + "mails-sent": "Mails envoyés avec succès !", + "mail-not-delivered": "Courrier non distribué", "document-alert": "Alerte document", "owner-subscription-expired": "L'abonnement du propriétaire a expiré.", "subscription-expired": "Abonnement expiré", @@ -686,5 +687,12 @@ "text-field-tour": "Les champs de type 'Texte' doivent être remplis à l'avance avant l'envoi du document. Si vous avez besoin que les signataires fournissent des informations, utilisez plutôt le champ 'Saisie de texte'.", "attach-signer-tour": "Vous devez associer un signataire à chaque rôle. Vous pouvez le faire en cliquant sur cette icône. Une fois que vous avez sélectionné un signataire, il sera attaché à tous les champs associés à ce rôle qui apparaissent dans la même couleur.", "allowed-signature-types": "Types de signature autorisés", - "at-least-one-signature-type": "Au moins un type de signature doit être activé." + "at-least-one-signature-type": "Au moins un type de signature doit être activé.", + "allowed-signature-types-help": { + "p1": "Cette préférence de signature contrôle les options de signature disponibles pour vos signataires. Seuls les types de signature que vous sélectionnez apparaîtront dans le widget de signature lorsqu'un document est signé. Par exemple, si vous choisissez uniquement l'option 'Draw' dans les préférences, votre signataire ne verra que l'option 'Draw' dans le widget de signature, tandis que les trois autres options ne seront pas disponibles.", + "l1": "Créez une signature manuscrite directement sur l'écran à l'aide de votre doigt ou d'un stylet.", + "l2": "Entrez votre nom et choisissez parmi différents styles de police pour créer une signature.", + "l3": "Téléchargez une version numérique existante de votre signature.", + "l4": "Utilisez un style de signature prédéfini enregistré sous 'Ma signature' ​​dans vos paramètres." + } }