Merge pull request #1426 from OpenSignLabs/validation

fix: issue of signature types
This commit is contained in:
prafull-opensignlabs
2024-11-07 19:02:07 +05:30
committed by GitHub
12 changed files with 152 additions and 42 deletions
@@ -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",
@@ -688,5 +689,12 @@
"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.",
"add-signer-note" :"Note - This contact will be added to your contact list"
"add-signer-note": "Note - This contact will be added to your contact list",
"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."
}
}
@@ -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",
@@ -688,5 +689,12 @@
"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.",
"add-signer-note" :"Nota - Este contacto se agregará a su lista de contactos"
"add-signer-note": "Nota - Este contacto se agregará a su lista de contactos",
"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."
}
}
@@ -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é",
@@ -687,5 +688,12 @@
"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é.",
"add-signer-note": "Remarque - Ce contact sera ajouté à votre liste de contacts"
"add-signer-note": "Remarque - Ce contact sera ajouté à votre liste de contacts",
"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."
}
}
@@ -22,11 +22,7 @@ function DefaultSignature(props) {
<div className="mx-2 pr-2 pt-2 pb-1 text-[15px] text-base-content font-semibold border-b-[1px] border-base-300">
{t("signature")}
</div>
<div
className={`${
props?.isDefault ? "" : "bg-black/70"
} flex flex-col items-center mt-[10px] font-semibold relative`}
>
<div className="flex flex-col items-center mt-[10px] font-semibold relative">
<p className="text-base-content">{t("Your-Signature")}</p>
<div className="op-card shadow-md h-[111px] w-[90%] p-2">
<img
@@ -44,8 +40,10 @@ function DefaultSignature(props) {
{t("auto-sign-all")}
</button>
{!props.isDefault && (
<div className="absolute text-white w-full h-full flex items-center justify-center -rotate-45 text-[11px] cursor-default">
Document creator has disabled this option
<div className="absolute bg-black/70 text-white w-full h-full flex items-center justify-center text-[11px] cursor-default">
<span className="-rotate-45">
Document creator has disabled this option
</span>
</div>
)}
</div>
@@ -304,7 +304,7 @@ const WidgetNameModal = (props) => {
checked={type.enabled}
/>
<div
className="text-[13px] font-medium hover:underline underline-offset-2 cursor-default"
className="text-[13px] font-medium hover:underline underline-offset-2 cursor-default capitalize"
title={`Enabling this allow signers to ${type.name} signature`}
>
{type.name}
+10 -8
View File
@@ -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) {
+21 -6
View File
@@ -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() {
<ModalUi
isOpen={isSend}
title={
mailStatus === "quotareached"
? t("quota-mail-head")
: t("Mails Sent")
mailStatus === "success"
? t("mails-sent")
: mailStatus === "quotareached"
? t("quota-mail-head")
: t("mail-not-delivered")
}
handleClose={() => {
setIsSend(false);
@@ -1935,7 +1945,12 @@ function PlaceHolderSign() {
<div className="my-3">{handleShareList()}</div>
</div>
) : (
<p>{t("placeholder-alert-6")}</p>
<div className="mb-[10px]">
<p>{t("placeholder-alert-6")}</p>
{isCurrUser && (
<p className="mt-1">{t("placeholder-alert-5")}</p>
)}
</div>
)}
{!mailStatus && (
<div className="w-full h-[1px] bg-[#9f9f9f] my-[15px]"></div>
+45 -6
View File
@@ -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 = () => {
<Loader />
</div>
)}
<h1 className="ml-4 mt-3 mb-2 font-semibold">
OpenSign {t("Preferences")}{" "}
<span>
@@ -128,7 +127,48 @@ const Preferences = () => {
htmlFor="signaturetype"
className="text-[14px] mb-[0.7rem] font-medium"
>
Allowed signature types
{t("allowed-signature-types")}
<a data-tooltip-id="signtypes-tooltip" className="ml-1">
<sup>
<i className="fa-light fa-question rounded-full border-[#33bbff] text-[#33bbff] text-[13px] border-[1px] py-[1.5px] px-[4px]"></i>
</sup>
</a>
<ReactTooltip id="signtypes-tooltip" className="z-[999]">
<div className="max-w-[200px] md:max-w-[450px] text-[11px]">
<p className="font-bold">
{t("allowed-signature-types")}
</p>
<p>{t("allowed-signature-types-help.p1")}</p>
<p className="p-[5px] ml-2">
<ol className="list-disc">
<li>
<span className="font-bold">Draw: </span>
<span>
{t("allowed-signature-types-help.l1")}
</span>
</li>
<li>
<span className="font-bold">Typed: </span>
<span>
{t("allowed-signature-types-help.l2")}
</span>
</li>
<li>
<span className="font-bold">Upload: </span>
<span>
{t("allowed-signature-types-help.l3")}
</span>
</li>
<li>
<span className="font-bold">Default: </span>
<span>
{t("allowed-signature-types-help.l4")}
</span>
</li>
</ol>
</p>
</div>
</ReactTooltip>
</label>
<div className=" ml-[7px] flex flex-col md:flex-row gap-[10px] mb-[0.7rem]">
{signatureType.map((type, i) => (
@@ -144,10 +184,9 @@ const Preferences = () => {
checked={type.enabled}
/>
<div
className="text-[13px] font-medium hover:underline underline-offset-2 cursor-default"
className="text-[13px] font-medium hover:underline underline-offset-2 cursor-default capitalize"
title={`Enabling this allow signers to ${type.name} signature`}
>
{/* {t(`widget-status.${data}`)} */}
{type.name}
</div>
</div>
+10 -2
View File
@@ -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);
@@ -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",
@@ -688,5 +689,12 @@
"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.",
"add-signer-note" :"Note - This contact will be added to your contact list"
"add-signer-note": "Note - This contact will be added to your contact list",
"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."
}
}
@@ -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",
@@ -688,5 +689,12 @@
"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.",
"add-signer-note" :"Nota - Este contacto se agregará a su lista de contactos"
"add-signer-note": "Nota - Este contacto se agregará a su lista de contactos",
"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."
}
}
@@ -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é",
@@ -687,5 +688,12 @@
"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é.",
"add-signer-note": "Remarque - Ce contact sera ajouté à votre liste de contacts"
"add-signer-note": "Remarque - Ce contact sera ajouté à votre liste de contacts",
"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."
}
}