Skip to content

Commit 5679668

Browse files
Merge pull request #1422 from OpenSignLabs/validation
feat: add functionality to enable/disable signature types
2 parents f0a406a + e03f07a commit 5679668

28 files changed

+1289
-666
lines changed

apps/OpenSign/public/locales/en/translation.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
"My Signature": "My Signature",
9595
"API Token": "API Token",
9696
"Webhook": "Webhook",
97+
"Preferences": "Preferences",
9798
"Teams": "Teams",
9899
"Team-update-successfully": "Team Updated successfully.",
99100
"Users": "Users"
@@ -684,6 +685,7 @@
684685
"add-user-template": "You need to add a role before you can add fields for it.",
685686
"pdf-uncompatible": "This pdf is not compatible with opensign, please contact <[email protected]>",
686687
"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.",
687-
"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."
688-
688+
"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.",
689+
"allowed-signature-types": "Allowed signature types",
690+
"at-least-one-signature-type": "At least one signature type should be enabled."
689691
}

apps/OpenSign/public/locales/es/translation.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
"My Signature": "Mi firma",
9595
"API Token": "Token API",
9696
"Webhook": "Webhook",
97+
"Preferences": "Preferencias",
9798
"Teams": "Equipos",
9899
"Team-update-successfully": "Equipo actualizado correctamente.",
99100
"Users": "Usuarios"
@@ -684,6 +685,7 @@
684685
"form-title-1": "Configuración del flujo de documentos",
685686
"form-title-2": "Configuración de seguridad",
686687
"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'",
687-
"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."
688-
688+
"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.",
689+
"allowed-signature-types": "Tipos de firma permitidos",
690+
"at-least-one-signature-type": "Se debe habilitar al menos un tipo de firma."
689691
}

apps/OpenSign/public/locales/fr/translation.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
"My Signature": "Ma signature",
9595
"API Token": "Jeton API",
9696
"Webhook": "Webhook",
97+
"Preferences": "Préférences",
9798
"Teams": "Équipe",
9899
"Team-update-successfully": "Équipe mise à jour avec succès.",
99100
"Users": "Utilisateurs"
@@ -683,7 +684,7 @@
683684
"add-user-template":"Vous devez ajouter un rôle avant de pouvoir lui ajouter des champs. ",
684685
"pdf-uncompatible":"Ce pdf n'est pas compatible avec opensign, veuillez contacter <[email protected]>",
685686
"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'.",
686-
"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."
687-
688-
687+
"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.",
688+
"allowed-signature-types": "Types de signature autorisés",
689+
"at-least-one-signature-type": "Au moins un type de signature doit être activé."
689690
}

apps/OpenSign/src/App.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const Webhook = lazy(() => import("./pages/Webhook"));
3636
const AddAdmin = lazy(() => import("./pages/AddAdmin"));
3737
const UpdateExistUserAdmin = lazy(() => import("./pages/UpdateExistUserAdmin"));
3838
const DraftTemplate = lazy(() => import("./pages/DraftTemplate"));
39+
const Preferences = lazy(() => import("./pages/Preferences"));
3940

4041
pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/legacy/build/pdf.worker.min.mjs`;
4142
const AppLoader = () => {
@@ -199,6 +200,10 @@ function App() {
199200
</>
200201
)}
201202
<Route path="/users" element={<UserList />} />
203+
<Route
204+
path="/preferences"
205+
element={<LazyPage Page={Preferences} />}
206+
/>
202207
</Route>
203208
<Route path="/sso" element={<SSOVerify />} />
204209
<Route

apps/OpenSign/src/components/BulkSendUi.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,11 @@ const BulkSendUi = (props) => {
258258
: [...existSigner]
259259
});
260260
} else {
261-
Documents.push({ ...props.item, Placeholders: updatedPlaceholders });
261+
Documents.push({
262+
...props.item,
263+
Placeholders: updatedPlaceholders,
264+
SignatureType: props.signatureType
265+
});
262266
}
263267
});
264268
await batchQuery(Documents);

apps/OpenSign/src/components/pdf/DefaultSignature.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import React from "react";
22
import { useTranslation } from "react-i18next";
3-
function DefaultSignature({ defaultSignImg, xyPostion, setDefaultSignAlert }) {
3+
function DefaultSignature(props) {
44
const { t } = useTranslation();
55

66
const confirmToaddDefaultSign = () => {
7-
if (xyPostion.length > 0) {
8-
setDefaultSignAlert({
7+
if (props?.xyPostion.length > 0) {
8+
props?.setDefaultSignAlert({
99
isShow: true,
1010
alertMessage: t("default-sign-alert")
1111
});
1212
} else {
13-
setDefaultSignAlert({
13+
props?.setDefaultSignAlert({
1414
isShow: true,
1515
alertMessage: t("please-select-position!")
1616
});
@@ -22,22 +22,32 @@ function DefaultSignature({ defaultSignImg, xyPostion, setDefaultSignAlert }) {
2222
<div className="mx-2 pr-2 pt-2 pb-1 text-[15px] text-base-content font-semibold border-b-[1px] border-base-300">
2323
{t("signature")}
2424
</div>
25-
<div className="flex flex-col items-center mt-[10px] font-semibold">
25+
<div
26+
className={`${
27+
props?.isDefault ? "" : "bg-black/70"
28+
} flex flex-col items-center mt-[10px] font-semibold relative`}
29+
>
2630
<p className="text-base-content">{t("Your-Signature")}</p>
2731
<div className="op-card shadow-md h-[111px] w-[90%] p-2">
2832
<img
2933
alt="signature"
3034
className="w-full h-full object-contain"
31-
src={defaultSignImg}
35+
src={props?.defaultSignImg}
3236
/>
3337
</div>
3438
<button
3539
type="button"
3640
className="op-btn op-btn-primary op-btn-sm mt-[10px]"
3741
onClick={() => confirmToaddDefaultSign()}
42+
disabled={!props?.isDefault}
3843
>
3944
{t("auto-sign-all")}
4045
</button>
46+
{!props.isDefault && (
47+
<div className="absolute text-white w-full h-full flex items-center justify-center -rotate-45 text-[11px] cursor-default">
48+
Document creator has disabled this option
49+
</div>
50+
)}
4151
</div>
4252
</div>
4353
);

apps/OpenSign/src/components/pdf/Placeholder.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -445,17 +445,13 @@ function Placeholder(props) {
445445
handleOnClickSettingIcon();
446446
}}
447447
className="fa-light fa-gear icon"
448-
style={{
449-
color: "#188ae2",
450-
right: "29px",
451-
top: "-19px"
452-
}}
448+
style={{ color: "#188ae2", right: "29px", top: "-19px" }}
453449
></i>
454450
) : (
455451
/* condition to add setting icon for placeholder & template flow for all widgets except signature and date */
456452
((!props?.pos?.type && props.pos.isStamp) ||
457453
(props?.pos?.type &&
458-
!["date", "signature"].includes(props.pos.type) &&
454+
!["date"].includes(props.pos.type) &&
459455
!props.isSignYourself)) && (
460456
<i
461457
onClick={(e) => {
@@ -469,7 +465,7 @@ function Placeholder(props) {
469465
className="fa-light fa-gear icon"
470466
style={{
471467
color: "#188ae2",
472-
right: props?.pos?.type === textWidget ? "32px" : "47px",
468+
right: props?.pos?.type === textWidget ? "32px" : "51px",
473469
top: "-19px"
474470
}}
475471
></i>

0 commit comments

Comments
 (0)