mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-09-13 21:27:40 +02:00
Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e87aa4c38 | ||
|
|
b0e0b38e8f | ||
|
|
49c23fb52b | ||
|
|
da4b604710 | ||
|
|
82d518b3c9 | ||
|
|
dcbde2b661 | ||
|
|
27b0b426ad | ||
|
|
8788afaa8e | ||
|
|
428aa65b38 | ||
|
|
295d942427 | ||
|
|
c4e28e6e6e | ||
|
|
b19fb29b82 | ||
|
|
d888897b62 | ||
|
|
c4779c14c1 | ||
|
|
e48869cb2f |
@@ -73,12 +73,28 @@ Welcome to OpenSign, the premier open source docusign alternative - document e-s
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Installation
|
### Deploy
|
||||||
|
|
||||||
|
Note: The default MongoDB instance used in deployment is not persistant and will be cleared on every restart. To retain your data, configure and supply your own MongoDB connection URL.
|
||||||
|
|
||||||
|
#### DigitalOcean
|
||||||
|
[](https://cloud.digitalocean.com/apps/new?repo=https://github.com/OpenSignLabs/Deploy-OpenSign-to-Digital-Ocean/tree/main&refcode=30db1c901ab0)
|
||||||
|
|
||||||
|
#### Docker
|
||||||
The simplest way to install OpenSign on your own server is using official docker images by running the following command -
|
The simplest way to install OpenSign on your own server is using official docker images by running the following command -
|
||||||
|
|
||||||
|
**Command for linux/MacOS**
|
||||||
```
|
```
|
||||||
export HOST_URL=https://opensign.yourdomain.com && curl --remote-name-all https://raw.githubusercontent.com/OpenSignLabs/OpenSign/main/docker-compose.yml https://raw.githubusercontent.com/OpenSignLabs/OpenSign/main/Caddyfile https://raw.githubusercontent.com/OpenSignLabs/OpenSign/main/.env.local_dev && mv .env.local_dev .env.prod && docker compose up --force-recreate
|
export HOST_URL=https://opensign.yourdomain.com && curl --remote-name-all https://raw.githubusercontent.com/OpenSignLabs/OpenSign/main/docker-compose.yml https://raw.githubusercontent.com/OpenSignLabs/OpenSign/main/Caddyfile https://raw.githubusercontent.com/OpenSignLabs/OpenSign/main/.env.local_dev && mv .env.local_dev .env.prod && docker compose up --force-recreate
|
||||||
```
|
```
|
||||||
|
**Command for Windows (Powershell)**
|
||||||
|
```
|
||||||
|
$env:HOST_URL="https://opensign.yourdomain.com"; Invoke-WebRequest -Uri https://raw.githubusercontent.com/OpenSignLabs/OpenSign/main/docker-compose.yml -OutFile docker-compose.yml; Invoke-WebRequest -Uri https://raw.githubusercontent.com/OpenSignLabs/OpenSign/main/Caddyfile -OutFile Caddyfile; Invoke-WebRequest -Uri https://raw.githubusercontent.com/OpenSignLabs/OpenSign/main/.env.local_dev -OutFile .env.local_dev; Rename-Item -Path .env.local_dev -NewName .env.prod; docker compose up --force-recreate
|
||||||
|
```
|
||||||
|
**Command for Windows (CMD/Terminal)**
|
||||||
|
```
|
||||||
|
set HOST_URL=https://opensign.yourdomain.com && curl -O https://raw.githubusercontent.com/OpenSignLabs/OpenSign/main/docker-compose.yml && curl -O https://raw.githubusercontent.com/OpenSignLabs/OpenSign/main/Caddyfile && curl -O https://raw.githubusercontent.com/OpenSignLabs/OpenSign/main/.env.local_dev && rename .env.local_dev .env.prod && docker compose up --force-recreate
|
||||||
|
```
|
||||||
Make sure that you have `Docker` and `git` installed before you run this command -
|
Make sure that you have `Docker` and `git` installed before you run this command -
|
||||||
|
|
||||||
Please refer to the [Installation Guide](https://docs.opensignlabs.com/docs/self-host/docker/run-locally/) for detailed instructions on how to install OpenSign on your system.
|
Please refer to the [Installation Guide](https://docs.opensignlabs.com/docs/self-host/docker/run-locally/) for detailed instructions on how to install OpenSign on your system.
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
# Use an official Node runtime as the base image
|
|
||||||
FROM node:18
|
|
||||||
|
|
||||||
# Set the working directory inside the container
|
|
||||||
WORKDIR /usr/src/app
|
|
||||||
|
|
||||||
# Copy package.json and package-lock.json first to leverage Docker cache
|
|
||||||
COPY ./package*.json ./
|
|
||||||
|
|
||||||
# Install application dependencies
|
|
||||||
RUN npm install
|
|
||||||
|
|
||||||
# Copy the current directory contents into the container
|
|
||||||
COPY ./ .
|
|
||||||
COPY ./.husky .
|
|
||||||
|
|
||||||
# Make port 3000 available to the world outside this container
|
|
||||||
EXPOSE 3000
|
|
||||||
|
|
||||||
# Define environment variables if needed
|
|
||||||
# ENV NODE_ENV production
|
|
||||||
|
|
||||||
# Run the application
|
|
||||||
ENTRYPOINT npm run start
|
|
||||||
|
|
||||||
@@ -13,6 +13,10 @@ RUN npm install
|
|||||||
# Copy the current directory contents into the container
|
# Copy the current directory contents into the container
|
||||||
COPY apps/OpenSign/ .
|
COPY apps/OpenSign/ .
|
||||||
COPY apps/OpenSign/.husky .
|
COPY apps/OpenSign/.husky .
|
||||||
|
COPY apps/OpenSign/entrypoint.sh .
|
||||||
|
|
||||||
|
# make the entrypoint.sh file executable
|
||||||
|
RUN chmod +x entrypoint.sh
|
||||||
|
|
||||||
# Define environment variables if needed
|
# Define environment variables if needed
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
@@ -20,8 +24,13 @@ ENV GENERATE_SOURCEMAP=false
|
|||||||
# build
|
# build
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
# Inject env.js loader into index.html
|
||||||
|
RUN sed -i '/<head>/a\<script src="/env.js"></script>' build/index.html
|
||||||
|
|
||||||
# Make port 3000 available to the world outside this container
|
# Make port 3000 available to the world outside this container
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
|
ENTRYPOINT ["./entrypoint.sh"]
|
||||||
|
|
||||||
# Run the application
|
# Run the application
|
||||||
CMD ["npm", "start"]
|
CMD ["npm", "start"]
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
ENV_FILE=./build/env.js
|
||||||
|
DOTENV_FILE=./.env.prod # ✅ use .env.prod
|
||||||
|
|
||||||
|
echo "Generating runtime env file at $ENV_FILE..."
|
||||||
|
|
||||||
|
echo "window.RUNTIME_ENV = {" > $ENV_FILE
|
||||||
|
|
||||||
|
# List of keys to include
|
||||||
|
RUNTIME_KEYS="REACT_APP_SERVERURL"
|
||||||
|
|
||||||
|
for key in $RUNTIME_KEYS; do
|
||||||
|
# First check docker env (-e), fallback to .env file
|
||||||
|
value=$(printenv "$key")
|
||||||
|
|
||||||
|
if [ -z "$value" ] && [ -f "$DOTENV_FILE" ]; then
|
||||||
|
# fallback: read from .env
|
||||||
|
value=$(grep "^$key=" "$DOTENV_FILE" | cut -d '=' -f2- | tr -d '\r\n' | sed 's/"/\\"/g')
|
||||||
|
else
|
||||||
|
value=$(echo "$value" | sed 's/"/\\"/g')
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo " $key: \"$value\"," >> $ENV_FILE
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "};" >> $ENV_FILE
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
Generated
+923
-192
File diff suppressed because it is too large
Load Diff
+20
-17
@@ -4,11 +4,11 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@formkit/auto-animate": "^0.8.2",
|
"@formkit/auto-animate": "^0.8.2",
|
||||||
"@lottiefiles/dotlottie-react": "^0.13.5",
|
"@imgly/background-removal": "^1.6.0",
|
||||||
|
"@lottiefiles/dotlottie-react": "^0.14.0",
|
||||||
"@pdf-lib/fontkit": "^1.1.1",
|
"@pdf-lib/fontkit": "^1.1.1",
|
||||||
"@radix-ui/themes": "^3.2.1",
|
"@radix-ui/themes": "^3.2.1",
|
||||||
"@reduxjs/toolkit": "^2.8.2",
|
"@reduxjs/toolkit": "^2.8.2",
|
||||||
"@imgly/background-removal": "^1.6.0",
|
|
||||||
"axios": "^1.9.0",
|
"axios": "^1.9.0",
|
||||||
"date-fns-tz": "^3.2.0",
|
"date-fns-tz": "^3.2.0",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
@@ -20,13 +20,14 @@
|
|||||||
"moment": "^2.30.1",
|
"moment": "^2.30.1",
|
||||||
"parse": "^6.1.1",
|
"parse": "^6.1.1",
|
||||||
"pdf-lib": "^1.17.1",
|
"pdf-lib": "^1.17.1",
|
||||||
|
"pkijs": "^3.0.8",
|
||||||
"print-js": "^1.6.0",
|
"print-js": "^1.6.0",
|
||||||
"prismjs": "^1.30.0",
|
"prismjs": "^1.30.0",
|
||||||
"radix-ui": "^1.4.2",
|
"radix-ui": "^1.4.2",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-bootstrap": "^2.10.10",
|
"react-bootstrap": "^2.10.10",
|
||||||
"react-confetti": "^6.4.0",
|
"react-confetti": "^6.4.0",
|
||||||
"react-datepicker": "^8.3.0",
|
"react-datepicker": "^8.4.0",
|
||||||
"react-dnd": "^16.0.1",
|
"react-dnd": "^16.0.1",
|
||||||
"react-dnd-html5-backend": "^16.0.1",
|
"react-dnd-html5-backend": "^16.0.1",
|
||||||
"react-dnd-multi-backend": "^9.0.0",
|
"react-dnd-multi-backend": "^9.0.0",
|
||||||
@@ -34,13 +35,13 @@
|
|||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
"react-gtm-module": "^2.0.11",
|
"react-gtm-module": "^2.0.11",
|
||||||
"react-helmet": "^6.1.0",
|
"react-helmet": "^6.1.0",
|
||||||
"react-i18next": "^15.5.1",
|
"react-i18next": "^15.5.2",
|
||||||
"react-konva": "^18.2.10",
|
"react-konva": "^18.2.10",
|
||||||
"react-pdf": "^9.2.1",
|
"react-pdf": "^9.2.1",
|
||||||
"react-quill-new": "^3.4.6",
|
"react-quill-new": "^3.4.6",
|
||||||
"react-redux": "^9.2.0",
|
"react-redux": "^9.2.0",
|
||||||
"react-rnd": "^10.5.2",
|
"react-rnd": "^10.5.2",
|
||||||
"react-router": "^7.6.0",
|
"react-router": "^7.6.1",
|
||||||
"react-scrollbars-custom": "^4.1.1",
|
"react-scrollbars-custom": "^4.1.1",
|
||||||
"react-select": "^5.10.1",
|
"react-select": "^5.10.1",
|
||||||
"react-signature-canvas": "^1.1.0-alpha.2",
|
"react-signature-canvas": "^1.1.0-alpha.2",
|
||||||
@@ -51,7 +52,7 @@
|
|||||||
"regex-parser": "^2.3.1",
|
"regex-parser": "^2.3.1",
|
||||||
"serve": "^14.2.4",
|
"serve": "^14.2.4",
|
||||||
"styled-components": "^5.3.11",
|
"styled-components": "^5.3.11",
|
||||||
"web-vitals": "^5.0.1",
|
"web-vitals": "^5.0.2",
|
||||||
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
|
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -92,16 +93,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.27.1",
|
"@babel/core": "^7.27.4",
|
||||||
"@babel/preset-env": "^7.27.2",
|
"@babel/preset-env": "^7.27.2",
|
||||||
"@babel/preset-react": "^7.27.1",
|
"@babel/preset-react": "^7.27.1",
|
||||||
"@babel/runtime-corejs2": "^7.27.1",
|
"@babel/runtime-corejs2": "^7.27.4",
|
||||||
"@testing-library/jest-dom": "^6.6.3",
|
"@testing-library/jest-dom": "^6.6.3",
|
||||||
"@testing-library/react": "^16.3.0",
|
"@testing-library/react": "^16.3.0",
|
||||||
"@testing-library/user-event": "^14.6.1",
|
"@testing-library/user-event": "^14.6.1",
|
||||||
"@types/react": "^18.3.22",
|
"@types/react": "^18.3.23",
|
||||||
"@vitejs/plugin-react": "^4.4.1",
|
"@vitejs/plugin-react": "^4.5.1",
|
||||||
"@vitejs/plugin-react-swc": "^3.9.0",
|
"@vitejs/plugin-react-swc": "^3.10.1",
|
||||||
|
"@vitest/ui": "^3.2.0",
|
||||||
"autoprefixer": "^10.4.21",
|
"autoprefixer": "^10.4.21",
|
||||||
"babel-loader": "^10.0.0",
|
"babel-loader": "^10.0.0",
|
||||||
"commitizen": "^4.3.1",
|
"commitizen": "^4.3.1",
|
||||||
@@ -109,19 +111,20 @@
|
|||||||
"css-loader": "^7.1.2",
|
"css-loader": "^7.1.2",
|
||||||
"daisyui": "^4.12.24",
|
"daisyui": "^4.12.24",
|
||||||
"dotenv": "^16.5.0",
|
"dotenv": "^16.5.0",
|
||||||
"eslint": "^9.27.0",
|
"eslint": "^9.28.0",
|
||||||
"eslint-plugin-prettier": "^5.4.0",
|
"eslint-plugin-prettier": "^5.4.1",
|
||||||
"eslint-plugin-react": "^7.37.5",
|
"eslint-plugin-react": "^7.37.5",
|
||||||
"lint-staged": "^16.0.0",
|
"jsdom": "^26.1.0",
|
||||||
"postcss": "^8.5.3",
|
"lint-staged": "^16.1.0",
|
||||||
|
"postcss": "^8.5.4",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"pretty-quick": "^4.1.1",
|
"pretty-quick": "^4.2.2",
|
||||||
"rollup-plugin-node-polyfills": "^0.2.1",
|
"rollup-plugin-node-polyfills": "^0.2.1",
|
||||||
"tailwindcss": "^3.4.17",
|
"tailwindcss": "^3.4.17",
|
||||||
"vite": "^6.3.5",
|
"vite": "^6.3.5",
|
||||||
"vite-plugin-svgr": "^4.3.0",
|
"vite-plugin-svgr": "^4.3.0",
|
||||||
"vite-tsconfig-paths": "^5.1.4",
|
"vite-tsconfig-paths": "^5.1.4",
|
||||||
"vitest": "^3.1.4"
|
"vitest": "^3.2.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "18 || 20 || 22"
|
"node": "18 || 20 || 22"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"header-news": "Neue Funktion: Benutzer des Teams-Plans können jetzt ihre eigenen AWS S3-Buckets für die Dateispeicherung integrieren",
|
"header-news": "Neue Funktion: Benutzer des Teams-Plans können jetzt ihre eigenen AWS S3-Buckets für die Dateispeicherung integrieren",
|
||||||
"header-news-btn": "Jetzt einrichten",
|
"header-news-btn": "Jetzt einrichten",
|
||||||
|
"sandbox-news": "Dies ist eine Sandbox-Umgebung. Bitte nicht für produktive Zwecke verwenden.",
|
||||||
"create-account": "Konto erstellen",
|
"create-account": "Konto erstellen",
|
||||||
"login": "Anmelden",
|
"login": "Anmelden",
|
||||||
"language": "Sprache",
|
"language": "Sprache",
|
||||||
@@ -360,6 +361,7 @@
|
|||||||
"date": "Datum",
|
"date": "Datum",
|
||||||
"text": "Text",
|
"text": "Text",
|
||||||
"text input": "Texteingabe",
|
"text input": "Texteingabe",
|
||||||
|
"cells": "Zellen",
|
||||||
"checkbox": "Checkbox",
|
"checkbox": "Checkbox",
|
||||||
"dropdown": "Dropdown",
|
"dropdown": "Dropdown",
|
||||||
"radio button": "Radiobutton",
|
"radio button": "Radiobutton",
|
||||||
@@ -414,10 +416,12 @@
|
|||||||
"options": "Optionen",
|
"options": "Optionen",
|
||||||
"minimun-check": "Minimale Anzahl",
|
"minimun-check": "Minimale Anzahl",
|
||||||
"maximum-check": "Maximale Anzahl",
|
"maximum-check": "Maximale Anzahl",
|
||||||
|
"cell-count": "Zellzahl",
|
||||||
"default-value": "Standardwert",
|
"default-value": "Standardwert",
|
||||||
"select": "Auswählen",
|
"select": "Auswählen",
|
||||||
"read-only": "Nur lesen",
|
"read-only": "Ist schreibgeschützt",
|
||||||
"hide-labels": "Labels ausblenden",
|
"hide-labels": "Labels ausblenden",
|
||||||
|
"layout": "Layout",
|
||||||
"checkbox": "Checkbox",
|
"checkbox": "Checkbox",
|
||||||
"alert": "Warnung",
|
"alert": "Warnung",
|
||||||
"zoom-in": "Vergrößern",
|
"zoom-in": "Vergrößern",
|
||||||
@@ -675,7 +679,7 @@
|
|||||||
"public-template-mssg-1": "Um OpenSign in Ihr React- oder Next.js-Projekt zu integrieren, führen Sie einfach den folgenden Befehl aus:",
|
"public-template-mssg-1": "Um OpenSign in Ihr React- oder Next.js-Projekt zu integrieren, führen Sie einfach den folgenden Befehl aus:",
|
||||||
"public-template-mssg-2": "Stellen Sie sicher, dass npm oder yarn in Ihrem Projekt eingerichtet ist. Wenn Sie Yarn verwenden, können Sie npm install durch yarn add @opensign/react ersetzen.",
|
"public-template-mssg-2": "Stellen Sie sicher, dass npm oder yarn in Ihrem Projekt eingerichtet ist. Wenn Sie Yarn verwenden, können Sie npm install durch yarn add @opensign/react ersetzen.",
|
||||||
"public-template-mssg-3": "Benötigen Sie weitere Details oder Beispiele?",
|
"public-template-mssg-3": "Benötigen Sie weitere Details oder Beispiele?",
|
||||||
"public-template-mssg-4": "Besuchen Sie die",
|
"public-template-mssg-4": "Besuchen Sie die ",
|
||||||
"public-template-mssg-5": " npm für die neuesten Updates, detaillierte Dokumentationen und Versionshistorie.",
|
"public-template-mssg-5": " npm für die neuesten Updates, detaillierte Dokumentationen und Versionshistorie.",
|
||||||
"public-template-mssg-6": "Bevor Sie diesen Code-Schnipsel verwenden können, müssen Sie diese Vorlage öffentlich machen.",
|
"public-template-mssg-6": "Bevor Sie diesen Code-Schnipsel verwenden können, müssen Sie diese Vorlage öffentlich machen.",
|
||||||
"public-template-mssg-7": "Bevor Sie einen öffentlichen Link generieren können, müssen Sie diese Vorlage öffentlich machen.",
|
"public-template-mssg-7": "Bevor Sie einen öffentlichen Link generieren können, müssen Sie diese Vorlage öffentlich machen.",
|
||||||
@@ -980,5 +984,50 @@
|
|||||||
"finish-mssg": "Sind Sie sicher, dass Sie das Dokument abschließen möchten?",
|
"finish-mssg": "Sind Sie sicher, dass Sie das Dokument abschließen möchten?",
|
||||||
"review": "Überprüfen",
|
"review": "Überprüfen",
|
||||||
"next-field": "Nächstes Feld",
|
"next-field": "Nächstes Feld",
|
||||||
"required-mssg": "{{leftRequiredWidget}} von {{totalWidget}} Feldern übrig"
|
"required-mssg": "{{leftRequiredWidget}} von {{totalWidget}} Feldern übrig",
|
||||||
|
"verify-document-signature": "Dokumentensignatur überprüfen",
|
||||||
|
"select-pdf-document": "PDF-Dokument auswählen",
|
||||||
|
"selected-file": "Ausgewählte Datei",
|
||||||
|
"verify-signature": "Signatur überprüfen",
|
||||||
|
"verification-status": "Überprüfungsstatus",
|
||||||
|
"verification-in-progress": "Überprüfung läuft...",
|
||||||
|
"verification-results-will-appear-here": "Überprüfungsergebnisse werden hier angezeigt",
|
||||||
|
"please-select-pdf": "Bitte wählen Sie eine gültige PDF-Datei aus",
|
||||||
|
"please-select-file-to-verify": "Bitte wählen Sie eine Datei zur Überprüfung aus",
|
||||||
|
"no-signature-found": "Keine Signatur im Dokument gefunden",
|
||||||
|
"error-verifying-pdf": "Fehler beim Überprüfen der PDF",
|
||||||
|
"signature-valid-basic": "Signatur ist gültig",
|
||||||
|
"signature-invalid-basic": "Signatur ist ungültig",
|
||||||
|
"all-signatures-verified-convincing": "Dokument überprüft: Alle Signaturen wurden erfolgreich validiert.",
|
||||||
|
"some-signatures-invalid-basic": "Einige Signaturen sind ungültig",
|
||||||
|
"no-signatures-processed": "Keine Signaturen verarbeitet",
|
||||||
|
"unnamed-signature-field": "Unbenanntes Signaturfeld",
|
||||||
|
"error-processing-signature": "Fehler beim Verarbeiten der Signatur",
|
||||||
|
"signer-info-not-available": "Signaturinformationen nicht verfügbar",
|
||||||
|
"cert-validity-not-checked": "Gültigkeit des Zertifikats nicht geprüft",
|
||||||
|
"valid": "Gültig",
|
||||||
|
"expired-or-not-yet-valid": "Abgelaufen oder noch nicht gültig",
|
||||||
|
"valid-from": "Gültig von",
|
||||||
|
"to": "bis",
|
||||||
|
"signer": "Unterzeichner",
|
||||||
|
"issuer": "Aussteller",
|
||||||
|
"not-available": "Nicht verfügbar",
|
||||||
|
"not-performed": "Nicht durchgeführt",
|
||||||
|
"missing-acrofield-dict": "Fehlendes Acrofield-Wörterbuch",
|
||||||
|
"signature-dictionary-not-found-or-invalid": "Signaturwörterbuch nicht gefunden oder ungültig",
|
||||||
|
"missing-or-invalid-byterange": "Fehlender oder ungültiger ByteRange",
|
||||||
|
"missing-or-invalid-contents": "Fehlender oder ungültiger Inhalt",
|
||||||
|
"missing-signature-contents": "Fehlender Signaturinhalt",
|
||||||
|
"invalid-signature-hex-format": "Ungültiges Signatur-Hex-Format",
|
||||||
|
"unsupported-signature-format-not-signeddata": "Nicht unterstütztes Signaturformat - nicht SignedData",
|
||||||
|
"signer-certificate-not-found": "Unterzeichnerzertifikat nicht gefunden",
|
||||||
|
"no-certificates-in-signature": "Keine Zertifikate in der Signatur",
|
||||||
|
"no-signer-info-in-pkcs7": "Keine Signaturinformationen in PKCS#7",
|
||||||
|
"could-not-parse-signer-info": "Signaturinformationen konnten nicht analysiert werden",
|
||||||
|
"not-calculated": "Nicht berechnet",
|
||||||
|
"not-found-in-signature": "Nicht in Signatur gefunden",
|
||||||
|
"readonly-textinput-error": "Schreibgeschütztes Text-Widget muss einen Standardwert haben oder optional sein.",
|
||||||
|
"readonly-dropdown-error": "Schreibgeschütztes Dropdown-Widget muss einen Standardwert haben oder optional sein.",
|
||||||
|
"readonly-radiobtn-error": "Schreibgeschütztes Optionsfeld-Widget muss einen Standardwert haben oder optional sein.",
|
||||||
|
"choose-one":"Wählen Sie eine aus"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"header-news": "New feature: Protect your account with Two-Factor Authentication (2FA) and enjoy the future of login with Passkeys — no passwords needed.",
|
"header-news": "New feature: Protect your account with Two-Factor Authentication (2FA) and enjoy the future of login with Passkeys — no passwords needed.",
|
||||||
"header-news-btn": "Setup now",
|
"header-news-btn": "Setup now",
|
||||||
|
"sandbox-news": "This is a sandbox environment. Please do not use it for production purposes.",
|
||||||
"create-account": "Create account",
|
"create-account": "Create account",
|
||||||
"login": "Login",
|
"login": "Login",
|
||||||
"language": "Language",
|
"language": "Language",
|
||||||
@@ -360,6 +361,7 @@
|
|||||||
"date": "date",
|
"date": "date",
|
||||||
"text": "text",
|
"text": "text",
|
||||||
"text input": "text input",
|
"text input": "text input",
|
||||||
|
"cells": "cells",
|
||||||
"checkbox": "checkbox",
|
"checkbox": "checkbox",
|
||||||
"dropdown": "dropdown",
|
"dropdown": "dropdown",
|
||||||
"radio button": "radio button",
|
"radio button": "radio button",
|
||||||
@@ -414,10 +416,12 @@
|
|||||||
"options": "Options",
|
"options": "Options",
|
||||||
"minimun-check": "Minimun check",
|
"minimun-check": "Minimun check",
|
||||||
"maximum-check": "Maximum check",
|
"maximum-check": "Maximum check",
|
||||||
|
"cell-count": "Cell count",
|
||||||
"default-value": "Default value",
|
"default-value": "Default value",
|
||||||
"select": "Select",
|
"select": "Select",
|
||||||
"read-only": "Is read only",
|
"read-only": "read only",
|
||||||
"hide-labels": "Hide labels",
|
"hide-labels": "Hide labels",
|
||||||
|
"layout": "Layout",
|
||||||
"checkbox": "Checkbox",
|
"checkbox": "Checkbox",
|
||||||
"alert": "Alert",
|
"alert": "Alert",
|
||||||
"zoom-in": "Zoom in",
|
"zoom-in": "Zoom in",
|
||||||
@@ -675,7 +679,7 @@
|
|||||||
"public-template-mssg-1": "To integrate OpenSign into your React or Next.js project, simply run the following command:",
|
"public-template-mssg-1": "To integrate OpenSign into your React or Next.js project, simply run the following command:",
|
||||||
"public-template-mssg-2": "Ensure you have npm or yarn set up in your project. If you're using Yarn, you can replace npm install with yarn add @opensign/react.",
|
"public-template-mssg-2": "Ensure you have npm or yarn set up in your project. If you're using Yarn, you can replace npm install with yarn add @opensign/react.",
|
||||||
"public-template-mssg-3": "Need more details or examples?",
|
"public-template-mssg-3": "Need more details or examples?",
|
||||||
"public-template-mssg-4": "Visit the",
|
"public-template-mssg-4": "Visit the ",
|
||||||
"public-template-mssg-5": " npm for the latest updates, detailed documentation, and version history.",
|
"public-template-mssg-5": " npm for the latest updates, detailed documentation, and version history.",
|
||||||
"public-template-mssg-6": "Before you can use this code snippet, you must make this template public.",
|
"public-template-mssg-6": "Before you can use this code snippet, you must make this template public.",
|
||||||
"public-template-mssg-7": "Before you can generate a public link you must make this template public.",
|
"public-template-mssg-7": "Before you can generate a public link you must make this template public.",
|
||||||
@@ -980,5 +984,50 @@
|
|||||||
"finish-mssg":" Are you sure you want to finish the document ?",
|
"finish-mssg":" Are you sure you want to finish the document ?",
|
||||||
"review":"Review",
|
"review":"Review",
|
||||||
"next-field":"Next Field",
|
"next-field":"Next Field",
|
||||||
"required-mssg":"{{leftRequiredWidget}} of {{totalWidget}} fields left"
|
"required-mssg":"{{leftRequiredWidget}} of {{totalWidget}} fields left",
|
||||||
|
"verify-document-signature": "Verify Document Signature",
|
||||||
|
"select-pdf-document": "Select PDF Document",
|
||||||
|
"selected-file": "Selected file",
|
||||||
|
"verify-signature": "Verify Signature",
|
||||||
|
"verification-status": "Verification Status",
|
||||||
|
"verification-in-progress": "Verification in progress...",
|
||||||
|
"verification-results-will-appear-here": "Verification results will appear here",
|
||||||
|
"please-select-pdf": "Please select a valid PDF file",
|
||||||
|
"please-select-file-to-verify": "Please select a file to verify",
|
||||||
|
"no-signature-found": "No signature found in the document",
|
||||||
|
"error-verifying-pdf": "Error verifying PDF",
|
||||||
|
"signature-valid-basic": "Signature is valid",
|
||||||
|
"signature-invalid-basic": "Signature is invalid",
|
||||||
|
"all-signatures-verified-convincing": "Document Verified: All signatures have been successfully validated.",
|
||||||
|
"some-signatures-invalid-basic": "Some signatures are invalid",
|
||||||
|
"no-signatures-processed": "No signatures were processed",
|
||||||
|
"unnamed-signature-field": "Unnamed Signature Field",
|
||||||
|
"error-processing-signature": "Error processing signature",
|
||||||
|
"signer-info-not-available": "Signer information not available",
|
||||||
|
"cert-validity-not-checked": "Certificate validity not checked",
|
||||||
|
"valid": "Valid",
|
||||||
|
"expired-or-not-yet-valid": "Expired or not yet valid",
|
||||||
|
"valid-from": "Valid from",
|
||||||
|
"to": "to",
|
||||||
|
"signer": "Signer",
|
||||||
|
"issuer": "Issuer",
|
||||||
|
"not-available": "Not available",
|
||||||
|
"not-performed": "Not performed",
|
||||||
|
"missing-acrofield-dict": "Missing acrofield dictionary",
|
||||||
|
"signature-dictionary-not-found-or-invalid": "Signature dictionary not found or invalid",
|
||||||
|
"missing-or-invalid-byterange": "Missing or invalid ByteRange",
|
||||||
|
"missing-or-invalid-contents": "Missing or invalid Contents",
|
||||||
|
"missing-signature-contents": "Missing signature contents",
|
||||||
|
"invalid-signature-hex-format": "Invalid signature hex format",
|
||||||
|
"unsupported-signature-format-not-signeddata": "Unsupported signature format - not SignedData",
|
||||||
|
"signer-certificate-not-found": "Signer certificate not found",
|
||||||
|
"no-certificates-in-signature": "No certificates in signature",
|
||||||
|
"no-signer-info-in-pkcs7": "No signer info in PKCS#7",
|
||||||
|
"could-not-parse-signer-info": "Could not parse signer info",
|
||||||
|
"not-calculated": "Not calculated",
|
||||||
|
"not-found-in-signature": "Not found in signature",
|
||||||
|
"readonly-textinput-error": "Read-only text widget must have a default value or you can make it optional.",
|
||||||
|
"readonly-dropdown-error": "Read-only dropdown widget must have a default value or you can make it optional.",
|
||||||
|
"readonly-radiobtn-error": "Read-only radio button widget must have a default value or you can make it optional.",
|
||||||
|
"choose-one":"Choose One"
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"header-news": "Nueva característica: los usuarios del plan Teams ahora pueden integrar sus propios depósitos de AWS S3 para el almacenamiento de archivos",
|
"header-news": "Nueva característica: los usuarios del plan Teams ahora pueden integrar sus propios depósitos de AWS S3 para el almacenamiento de archivos",
|
||||||
"header-news-btn": "Configurar ahora",
|
"header-news-btn": "Configurar ahora",
|
||||||
|
"sandbox-news": "Este es un entorno sandbox. Por favor, no lo utilice con fines de producción.",
|
||||||
"create-account": "Crear cuenta",
|
"create-account": "Crear cuenta",
|
||||||
"login": "Iniciar sesión",
|
"login": "Iniciar sesión",
|
||||||
"language": "Idioma",
|
"language": "Idioma",
|
||||||
@@ -361,6 +362,7 @@
|
|||||||
"date": "fecha",
|
"date": "fecha",
|
||||||
"text": "texto",
|
"text": "texto",
|
||||||
"text input": "entrada de texto",
|
"text input": "entrada de texto",
|
||||||
|
"cells": "células",
|
||||||
"checkbox": "casilla",
|
"checkbox": "casilla",
|
||||||
"dropdown": "desplegable",
|
"dropdown": "desplegable",
|
||||||
"radio button": "botón de radio",
|
"radio button": "botón de radio",
|
||||||
@@ -415,10 +417,12 @@
|
|||||||
"options": "Opciones",
|
"options": "Opciones",
|
||||||
"minimun-check": "Chequeo mínimo",
|
"minimun-check": "Chequeo mínimo",
|
||||||
"maximum-check": "Chequeo máximo",
|
"maximum-check": "Chequeo máximo",
|
||||||
|
"cell-count": "recuento de células",
|
||||||
"default-value": "Valor por defecto",
|
"default-value": "Valor por defecto",
|
||||||
"select": "Seleccionar",
|
"select": "Seleccionar",
|
||||||
"read-only": "Es de solo lectura",
|
"read-only": "Es de solo lectura",
|
||||||
"hide-labels": "Esconder etiquetas",
|
"hide-labels": "Esconder etiquetas",
|
||||||
|
"layout": "Diseño",
|
||||||
"checkbox": "Casilla",
|
"checkbox": "Casilla",
|
||||||
"alert": "Alerta",
|
"alert": "Alerta",
|
||||||
"zoom-in": "Acercar",
|
"zoom-in": "Acercar",
|
||||||
@@ -675,7 +679,7 @@
|
|||||||
"public-template-mssg-1": "Para integrar OpenSign a tu proyecto React o Next.js, simplemente ejecuta los siguientes comandos:",
|
"public-template-mssg-1": "Para integrar OpenSign a tu proyecto React o Next.js, simplemente ejecuta los siguientes comandos:",
|
||||||
"public-template-mssg-2": "Asegúrate de tener «npm» o «yarn» configurado en tu proyecto. Si estás usando «yarn», puedes reemplazar «npm install» con «yarn add @opensign/react».",
|
"public-template-mssg-2": "Asegúrate de tener «npm» o «yarn» configurado en tu proyecto. Si estás usando «yarn», puedes reemplazar «npm install» con «yarn add @opensign/react».",
|
||||||
"public-template-mssg-3": "¿Necesitas más detalles o ejemplos?",
|
"public-template-mssg-3": "¿Necesitas más detalles o ejemplos?",
|
||||||
"public-template-mssg-4": "Visita la",
|
"public-template-mssg-4": "Visita la ",
|
||||||
"public-template-mssg-5": " «npm» para las últimas actualizaciones, documentación detallada e historial de versiones.",
|
"public-template-mssg-5": " «npm» para las últimas actualizaciones, documentación detallada e historial de versiones.",
|
||||||
"public-template-mssg-6": "Antes de que puedas usar este fragmento de código, debes convertir esta plantilla en pública.",
|
"public-template-mssg-6": "Antes de que puedas usar este fragmento de código, debes convertir esta plantilla en pública.",
|
||||||
"public-template-mssg-7": "Antes de poder generar un enlace público, debes hacer que esta plantilla sea pública.",
|
"public-template-mssg-7": "Antes de poder generar un enlace público, debes hacer que esta plantilla sea pública.",
|
||||||
@@ -980,5 +984,50 @@
|
|||||||
"finish-mssg": "¿Está seguro de que desea finalizar el documento?",
|
"finish-mssg": "¿Está seguro de que desea finalizar el documento?",
|
||||||
"review": "Revisar",
|
"review": "Revisar",
|
||||||
"next-field": "Siguiente campo",
|
"next-field": "Siguiente campo",
|
||||||
"required-mssg": "{{leftRequiredWidget}} de {{totalWidget}} campos restantes"
|
"required-mssg": "{{leftRequiredWidget}} de {{totalWidget}} campos restantes",
|
||||||
|
"verify-document-signature": "Verificar firma del documento",
|
||||||
|
"select-pdf-document": "Seleccionar documento PDF",
|
||||||
|
"selected-file": "Archivo seleccionado",
|
||||||
|
"verify-signature": "Verificar firma",
|
||||||
|
"verification-status": "Estado de verificación",
|
||||||
|
"verification-in-progress": "Verificación en curso...",
|
||||||
|
"verification-results-will-appear-here": "Los resultados de la verificación aparecerán aquí",
|
||||||
|
"please-select-pdf": "Por favor, seleccione un archivo PDF válido",
|
||||||
|
"please-select-file-to-verify": "Por favor, seleccione un archivo para verificar",
|
||||||
|
"no-signature-found": "No se encontró ninguna firma en el documento",
|
||||||
|
"error-verifying-pdf": "Error al verificar el PDF",
|
||||||
|
"signature-valid-basic": "La firma es válida",
|
||||||
|
"signature-invalid-basic": "La firma no es válida",
|
||||||
|
"all-signatures-verified-convincing": "Documento verificado: Todas las firmas han sido validadas exitosamente.",
|
||||||
|
"some-signatures-invalid-basic": "Algunas firmas no son válidas",
|
||||||
|
"no-signatures-processed": "No se procesaron firmas",
|
||||||
|
"unnamed-signature-field": "Campo de firma sin nombre",
|
||||||
|
"error-processing-signature": "Error al procesar la firma",
|
||||||
|
"signer-info-not-available": "Información del firmante no disponible",
|
||||||
|
"cert-validity-not-checked": "Validez del certificado no verificada",
|
||||||
|
"valid": "Válido",
|
||||||
|
"expired-or-not-yet-valid": "Caducado o aún no válido",
|
||||||
|
"valid-from": "Válido desde",
|
||||||
|
"to": "hasta",
|
||||||
|
"signer": "Firmante",
|
||||||
|
"issuer": "Emisor",
|
||||||
|
"not-available": "No disponible",
|
||||||
|
"not-performed": "No realizado",
|
||||||
|
"missing-acrofield-dict": "Falta el diccionario Acrofield",
|
||||||
|
"signature-dictionary-not-found-or-invalid": "Diccionario de firmas no encontrado o inválido",
|
||||||
|
"missing-or-invalid-byterange": "ByteRange faltante o inválido",
|
||||||
|
"missing-or-invalid-contents": "Contenido faltante o inválido",
|
||||||
|
"missing-signature-contents": "Falta el contenido de la firma",
|
||||||
|
"invalid-signature-hex-format": "Formato hexadecimal de firma inválido",
|
||||||
|
"unsupported-signature-format-not-signeddata": "Formato de firma no compatible - no SignedData",
|
||||||
|
"signer-certificate-not-found": "Certificado del firmante no encontrado",
|
||||||
|
"no-certificates-in-signature": "No hay certificados en la firma",
|
||||||
|
"no-signer-info-in-pkcs7": "No hay información del firmante en PKCS#7",
|
||||||
|
"could-not-parse-signer-info": "No se pudo analizar la información del firmante",
|
||||||
|
"not-calculated": "No calculado",
|
||||||
|
"not-found-in-signature": "No encontrado en la firma",
|
||||||
|
"readonly-textinput-error": "El widget de texto de solo lectura debe tener un valor predeterminado o puede hacerse opcional.",
|
||||||
|
"readonly-dropdown-error": "El widget desplegable de solo lectura debe tener un valor predeterminado o puede hacerse opcional.",
|
||||||
|
"readonly-radiobtn-error": "El widget de botón de opción de solo lectura debe tener un valor predeterminado o puede hacerse opcional.",
|
||||||
|
"choose-one":"Elige uno"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"header-news": "Nouvelle fonctionnalité : les utilisateurs du forfait Teams peuvent désormais intégrer leurs propres compartiments AWS S3 pour le stockage de fichiers",
|
"header-news": "Nouvelle fonctionnalité : les utilisateurs du forfait Teams peuvent désormais intégrer leurs propres compartiments AWS S3 pour le stockage de fichiers",
|
||||||
"header-news-btn": "Configurer maintenant",
|
"header-news-btn": "Configurer maintenant",
|
||||||
|
"sandbox-news": "Ceci est un environnement sandbox. Veuillez ne pas l'utiliser à des fins de production.",
|
||||||
"create-account": "Créer un compte",
|
"create-account": "Créer un compte",
|
||||||
"login": "Se Connecter",
|
"login": "Se Connecter",
|
||||||
"language": "Langue",
|
"language": "Langue",
|
||||||
@@ -360,6 +361,7 @@
|
|||||||
"date": "date",
|
"date": "date",
|
||||||
"text": "texte",
|
"text": "texte",
|
||||||
"text input": "saisie de texte",
|
"text input": "saisie de texte",
|
||||||
|
"cells": "cellules",
|
||||||
"checkbox": "case à cocher",
|
"checkbox": "case à cocher",
|
||||||
"dropdown": "dérouler",
|
"dropdown": "dérouler",
|
||||||
"radio button": "bouton radio",
|
"radio button": "bouton radio",
|
||||||
@@ -414,10 +416,12 @@
|
|||||||
"options": "Possibilités",
|
"options": "Possibilités",
|
||||||
"minimun-check": "Vérification minimale",
|
"minimun-check": "Vérification minimale",
|
||||||
"maximum-check": "Contrôle maximum",
|
"maximum-check": "Contrôle maximum",
|
||||||
|
"cell-count": "numération cellulaire",
|
||||||
"default-value": "Valeur par défaut",
|
"default-value": "Valeur par défaut",
|
||||||
"select": "Sélectionner",
|
"select": "Sélectionner",
|
||||||
"read-only": "Est en lecture seule",
|
"read-only": "Est en lecture seule",
|
||||||
"hide-labels": "Masquer les étiquettes",
|
"hide-labels": "Masquer les étiquettes",
|
||||||
|
"layout": "Disposition",
|
||||||
"checkbox": "Case à cocher",
|
"checkbox": "Case à cocher",
|
||||||
"alert": "Alerte",
|
"alert": "Alerte",
|
||||||
"zoom-in": "Agrandir",
|
"zoom-in": "Agrandir",
|
||||||
@@ -675,7 +679,7 @@
|
|||||||
"public-template-mssg-1": "Pour intégrer OpenSign dans votre projet React ou Next.js, exécutez simplement la commande suivante :",
|
"public-template-mssg-1": "Pour intégrer OpenSign dans votre projet React ou Next.js, exécutez simplement la commande suivante :",
|
||||||
"public-template-mssg-2": "Assurez-vous que npm ou Yarn est configuré dans votre projet. Si vous utilisez Yarn, vous pouvez remplacer npm install par Yarn Add @opensign/react.",
|
"public-template-mssg-2": "Assurez-vous que npm ou Yarn est configuré dans votre projet. Si vous utilisez Yarn, vous pouvez remplacer npm install par Yarn Add @opensign/react.",
|
||||||
"public-template-mssg-3": "Besoin de plus de détails ou d'exemples ?",
|
"public-template-mssg-3": "Besoin de plus de détails ou d'exemples ?",
|
||||||
"public-template-mssg-4": "Visitez le",
|
"public-template-mssg-4": "Visitez le ",
|
||||||
"public-template-mssg-5": "npm pour les dernières mises à jour, une documentation détaillée et l'historique des versions.",
|
"public-template-mssg-5": "npm pour les dernières mises à jour, une documentation détaillée et l'historique des versions.",
|
||||||
"public-template-mssg-6": "Avant de pouvoir utiliser cet extrait de code, vous devez rendre ce modèle public.",
|
"public-template-mssg-6": "Avant de pouvoir utiliser cet extrait de code, vous devez rendre ce modèle public.",
|
||||||
"public-template-mssg-7": "Avant de pouvoir générer un lien public, vous devez rendre ce modèle public.",
|
"public-template-mssg-7": "Avant de pouvoir générer un lien public, vous devez rendre ce modèle public.",
|
||||||
@@ -980,5 +984,50 @@
|
|||||||
"finish-mssg": "Êtes-vous sûr de vouloir terminer le document ?",
|
"finish-mssg": "Êtes-vous sûr de vouloir terminer le document ?",
|
||||||
"review": "Revoir",
|
"review": "Revoir",
|
||||||
"next-field": "Champ suivant",
|
"next-field": "Champ suivant",
|
||||||
"required-mssg":"{{leftRequiredWidget}} champs sur {{totalWidget}} restants"
|
"required-mssg":"{{leftRequiredWidget}} champs sur {{totalWidget}} restants",
|
||||||
|
"verify-document-signature": "Vérifier la signature du document",
|
||||||
|
"select-pdf-document": "Sélectionner le document PDF",
|
||||||
|
"selected-file": "Fichier sélectionné",
|
||||||
|
"verify-signature": "Vérifier la signature",
|
||||||
|
"verification-status": "État de la vérification",
|
||||||
|
"verification-in-progress": "Vérification en cours...",
|
||||||
|
"verification-results-will-appear-here": "Les résultats de la vérification apparaîtront ici",
|
||||||
|
"please-select-pdf": "Veuillez sélectionner un fichier PDF valide",
|
||||||
|
"please-select-file-to-verify": "Veuillez sélectionner un fichier à vérifier",
|
||||||
|
"no-signature-found": "Aucune signature trouvée dans le document",
|
||||||
|
"error-verifying-pdf": "Erreur lors de la vérification du PDF",
|
||||||
|
"signature-valid-basic": "La signature est valide",
|
||||||
|
"signature-invalid-basic": "La signature est invalide",
|
||||||
|
"all-signatures-verified-convincing": "Document vérifié : Toutes les signatures ont été validées avec succès.",
|
||||||
|
"some-signatures-invalid-basic": "Certaines signatures sont invalides",
|
||||||
|
"no-signatures-processed": "Aucune signature traitée",
|
||||||
|
"unnamed-signature-field": "Champ de signature sans nom",
|
||||||
|
"error-processing-signature": "Erreur lors du traitement de la signature",
|
||||||
|
"signer-info-not-available": "Informations sur le signataire non disponibles",
|
||||||
|
"cert-validity-not-checked": "Validité du certificat non vérifiée",
|
||||||
|
"valid": "Valide",
|
||||||
|
"expired-or-not-yet-valid": "Expiré ou pas encore valide",
|
||||||
|
"valid-from": "Valide du",
|
||||||
|
"to": "au",
|
||||||
|
"signer": "Signataire",
|
||||||
|
"issuer": "Émetteur",
|
||||||
|
"not-available": "Non disponible",
|
||||||
|
"not-performed": "Non effectué",
|
||||||
|
"missing-acrofield-dict": "Dictionnaire Acrofield manquant",
|
||||||
|
"signature-dictionary-not-found-or-invalid": "Dictionnaire de signatures introuvable ou invalide",
|
||||||
|
"missing-or-invalid-byterange": "ByteRange manquant ou invalide",
|
||||||
|
"missing-or-invalid-contents": "Contenu manquant ou invalide",
|
||||||
|
"missing-signature-contents": "Contenu de la signature manquant",
|
||||||
|
"invalid-signature-hex-format": "Format hexadécimal de signature invalide",
|
||||||
|
"unsupported-signature-format-not-signeddata": "Format de signature non pris en charge - pas SignedData",
|
||||||
|
"signer-certificate-not-found": "Certificat du signataire introuvable",
|
||||||
|
"no-certificates-in-signature": "Aucun certificat dans la signature",
|
||||||
|
"no-signer-info-in-pkcs7": "Aucune information sur le signataire dans PKCS#7",
|
||||||
|
"could-not-parse-signer-info": "Impossible d'analyser les informations sur le signataire",
|
||||||
|
"not-calculated": "Non calculé",
|
||||||
|
"not-found-in-signature": "Introuvable dans la signature",
|
||||||
|
"readonly-textinput-error": "Le widget de texte en lecture seule doit avoir une valeur par défaut ou être rendu optionnel.",
|
||||||
|
"readonly-dropdown-error": "Le widget déroulant en lecture seule doit avoir une valeur par défaut ou être rendu optionnel.",
|
||||||
|
"readonly-radiobtn-error": "Le widget bouton radio en lecture seule doit avoir une valeur par défaut ou être rendu optionnel.",
|
||||||
|
"choose-one":"Choisissez-en un"
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"header-news": "Nuova funzionalità: Gli utenti del piano Teams possono ora integrare i propri bucket AWS S3 per l'archiviazione dei file",
|
"header-news": "Nuova funzionalità: Gli utenti del piano Teams possono ora integrare i propri bucket AWS S3 per l'archiviazione dei file",
|
||||||
"header-news-btn": "Configura Ora",
|
"header-news-btn": "Configura Ora",
|
||||||
|
"sandbox-news": "Questo è un ambiente sandbox. Si prega di non utilizzarlo per scopi di produzione.",
|
||||||
"create-account": "Crea Account",
|
"create-account": "Crea Account",
|
||||||
"login": "Accedi",
|
"login": "Accedi",
|
||||||
"language": "Lingua",
|
"language": "Lingua",
|
||||||
@@ -360,6 +361,7 @@
|
|||||||
"date": "data",
|
"date": "data",
|
||||||
"text": "testo",
|
"text": "testo",
|
||||||
"text input": "campo di testo",
|
"text input": "campo di testo",
|
||||||
|
"cells": "cellule",
|
||||||
"checkbox": "casella di controllo",
|
"checkbox": "casella di controllo",
|
||||||
"dropdown": "menu a tendina",
|
"dropdown": "menu a tendina",
|
||||||
"radio button": "pulsante di opzione",
|
"radio button": "pulsante di opzione",
|
||||||
@@ -414,10 +416,12 @@
|
|||||||
"options": "Opzioni",
|
"options": "Opzioni",
|
||||||
"minimun-check": "Controllo minimo",
|
"minimun-check": "Controllo minimo",
|
||||||
"maximum-check": "Controllo massimo",
|
"maximum-check": "Controllo massimo",
|
||||||
|
"cell-count": "conteggio delle cellule",
|
||||||
"default-value": "Valore predefinita",
|
"default-value": "Valore predefinita",
|
||||||
"select": "Seleziona",
|
"select": "Seleziona",
|
||||||
"read-only": "È solo lettura",
|
"read-only": "È di sola lettura",
|
||||||
"hide-labels": "Nascondi etichette",
|
"hide-labels": "Nascondi etichette",
|
||||||
|
"layout": "Layout",
|
||||||
"checkbox": "Casella di controllo",
|
"checkbox": "Casella di controllo",
|
||||||
"alert": "Avviso",
|
"alert": "Avviso",
|
||||||
"zoom-in": "Ingrandisci",
|
"zoom-in": "Ingrandisci",
|
||||||
@@ -675,7 +679,7 @@
|
|||||||
"public-template-mssg-1": "Per integrare OpenSign nel tuo progetto React o Next.js, esegui semplicemente il seguente comando:",
|
"public-template-mssg-1": "Per integrare OpenSign nel tuo progetto React o Next.js, esegui semplicemente il seguente comando:",
|
||||||
"public-template-mssg-2": "Assicurati di avere npm o yarn configurato nel tuo progetto. Se usi Yarn, puoi sostituire npm install con yarn add @opensign/react.",
|
"public-template-mssg-2": "Assicurati di avere npm o yarn configurato nel tuo progetto. Se usi Yarn, puoi sostituire npm install con yarn add @opensign/react.",
|
||||||
"public-template-mssg-3": "Hai bisogno di maggiori dettagli o esempi?",
|
"public-template-mssg-3": "Hai bisogno di maggiori dettagli o esempi?",
|
||||||
"public-template-mssg-4": "Visita il",
|
"public-template-mssg-4": "Visita il ",
|
||||||
"public-template-mssg-5": " npm per gli aggiornamenti più recenti, documentazione dettagliata e cronologia delle versioni.",
|
"public-template-mssg-5": " npm per gli aggiornamenti più recenti, documentazione dettagliata e cronologia delle versioni.",
|
||||||
"public-template-mssg-6": "Prima di poter utilizzare questo frammento di codice, devi rendere questo modello pubblico.",
|
"public-template-mssg-6": "Prima di poter utilizzare questo frammento di codice, devi rendere questo modello pubblico.",
|
||||||
"public-template-mssg-7": "Prima di poter generare un link pubblico, devi rendere questo modello pubblico.",
|
"public-template-mssg-7": "Prima di poter generare un link pubblico, devi rendere questo modello pubblico.",
|
||||||
@@ -980,5 +984,50 @@
|
|||||||
"finish-mssg": "Sei sicuro di voler completare il documento?",
|
"finish-mssg": "Sei sicuro di voler completare il documento?",
|
||||||
"review": "Rivedere",
|
"review": "Rivedere",
|
||||||
"next-field": "Campo successivo",
|
"next-field": "Campo successivo",
|
||||||
"required-mssg":"{{leftRequiredWidget}} di {{totalWidget}} campi rimanenti"
|
"required-mssg":"{{leftRequiredWidget}} di {{totalWidget}} campi rimanenti",
|
||||||
|
"verify-document-signature": "Verifica firma documento",
|
||||||
|
"select-pdf-document": "Seleziona documento PDF",
|
||||||
|
"selected-file": "File selezionato",
|
||||||
|
"verify-signature": "Verifica firma",
|
||||||
|
"verification-status": "Stato verifica",
|
||||||
|
"verification-in-progress": "Verifica in corso...",
|
||||||
|
"verification-results-will-appear-here": "I risultati della verifica appariranno qui",
|
||||||
|
"please-select-pdf": "Seleziona un file PDF valido",
|
||||||
|
"please-select-file-to-verify": "Seleziona un file da verificare",
|
||||||
|
"no-signature-found": "Nessuna firma trovata nel documento",
|
||||||
|
"error-verifying-pdf": "Errore durante la verifica del PDF",
|
||||||
|
"signature-valid-basic": "La firma è valida",
|
||||||
|
"signature-invalid-basic": "La firma non è valida",
|
||||||
|
"all-signatures-verified-convincing": "Documento Verificato: Tutte le firme sono state validate con successo.",
|
||||||
|
"some-signatures-invalid-basic": "Alcune firme non sono valide",
|
||||||
|
"no-signatures-processed": "Nessuna firma elaborata",
|
||||||
|
"unnamed-signature-field": "Campo firma senza nome",
|
||||||
|
"error-processing-signature": "Errore durante l'elaborazione della firma",
|
||||||
|
"signer-info-not-available": "Informazioni firmatario non disponibili",
|
||||||
|
"cert-validity-not-checked": "Validità certificato non verificata",
|
||||||
|
"valid": "Valido",
|
||||||
|
"expired-or-not-yet-valid": "Scaduto o non ancora valido",
|
||||||
|
"valid-from": "Valido dal",
|
||||||
|
"to": "al",
|
||||||
|
"signer": "Firmatario",
|
||||||
|
"issuer": "Emittente",
|
||||||
|
"not-available": "Non disponibile",
|
||||||
|
"not-performed": "Non eseguito",
|
||||||
|
"missing-acrofield-dict": "Dizionario Acrofield mancante",
|
||||||
|
"signature-dictionary-not-found-or-invalid": "Dizionario firme non trovato o non valido",
|
||||||
|
"missing-or-invalid-byterange": "ByteRange mancante o non valido",
|
||||||
|
"missing-or-invalid-contents": "Contenuto mancante o non valido",
|
||||||
|
"missing-signature-contents": "Contenuto firma mancante",
|
||||||
|
"invalid-signature-hex-format": "Formato esadecimale firma non valido",
|
||||||
|
"unsupported-signature-format-not-signeddata": "Formato firma non supportato - non SignedData",
|
||||||
|
"signer-certificate-not-found": "Certificato firmatario non trovato",
|
||||||
|
"no-certificates-in-signature": "Nessun certificato nella firma",
|
||||||
|
"no-signer-info-in-pkcs7": "Nessuna informazione firmatario in PKCS#7",
|
||||||
|
"could-not-parse-signer-info": "Impossibile analizzare le informazioni del firmatario",
|
||||||
|
"not-calculated": "Non calcolato",
|
||||||
|
"not-found-in-signature": "Non trovato nella firma",
|
||||||
|
"readonly-textinput-error": "Il widget di testo di sola lettura deve avere un valore predefinito oppure può essere reso opzionale.",
|
||||||
|
"readonly-dropdown-error": "Il widget a discesa di sola lettura deve avere un valore predefinito oppure può essere reso opzionale.",
|
||||||
|
"readonly-radiobtn-error": "Il widget pulsante di opzione di sola lettura deve avere un valore predefinito oppure può essere reso opzionale.",
|
||||||
|
"choose-one":"Scegline uno"
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-11
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useEffect, lazy } from "react";
|
import { useState, useEffect, lazy } from "react";
|
||||||
import { Routes, Route, BrowserRouter } from "react-router";
|
import { Routes, Route, BrowserRouter } from "react-router";
|
||||||
import { pdfjs } from "react-pdf";
|
import { pdfjs } from "react-pdf";
|
||||||
import Form from "./pages/Form";
|
import Form from "./pages/Form";
|
||||||
@@ -30,7 +30,7 @@ const AddAdmin = lazy(() => import("./pages/AddAdmin"));
|
|||||||
const UpdateExistUserAdmin = lazy(() => import("./pages/UpdateExistUserAdmin"));
|
const UpdateExistUserAdmin = lazy(() => import("./pages/UpdateExistUserAdmin"));
|
||||||
const Preferences = lazy(() => import("./pages/Preferences"));
|
const Preferences = lazy(() => import("./pages/Preferences"));
|
||||||
const Login = lazy(() => import("./pages/Login"));
|
const Login = lazy(() => import("./pages/Login"));
|
||||||
|
const VerifyDocument = lazy(() => import("./pages/VerifyDocument"));
|
||||||
pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/legacy/build/pdf.worker.min.mjs`;
|
pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/legacy/build/pdf.worker.min.mjs`;
|
||||||
const AppLoader = () => {
|
const AppLoader = () => {
|
||||||
return (
|
return (
|
||||||
@@ -106,10 +106,10 @@ function App() {
|
|||||||
element={<LazyPage Page={GuestLogin} />}
|
element={<LazyPage Page={GuestLogin} />}
|
||||||
/>
|
/>
|
||||||
<Route path="/debugpdf" element={<LazyPage Page={DebugPdf} />} />
|
<Route path="/debugpdf" element={<LazyPage Page={DebugPdf} />} />
|
||||||
<Route
|
<Route
|
||||||
path="/forgetpassword"
|
path="/forgetpassword"
|
||||||
element={<LazyPage Page={ForgetPassword} />}
|
element={<LazyPage Page={ForgetPassword} />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
element={
|
element={
|
||||||
<ValidateSession>
|
<ValidateSession>
|
||||||
@@ -117,10 +117,10 @@ function App() {
|
|||||||
</ValidateSession>
|
</ValidateSession>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Route
|
<Route
|
||||||
path="/changepassword"
|
path="/changepassword"
|
||||||
element={<LazyPage Page={ChangePassword} />}
|
element={<LazyPage Page={ChangePassword} />}
|
||||||
/>
|
/>
|
||||||
<Route path="/form/:id" element={<Form />} />
|
<Route path="/form/:id" element={<Form />} />
|
||||||
<Route path="/report/:id" element={<Report />} />
|
<Route path="/report/:id" element={<Report />} />
|
||||||
<Route path="/dashboard/:id" element={<Dashboard />} />
|
<Route path="/dashboard/:id" element={<Dashboard />} />
|
||||||
@@ -165,7 +165,11 @@ function App() {
|
|||||||
path="/recipientSignPdf/:docId"
|
path="/recipientSignPdf/:docId"
|
||||||
element={<PdfRequestFiles />}
|
element={<PdfRequestFiles />}
|
||||||
/>
|
/>
|
||||||
<Route path="/users" element={<UserList />} />
|
<Route path="/users" element={<UserList />} />
|
||||||
|
<Route
|
||||||
|
path="/verify-document"
|
||||||
|
element={<LazyPage Page={VerifyDocument} />}
|
||||||
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/preferences"
|
path="/preferences"
|
||||||
element={<LazyPage Page={Preferences} />}
|
element={<LazyPage Page={Preferences} />}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import dp from "../assets/images/dp.png";
|
import dp from "../assets/images/dp.png";
|
||||||
import FullScreenButton from "./FullScreenButton";
|
import FullScreenButton from "./FullScreenButton";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
@@ -172,15 +172,26 @@ const Header = ({ showSidebar, setIsMenu, isConsole }) => {
|
|||||||
<i className="fa-light fa-user"></i> {t("profile")}
|
<i className="fa-light fa-user"></i> {t("profile")}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
|
<li
|
||||||
|
onClick={() => {
|
||||||
|
setIsOpen(false);
|
||||||
|
navigate("/changepassword");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span>
|
||||||
|
<i className="fa-light fa-lock"></i>{" "}
|
||||||
|
{t("change-password")}
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
<li
|
<li
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsOpen(false);
|
setIsOpen(false);
|
||||||
navigate("/changepassword");
|
navigate("/verify-document");
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span>
|
<span>
|
||||||
<i className="fa-light fa-lock"></i>{" "}
|
<i className="fa-light fa-check-square"></i>{" "}
|
||||||
{t("change-password")}
|
{t("verify-document")}
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -12,19 +12,32 @@ function AgreementSign(props) {
|
|||||||
<div className="op-modal op-modal-open absolute z-[448]">
|
<div className="op-modal op-modal-open absolute z-[448]">
|
||||||
<div className="w-[95%] md:w-[60%] lg:w-[40%] op-modal-box overflow-y-auto hide-scrollbar text-sm p-4">
|
<div className="w-[95%] md:w-[60%] lg:w-[40%] op-modal-box overflow-y-auto hide-scrollbar text-sm p-4">
|
||||||
<div className="flex flex-row items-center">
|
<div className="flex flex-row items-center">
|
||||||
<input
|
<label className="inline-flex justify-center items-center cursor-pointer mb-0">
|
||||||
data-tut="IsAgree"
|
{/* 1) This div becomes the “fake” checkbox */}
|
||||||
className="mr-3 op-checkbox op-checkbox-m"
|
<div
|
||||||
type="checkbox"
|
data-tut="IsAgree"
|
||||||
value={isChecked}
|
className={`w-6 h-6 border-2 mr-3 rounded-full flex text-center items-center justify-center ${isChecked ? "op-border-primary" : "border-red-500"}`}
|
||||||
onChange={(e) => {
|
>
|
||||||
setIsChecked(e.target.checked);
|
{isChecked ? (
|
||||||
if (e.target.checked) {
|
<span className="op-text-primary text-sm font-bold">✓</span>
|
||||||
props.setIsAgreeTour(false);
|
) : (
|
||||||
}
|
<span className="text-red-500 text-sm font-bold">X</span>
|
||||||
props.showFirstWidget();
|
)}
|
||||||
}}
|
</div>
|
||||||
/>
|
{/* 2) Visually hide the native checkbox but keep it in the DOM */}
|
||||||
|
<input
|
||||||
|
className="sr-only"
|
||||||
|
type="checkbox"
|
||||||
|
checked={isChecked}
|
||||||
|
onChange={(e) => {
|
||||||
|
setIsChecked(e.target.checked);
|
||||||
|
if (e.target.checked) {
|
||||||
|
props.setIsAgreeTour(false);
|
||||||
|
}
|
||||||
|
props.showFirstWidget();
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
<div className="text-[11px] md:text-base">
|
<div className="text-[11px] md:text-base">
|
||||||
<span>{t("agree-p1")}</span>
|
<span>{t("agree-p1")}</span>
|
||||||
<span
|
<span
|
||||||
|
|||||||
@@ -0,0 +1,123 @@
|
|||||||
|
import { useState, useEffect, useRef } from "react";
|
||||||
|
|
||||||
|
const Cell = ({
|
||||||
|
count,
|
||||||
|
h,
|
||||||
|
value,
|
||||||
|
editable,
|
||||||
|
onChange,
|
||||||
|
onKeyDown,
|
||||||
|
inputRef,
|
||||||
|
index
|
||||||
|
}) => (
|
||||||
|
<div
|
||||||
|
className="flex items-center justify-center border border-gray-800 bg-white"
|
||||||
|
style={{ flex: `0 0 ${100 / count}%`, height: h }}
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
maxLength={1}
|
||||||
|
value={value}
|
||||||
|
readOnly={!editable}
|
||||||
|
ref={inputRef}
|
||||||
|
onChange={editable ? (e) => onChange && onChange(e, index) : undefined}
|
||||||
|
onKeyDown={editable ? (e) => onKeyDown && onKeyDown(e, index) : undefined}
|
||||||
|
className="w-full text-center uppercase focus:outline-none bg-transparent text-[12px]"
|
||||||
|
style={{ fontFamily: "Arial, sans-serif" }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default function CellsWidget({
|
||||||
|
count = 8,
|
||||||
|
height = 40,
|
||||||
|
value = "",
|
||||||
|
editable = false,
|
||||||
|
onChange,
|
||||||
|
onKeyDown,
|
||||||
|
onCellCountChange,
|
||||||
|
inputRefs,
|
||||||
|
resizable = false
|
||||||
|
}) {
|
||||||
|
const [cellCount, setCellCount] = useState(count);
|
||||||
|
|
||||||
|
// keep internal state in sync with prop updates
|
||||||
|
useEffect(() => setCellCount(count), [count]);
|
||||||
|
|
||||||
|
const startX = useRef(0);
|
||||||
|
const startCount = useRef(cellCount);
|
||||||
|
|
||||||
|
const capture = (downEv, onMove, onUp = () => {}) => {
|
||||||
|
const id = downEv.pointerId;
|
||||||
|
const move = (ev) => id === ev.pointerId && onMove(ev);
|
||||||
|
const up = (ev) => {
|
||||||
|
if (id !== ev.pointerId) return;
|
||||||
|
onUp(ev);
|
||||||
|
downEv.target.releasePointerCapture(id);
|
||||||
|
window.removeEventListener("pointermove", move);
|
||||||
|
window.removeEventListener("pointerup", up);
|
||||||
|
};
|
||||||
|
window.addEventListener("pointermove", move);
|
||||||
|
window.addEventListener("pointerup", up);
|
||||||
|
downEv.target.setPointerCapture(id);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onTopHandlePointerDown = (ev) => {
|
||||||
|
// Prevent triggering the widget drag logic
|
||||||
|
ev.stopPropagation();
|
||||||
|
ev.preventDefault();
|
||||||
|
startX.current = ev.clientX;
|
||||||
|
startCount.current = cellCount;
|
||||||
|
capture(ev, (moveEv) => {
|
||||||
|
const dx = moveEv.clientX - startX.current;
|
||||||
|
const delta = Math.floor(-dx / 5);
|
||||||
|
let newCount = Math.max(1, startCount.current + delta);
|
||||||
|
if (newCount !== cellCount) {
|
||||||
|
setCellCount(newCount);
|
||||||
|
onCellCountChange?.(newCount);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const cells = Array.from({ length: cellCount }).map((_, i) => value[i] || "");
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className="relative flex w-full h-full overflow-visible"
|
||||||
|
style={{ height }}
|
||||||
|
>
|
||||||
|
{resizable && (
|
||||||
|
<div
|
||||||
|
className="cell-size-handle absolute left-1/2 -translate-x-1/2 -top-3 cursor-ew-resize touch-none"
|
||||||
|
onPointerDown={onTopHandlePointerDown}
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
className="w-4 h-4 text-blue-600"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 20 20"
|
||||||
|
fill="currentColor"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
fillRule="evenodd"
|
||||||
|
d="m9.69 18.933.003.001C9.89 19.02 10 19 10 19s.11.02.308-.066l.002-.001.006-.003.018-.008a5.741 5.741 0 0 0 .281-.14c.186-.096.446-.24.757-.433.62-.384 1.445-.966 2.274-1.765C15.302 14.988 17 12.493 17 9A7 7 0 1 0 3 9c0 3.492 1.698 5.988 3.355 7.584a13.731 13.731 0 0 0 2.273 1.765 11.842 11.842 0 0 0 .976.544l.062.029.018.008.006.003ZM10 11.25a2.25 2.25 0 1 0 0-4.5 2.25 2.25 0 0 0 0 4.5Z"
|
||||||
|
clipRule="evenodd"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{cells.map((val, i) => (
|
||||||
|
<Cell
|
||||||
|
key={i}
|
||||||
|
count={cellCount}
|
||||||
|
h={height}
|
||||||
|
value={val}
|
||||||
|
editable={editable}
|
||||||
|
onChange={onChange}
|
||||||
|
onKeyDown={onKeyDown}
|
||||||
|
inputRef={inputRefs ? (el) => (inputRefs.current[i] = el) : undefined}
|
||||||
|
index={i}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -7,8 +7,8 @@ import { fontColorArr, fontsizeArr } from "../../constant/Utils";
|
|||||||
function DropdownWidgetOption(props) {
|
function DropdownWidgetOption(props) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [dropdownOptionList, setDropdownOptionList] = useState([
|
const [dropdownOptionList, setDropdownOptionList] = useState([
|
||||||
"option-1",
|
"Option-1",
|
||||||
"option-2"
|
"Option-2"
|
||||||
]);
|
]);
|
||||||
const [minCount, setMinCount] = useState(0);
|
const [minCount, setMinCount] = useState(0);
|
||||||
const [maxCount, setMaxCount] = useState(0);
|
const [maxCount, setMaxCount] = useState(0);
|
||||||
@@ -17,18 +17,21 @@ function DropdownWidgetOption(props) {
|
|||||||
const [isHideLabel, setIsHideLabel] = useState(false);
|
const [isHideLabel, setIsHideLabel] = useState(false);
|
||||||
const [status, setStatus] = useState("required");
|
const [status, setStatus] = useState("required");
|
||||||
const [defaultValue, setDefaultValue] = useState("");
|
const [defaultValue, setDefaultValue] = useState("");
|
||||||
const statusArr = ["required", "optional"];
|
|
||||||
const [defaultCheckbox, setDefaultCheckbox] = useState([]);
|
const [defaultCheckbox, setDefaultCheckbox] = useState([]);
|
||||||
|
const [layout, setLayout] = useState("vertical");
|
||||||
|
const statusArr = ["required", "optional"];
|
||||||
|
const layoutArr = ["vertical", "horizontal"];
|
||||||
|
|
||||||
const resetState = () => {
|
const resetState = () => {
|
||||||
setDropdownOptionList(["option-1", "option-2"]);
|
setDropdownOptionList(["Option-1", "Option-2"]);
|
||||||
setDropdownName( props.currWidgetsDetails?.options?.name || props.type);
|
setDropdownName(props.currWidgetsDetails?.options?.name || props.type);
|
||||||
setIsReadOnly(false);
|
setIsReadOnly(false);
|
||||||
setIsHideLabel(false);
|
setIsHideLabel(false);
|
||||||
setMinCount(0);
|
setMinCount(0);
|
||||||
setMaxCount(0);
|
setMaxCount(0);
|
||||||
setDefaultCheckbox([]);
|
setDefaultCheckbox([]);
|
||||||
setDefaultValue("");
|
setDefaultValue("");
|
||||||
|
setLayout("vertical");
|
||||||
};
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (
|
||||||
@@ -48,6 +51,7 @@ function DropdownWidgetOption(props) {
|
|||||||
setStatus(props.currWidgetsDetails?.options?.status || "required");
|
setStatus(props.currWidgetsDetails?.options?.status || "required");
|
||||||
setDefaultValue(props.currWidgetsDetails?.options?.defaultValue || "");
|
setDefaultValue(props.currWidgetsDetails?.options?.defaultValue || "");
|
||||||
setDefaultCheckbox(props.currWidgetsDetails?.options?.defaultValue || []);
|
setDefaultCheckbox(props.currWidgetsDetails?.options?.defaultValue || []);
|
||||||
|
setLayout(props.currWidgetsDetails?.options?.layout || "vertical");
|
||||||
} else {
|
} else {
|
||||||
setStatus("required");
|
setStatus("required");
|
||||||
resetState();
|
resetState();
|
||||||
@@ -103,6 +107,25 @@ function DropdownWidgetOption(props) {
|
|||||||
? defaultCheckbox
|
? defaultCheckbox
|
||||||
: defaultValue;
|
: defaultValue;
|
||||||
|
|
||||||
|
const isDropdownOrRadio =
|
||||||
|
props?.type === "dropdown" || props?.type === radioButtonWidget;
|
||||||
|
const readOnlyWithoutValue =
|
||||||
|
isReadOnly && !defaultValue && status !== "optional";
|
||||||
|
const WidgetLayout = ["checkbox", radioButtonWidget].includes(props.type)
|
||||||
|
? layout
|
||||||
|
: null;
|
||||||
|
|
||||||
|
// If it’s a dropdown and it’s read-only without a value (nor marked optional), stop here.
|
||||||
|
if (isDropdownOrRadio && readOnlyWithoutValue) {
|
||||||
|
alert(
|
||||||
|
props?.type === "dropdown"
|
||||||
|
? t("readonly-dropdown-error")
|
||||||
|
: t("readonly-radiobtn-error")
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise (either not a dropdown, or a valid dropdown), do the save + reset exactly once.
|
||||||
props.handleSaveWidgetsOptions(
|
props.handleSaveWidgetsOptions(
|
||||||
dropdownName,
|
dropdownName,
|
||||||
dropdownOptionList,
|
dropdownOptionList,
|
||||||
@@ -113,9 +136,10 @@ function DropdownWidgetOption(props) {
|
|||||||
null,
|
null,
|
||||||
status,
|
status,
|
||||||
defaultData,
|
defaultData,
|
||||||
isHideLabel
|
isHideLabel,
|
||||||
|
WidgetLayout
|
||||||
);
|
);
|
||||||
resetState()
|
resetState();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -137,17 +161,18 @@ function DropdownWidgetOption(props) {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<label className="text-[13px] font-semibold">
|
<label htmlFor="title" className="text-[13px] font-semibold">
|
||||||
{t("name")}
|
{t("name")}
|
||||||
<span className="text-[red] text-[13px]"> *</span>
|
<span className="text-[red] text-[13px]"> *</span>
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
|
id="title"
|
||||||
onInvalid={(e) => e.target.setCustomValidity(t("input-required"))}
|
onInvalid={(e) => e.target.setCustomValidity(t("input-required"))}
|
||||||
onInput={(e) => e.target.setCustomValidity("")}
|
onInput={(e) => e.target.setCustomValidity("")}
|
||||||
required
|
|
||||||
value={dropdownName}
|
value={dropdownName}
|
||||||
onChange={(e) => setDropdownName(e.target.value)}
|
onChange={(e) => setDropdownName(e.target.value)}
|
||||||
className="op-input op-input-bordered op-input-sm focus:outline-none hover:border-base-content w-full text-xs"
|
className="op-input op-input-bordered op-input-sm focus:outline-none hover:border-base-content w-full text-xs"
|
||||||
|
required
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<label className="text-[13px] font-semibold mt-[5px]">
|
<label className="text-[13px] font-semibold mt-[5px]">
|
||||||
@@ -228,28 +253,24 @@ function DropdownWidgetOption(props) {
|
|||||||
</select>
|
</select>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{props.type !== "checkbox" && props.type !== radioButtonWidget && (
|
{props.type !== "checkbox" && (
|
||||||
<>
|
<div className="flex flex-row gap-[10px] mt-[0.5rem]">
|
||||||
<div className="flex flex-row gap-[10px] mt-[0.5rem]">
|
{statusArr.map((data, ind) => (
|
||||||
{statusArr.map((data, ind) => {
|
<div
|
||||||
return (
|
key={ind}
|
||||||
<div
|
className="flex flex-row gap-[5px] items-center"
|
||||||
key={ind}
|
>
|
||||||
className="flex flex-row gap-[5px] items-center"
|
<input
|
||||||
>
|
className="op-radio op-radio-xs my-1"
|
||||||
<input
|
type="radio"
|
||||||
className="op-radio op-radio-xs my-1"
|
name="status"
|
||||||
type="radio"
|
onChange={() => setStatus(data.toLowerCase())}
|
||||||
name="status"
|
checked={status.toLowerCase() === data.toLowerCase()}
|
||||||
onChange={() => setStatus(data.toLowerCase())}
|
/>
|
||||||
checked={status.toLowerCase() === data.toLowerCase()}
|
<div className="text-[13px] font-500 capitalize">{data}</div>
|
||||||
/>
|
</div>
|
||||||
<div className="text-[13px] font-500">{data}</div>
|
))}
|
||||||
</div>
|
</div>
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
<div className="flex items-center mt-3 mb-3">
|
<div className="flex items-center mt-3 mb-3">
|
||||||
<span>{t("font-size")} :</span>
|
<span>{t("font-size")} :</span>
|
||||||
@@ -270,8 +291,8 @@ function DropdownWidgetOption(props) {
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</select>
|
</select>
|
||||||
<div className="flex flex-row gap-1 items-center ml-4 ">
|
<div className="flex flex-row gap-1 items-center ml-4">
|
||||||
<span>{t("color")} : </span>
|
<span className="capitalize">{t("color")} : </span>
|
||||||
<select
|
<select
|
||||||
value={
|
value={
|
||||||
props.fontColor ||
|
props.fontColor ||
|
||||||
@@ -313,7 +334,7 @@ function DropdownWidgetOption(props) {
|
|||||||
className="op-checkbox op-checkbox-sm"
|
className="op-checkbox op-checkbox-sm"
|
||||||
onChange={(e) => setIsReadOnly(e.target.checked)}
|
onChange={(e) => setIsReadOnly(e.target.checked)}
|
||||||
/>
|
/>
|
||||||
<label className="ml-1 mb-0" htmlFor="isreadonly">
|
<label className="ml-2 mb-0 capitalize" htmlFor="isreadonly">
|
||||||
{t("read-only")}
|
{t("read-only")}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -328,15 +349,42 @@ function DropdownWidgetOption(props) {
|
|||||||
onChange={(e) => setIsHideLabel(e.target.checked)}
|
onChange={(e) => setIsHideLabel(e.target.checked)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<label className="ml-1 mb-0" htmlFor="ishidelabel">
|
<label className="ml-2 mb-0 capitalize" htmlFor="ishidelabel">
|
||||||
{t("hide-labels")}
|
{t("hide-labels")}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
{["checkbox", radioButtonWidget].includes(props.type) && (
|
||||||
|
<>
|
||||||
|
<div className="text-[13px] font-semibold mt-[5px] capitalize">
|
||||||
|
{t("layout")}
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className={`${props.type === "checkbox" ? "mb-[10px]" : ""} flex flex-row gap-[10px] mt-[0.5rem]`}
|
||||||
|
>
|
||||||
|
{layoutArr.map((data, ind) => (
|
||||||
|
<div
|
||||||
|
key={ind}
|
||||||
|
className="flex flex-row gap-[5px] items-center"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
className="op-radio op-radio-xs my-1"
|
||||||
|
type="radio"
|
||||||
|
name="layout"
|
||||||
|
checked={layout.toLowerCase() === data.toLowerCase()}
|
||||||
|
onChange={() => setLayout(data.toLowerCase())}
|
||||||
|
/>
|
||||||
|
<label className="text-[13px] font-500 mb-0 capitalize">
|
||||||
|
{data}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
className={`${
|
className={`${
|
||||||
props.type === "checkbox" && props.isShowAdvanceFeature
|
props.type === "checkbox" && props.isShowAdvanceFeature
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, {
|
import {
|
||||||
useState,
|
useState,
|
||||||
useRef,
|
useRef,
|
||||||
} from "react";
|
} from "react";
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import React, { useState, useEffect, useRef } from "react";
|
import { useState, useEffect, useRef } from "react";
|
||||||
import BorderResize from "./BorderResize";
|
import BorderResize from "./BorderResize";
|
||||||
import PlaceholderBorder from "./PlaceholderBorder";
|
|
||||||
import { Rnd } from "react-rnd";
|
import { Rnd } from "react-rnd";
|
||||||
import {
|
import {
|
||||||
changeDateToMomentFormat,
|
changeDateToMomentFormat,
|
||||||
@@ -14,6 +13,7 @@ import {
|
|||||||
onChangeInput,
|
onChangeInput,
|
||||||
radioButtonWidget,
|
radioButtonWidget,
|
||||||
textInputWidget,
|
textInputWidget,
|
||||||
|
cellsWidget,
|
||||||
textWidget
|
textWidget
|
||||||
} from "../../constant/Utils";
|
} from "../../constant/Utils";
|
||||||
import PlaceholderType from "./PlaceholderType";
|
import PlaceholderType from "./PlaceholderType";
|
||||||
@@ -23,6 +23,7 @@ import ModalUi from "../../primitives/ModalUi";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
import { setIsShowModal } from "../../redux/reducers/widgetSlice";
|
import { setIsShowModal } from "../../redux/reducers/widgetSlice";
|
||||||
|
import { themeColor } from "../../constant/const";
|
||||||
|
|
||||||
const selectFormat = (data) => {
|
const selectFormat = (data) => {
|
||||||
switch (data) {
|
switch (data) {
|
||||||
@@ -78,7 +79,6 @@ function Placeholder(props) {
|
|||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const widgetData =
|
const widgetData =
|
||||||
props.pos?.options?.defaultValue || props.pos?.options?.response;
|
props.pos?.options?.defaultValue || props.pos?.options?.response;
|
||||||
const [placeholderBorder, setPlaceholderBorder] = useState({ w: 0, h: 0 });
|
|
||||||
const [isDateModal, setIsDateModal] = useState(false);
|
const [isDateModal, setIsDateModal] = useState(false);
|
||||||
const [containerScale, setContainerScale] = useState();
|
const [containerScale, setContainerScale] = useState();
|
||||||
const holdTimeout = useRef(null);
|
const holdTimeout = useRef(null);
|
||||||
@@ -86,6 +86,9 @@ function Placeholder(props) {
|
|||||||
const [selectDate, setSelectDate] = useState({});
|
const [selectDate, setSelectDate] = useState({});
|
||||||
const [dateFormat, setDateFormat] = useState([]);
|
const [dateFormat, setDateFormat] = useState([]);
|
||||||
const [clickonWidget, setClickonWidget] = useState({});
|
const [clickonWidget, setClickonWidget] = useState({});
|
||||||
|
const [isDateReadOnly, setIsDateReadOnly] = useState(
|
||||||
|
props?.pos?.options?.isReadOnly || false
|
||||||
|
);
|
||||||
const startDate = props?.pos?.options?.response
|
const startDate = props?.pos?.options?.response
|
||||||
? getDefaultDate(
|
? getDefaultDate(
|
||||||
props?.pos?.options?.response,
|
props?.pos?.options?.response,
|
||||||
@@ -93,10 +96,6 @@ function Placeholder(props) {
|
|||||||
)
|
)
|
||||||
: new Date();
|
: new Date();
|
||||||
|
|
||||||
const [getCheckboxRenderWidth, setGetCheckboxRenderWidth] = useState({
|
|
||||||
width: null,
|
|
||||||
height: null
|
|
||||||
});
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const getPdfPageWidth = props.pdfOriginalWH.find(
|
const getPdfPageWidth = props.pdfOriginalWH.find(
|
||||||
(data) => data.pageNumber === props.pageNumber
|
(data) => data.pageNumber === props.pageNumber
|
||||||
@@ -127,18 +126,6 @@ function Placeholder(props) {
|
|||||||
}
|
}
|
||||||
}, [widgetData]);
|
}, [widgetData]);
|
||||||
|
|
||||||
const handleGetDaynamicWH = () => {
|
|
||||||
if (
|
|
||||||
props?.pos?.type === "checkbox" ||
|
|
||||||
props?.pos?.type === radioButtonWidget
|
|
||||||
) {
|
|
||||||
const rndElement = document.getElementById(props.pos.key);
|
|
||||||
if (rndElement) {
|
|
||||||
const { width, height } = rndElement.getBoundingClientRect();
|
|
||||||
setGetCheckboxRenderWidth({ width: width, height: height });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
//function change format array list with selected date and format
|
//function change format array list with selected date and format
|
||||||
const changeDateFormat = () => {
|
const changeDateFormat = () => {
|
||||||
const updateDate = [];
|
const updateDate = [];
|
||||||
@@ -309,7 +296,6 @@ function Placeholder(props) {
|
|||||||
//The else condition is used to handle the case when the user clicks on a widget and open signature pad to draw sign
|
//The else condition is used to handle the case when the user clicks on a widget and open signature pad to draw sign
|
||||||
props.setCurrWidgetsDetails && props.setCurrWidgetsDetails(props.pos);
|
props.setCurrWidgetsDetails && props.setCurrWidgetsDetails(props.pos);
|
||||||
handleWidgetIdandPopup();
|
handleWidgetIdandPopup();
|
||||||
handleGetDaynamicWH();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//`handleOnClickSettingIcon` is used set current widget details and open setting of it
|
//`handleOnClickSettingIcon` is used set current widget details and open setting of it
|
||||||
@@ -424,10 +410,47 @@ function Placeholder(props) {
|
|||||||
false,
|
false,
|
||||||
data?.format,
|
data?.format,
|
||||||
props.fontSize || props.pos?.options?.fontSize || 12,
|
props.fontSize || props.pos?.options?.fontSize || 12,
|
||||||
props.fontColor || props.pos?.options?.fontColor || "black"
|
props.fontColor || props.pos?.options?.fontColor || "black",
|
||||||
|
isDateReadOnly || false
|
||||||
);
|
);
|
||||||
setSelectDate({ date: date, format: data?.format });
|
setSelectDate({ date: date, format: data?.format });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const setCellCount = (key, newCount) => {
|
||||||
|
const isSignerList = props.xyPosition.some((d) => d.signerPtr);
|
||||||
|
if (isSignerList) {
|
||||||
|
const signerId = props.data?.Id || props.uniqueId;
|
||||||
|
const filterSignerPos = props.xyPosition.filter((d) => d.Id === signerId);
|
||||||
|
if (filterSignerPos.length > 0) {
|
||||||
|
const getPlaceHolder = filterSignerPos[0].placeHolder;
|
||||||
|
const updatedPlaceHolder = getPlaceHolder.map((ph) => {
|
||||||
|
if (ph.pageNumber !== props.pageNumber) return ph;
|
||||||
|
const newPos = ph.pos.map((p) =>
|
||||||
|
p.key === key
|
||||||
|
? { ...p, options: { ...p.options, cellCount: newCount } }
|
||||||
|
: p
|
||||||
|
);
|
||||||
|
return { ...ph, pos: newPos };
|
||||||
|
});
|
||||||
|
const newSignerPos = props.xyPosition.map((obj) =>
|
||||||
|
obj.Id === signerId
|
||||||
|
? { ...obj, placeHolder: updatedPlaceHolder }
|
||||||
|
: obj
|
||||||
|
);
|
||||||
|
props.setXyPosition(newSignerPos);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const updatePos = props.xyPosition[props.index].pos.map((p) =>
|
||||||
|
p.key === key
|
||||||
|
? { ...p, options: { ...p.options, cellCount: newCount } }
|
||||||
|
: p
|
||||||
|
);
|
||||||
|
const updatePlaceholder = props.xyPosition.map((obj, ind) =>
|
||||||
|
ind === props.index ? { ...obj, pos: updatePos } : obj
|
||||||
|
);
|
||||||
|
props.setXyPosition(updatePlaceholder);
|
||||||
|
}
|
||||||
|
};
|
||||||
const PlaceholderIcon = () => {
|
const PlaceholderIcon = () => {
|
||||||
// 1- If props.isShowBorder is true, display border's icon for all widgets. OR
|
// 1- If props.isShowBorder is true, display border's icon for all widgets. OR
|
||||||
// 2- Use the combination of props?.isAlllowModify and !props?.assignedWidgetId.includes(props.pos.key) to determine when to show border's icon:
|
// 2- Use the combination of props?.isAlllowModify and !props?.assignedWidgetId.includes(props.pos.key) to determine when to show border's icon:
|
||||||
@@ -769,16 +792,9 @@ function Placeholder(props) {
|
|||||||
id={props.pos.key}
|
id={props.pos.key}
|
||||||
data-tut={props.pos.key === props.unSignedWidgetId ? "IsSigned" : ""}
|
data-tut={props.pos.key === props.unSignedWidgetId ? "IsSigned" : ""}
|
||||||
key={props.pos.key}
|
key={props.pos.key}
|
||||||
|
cancel=".cell-size-handle"
|
||||||
lockAspectRatio={
|
lockAspectRatio={
|
||||||
!props.isFreeResize &&
|
!props.isFreeResize &&
|
||||||
![
|
|
||||||
textWidget,
|
|
||||||
"email",
|
|
||||||
"name",
|
|
||||||
"company",
|
|
||||||
"job title",
|
|
||||||
textInputWidget
|
|
||||||
].includes(props.pos.type) &&
|
|
||||||
(props.pos.Width
|
(props.pos.Width
|
||||||
? props.pos.Width / props.pos.Height
|
? props.pos.Width / props.pos.Height
|
||||||
: defaultWidthHeight(props.pos.type).width /
|
: defaultWidthHeight(props.pos.type).width /
|
||||||
@@ -823,7 +839,6 @@ function Placeholder(props) {
|
|||||||
background: handleBackground()
|
background: handleBackground()
|
||||||
}}
|
}}
|
||||||
onDrag={() => {
|
onDrag={() => {
|
||||||
handleGetDaynamicWH();
|
|
||||||
props.handleTabDrag && props.handleTabDrag(props.pos.key);
|
props.handleTabDrag && props.handleTabDrag(props.pos.key);
|
||||||
}}
|
}}
|
||||||
size={{
|
size={{
|
||||||
@@ -838,7 +853,12 @@ function Placeholder(props) {
|
|||||||
? "auto"
|
? "auto"
|
||||||
: props.posHeight(props.pos, props.isSignYourself)
|
: props.posHeight(props.pos, props.isSignYourself)
|
||||||
}}
|
}}
|
||||||
minHeight={calculateFont(props.pos.options?.fontSize, true)}
|
minHeight={
|
||||||
|
props.pos.type === cellsWidget
|
||||||
|
? calculateFont(props.pos.options?.fontSize, true)
|
||||||
|
: props.pos.type !== "checkbox" &&
|
||||||
|
calculateFont(props.pos.options?.fontSize, true)
|
||||||
|
}
|
||||||
maxHeight="auto"
|
maxHeight="auto"
|
||||||
onResizeStart={() => {
|
onResizeStart={() => {
|
||||||
props.setIsResize && props.setIsResize(true);
|
props.setIsResize && props.setIsResize(true);
|
||||||
@@ -873,12 +893,6 @@ function Placeholder(props) {
|
|||||||
x: xPos(props.pos, props.isSignYourself),
|
x: xPos(props.pos, props.isSignYourself),
|
||||||
y: yPos(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)
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
disableDragging={handleDragging()}
|
disableDragging={handleDragging()}
|
||||||
>
|
>
|
||||||
{props.pos.key === props?.currWidgetsDetails?.key &&
|
{props.pos.key === props?.currWidgetsDetails?.key &&
|
||||||
@@ -911,40 +925,27 @@ function Placeholder(props) {
|
|||||||
props.pos.key === props?.currWidgetsDetails?.key && <BorderResize />
|
props.pos.key === props?.currWidgetsDetails?.key && <BorderResize />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* 1- Show a border if props.pos.key === props?.currWidgetsDetails?.key, indicating the current user's selected widget.
|
{/* 1- Show a ouline if props.pos.key === props?.currWidgetsDetails?.key, indicating the current user's selected widget.
|
||||||
2- If props.isShowBorder is true, display borders for all widgets.
|
2- If props.isShowBorder is true, display ouline for all widgets.
|
||||||
3- Use the combination of props?.isAlllowModify and !props?.assignedWidgetId.includes(props.pos.key) to determine when to show borders:
|
3- Use the combination of props?.isAlllowModify and !props?.assignedWidgetId.includes(props.pos.key) to determine when to show ouline:
|
||||||
1- When isAlllowModify is true, show borders.
|
3.1- When isAlllowModify is true, show ouline.
|
||||||
2- Do not display border for widgets already assigned (props.assignedWidgetId.includes(props.pos.key) is true).
|
3.2- Do not display ouline for widgets already assigned (props.assignedWidgetId.includes(props.pos.key) is true).
|
||||||
*/}
|
*/}
|
||||||
{props.pos.key === props?.currWidgetsDetails?.key &&
|
|
||||||
(props.isShowBorder ||
|
|
||||||
(props?.isAlllowModify &&
|
|
||||||
!props?.assignedWidgetId.includes(props.pos.key))) && (
|
|
||||||
<PlaceholderBorder
|
|
||||||
pos={props.pos}
|
|
||||||
isPlaceholder={props.isPlaceholder}
|
|
||||||
getCheckboxRenderWidth={getCheckboxRenderWidth}
|
|
||||||
scale={props.scale}
|
|
||||||
containerScale={containerScale}
|
|
||||||
placeholderBorder={placeholderBorder}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<div
|
<div
|
||||||
className="flex items-stretch justify-center"
|
className={`${
|
||||||
|
props.pos.key === props?.currWidgetsDetails?.key &&
|
||||||
|
(props.isShowBorder ||
|
||||||
|
(props?.isAlllowModify &&
|
||||||
|
!props?.assignedWidgetId.includes(props.pos.key)))
|
||||||
|
? "outline-[0.3px] outline-dashed outline-offset-[10px]"
|
||||||
|
: ""
|
||||||
|
} flex items-stretch justify-center`}
|
||||||
style={{
|
style={{
|
||||||
|
outlineColor: themeColor,
|
||||||
left: xPos(props.pos, props.isSignYourself),
|
left: xPos(props.pos, props.isSignYourself),
|
||||||
top: yPos(props.pos, props.isSignYourself),
|
top: yPos(props.pos, props.isSignYourself),
|
||||||
width:
|
width: "100%",
|
||||||
props.pos.type === radioButtonWidget ||
|
height: "100%",
|
||||||
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),
|
|
||||||
zIndex: "10"
|
zIndex: "10"
|
||||||
}}
|
}}
|
||||||
onTouchEnd={() => handleOnClickPlaceholder()}
|
onTouchEnd={() => handleOnClickPlaceholder()}
|
||||||
@@ -973,6 +974,7 @@ function Placeholder(props) {
|
|||||||
handleSaveDate={handleSaveDate}
|
handleSaveDate={handleSaveDate}
|
||||||
xPos={props.xPos}
|
xPos={props.xPos}
|
||||||
calculateFont={calculateFont}
|
calculateFont={calculateFont}
|
||||||
|
setCellCount={setCellCount}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Rnd>
|
</Rnd>
|
||||||
@@ -980,11 +982,11 @@ function Placeholder(props) {
|
|||||||
|
|
||||||
<ModalUi isOpen={isDateModal} title={t("widget-info")} showClose={false}>
|
<ModalUi isOpen={isDateModal} title={t("widget-info")} showClose={false}>
|
||||||
<div className="h-[100%] p-[20px]">
|
<div className="h-[100%] p-[20px]">
|
||||||
<div className="flex flex-row items-center">
|
<div className="flex flex-col md:flex-row md:items-center gap-y-3">
|
||||||
<span>{t("format")} : </span>
|
<div className="flex flex-row items-center gap-x-1">
|
||||||
<div className="flex">
|
<span className="capitalize">{t("format")} :</span>
|
||||||
<select
|
<select
|
||||||
className="ml-[7px] op-select op-select-bordered op-select-sm focus:outline-none hover:border-base-content text-xs"
|
className="op-select op-select-bordered op-select-sm focus:outline-none hover:border-base-content text-xs"
|
||||||
defaultValue={""}
|
defaultValue={""}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const selectedIndex = e.target.value;
|
const selectedIndex = e.target.value;
|
||||||
@@ -1008,23 +1010,23 @@ function Placeholder(props) {
|
|||||||
{selectDate.format}
|
{selectDate.format}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center mt-4 md:mt-2">
|
<div className="flex flex-col md:flex-row gap-y-2 md:gap-y-0 gap-x-2 mt-3">
|
||||||
<span>{t("font-size")} :</span>
|
<div className="flex flex-row items-center">
|
||||||
<select
|
<span className="capitalize">{t("font-size")} :</span>
|
||||||
className="ml-[3px] md:ml:[7px] op-select op-select-bordered op-select-sm focus:outline-none hover:border-base-content text-xs"
|
<select
|
||||||
value={props.fontSize || clickonWidget.options?.fontSize || 12}
|
className="ml-[3px] md:ml:[7px] op-select op-select-bordered op-select-sm focus:outline-none hover:border-base-content text-xs"
|
||||||
onChange={(e) => props.setFontSize(parseInt(e.target.value))}
|
value={props.fontSize || clickonWidget.options?.fontSize || 12}
|
||||||
>
|
onChange={(e) => props.setFontSize(parseInt(e.target.value))}
|
||||||
{fontsizeArr.map((size, ind) => {
|
>
|
||||||
return (
|
{fontsizeArr.map((size, ind) => (
|
||||||
<option className="text-[13px]" value={size} key={ind}>
|
<option className="text-[13px]" value={size} key={ind}>
|
||||||
{size}
|
{size}
|
||||||
</option>
|
</option>
|
||||||
);
|
))}
|
||||||
})}
|
</select>
|
||||||
</select>
|
</div>
|
||||||
<div className="flex flex-row gap-1 items-center ml-2 md:ml-4 ">
|
<div className="flex flex-row gap-1 items-center">
|
||||||
<span>{t("color")}: </span>
|
<span className="capitalize">{t("color")} :</span>
|
||||||
<select
|
<select
|
||||||
value={
|
value={
|
||||||
props.fontColor || clickonWidget.options?.fontColor || "black"
|
props.fontColor || clickonWidget.options?.fontColor || "black"
|
||||||
@@ -1032,13 +1034,11 @@ function Placeholder(props) {
|
|||||||
onChange={(e) => props.setFontColor(e.target.value)}
|
onChange={(e) => props.setFontColor(e.target.value)}
|
||||||
className="ml-[4px] md:ml[7px] op-select op-select-bordered op-select-sm focus:outline-none hover:border-base-content text-xs"
|
className="ml-[4px] md:ml[7px] op-select op-select-bordered op-select-sm focus:outline-none hover:border-base-content text-xs"
|
||||||
>
|
>
|
||||||
{fontColorArr.map((color, ind) => {
|
{fontColorArr.map((color, ind) => (
|
||||||
return (
|
<option value={color} key={ind}>
|
||||||
<option value={color} key={ind}>
|
{t(`color-type.${color}`)}
|
||||||
{t(`color-type.${color}`)}
|
</option>
|
||||||
</option>
|
))}
|
||||||
);
|
|
||||||
})}
|
|
||||||
</select>
|
</select>
|
||||||
<span
|
<span
|
||||||
style={{
|
style={{
|
||||||
@@ -1049,7 +1049,26 @@ function Placeholder(props) {
|
|||||||
></span>
|
></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{props?.isPlaceholder && (
|
||||||
|
<div className="flex items-center mt-3">
|
||||||
|
<input
|
||||||
|
id="isReadOnly"
|
||||||
|
name="isReadOnly"
|
||||||
|
type="checkbox"
|
||||||
|
checked={
|
||||||
|
isDateReadOnly || props.pos.options?.isReadOnly || false
|
||||||
|
}
|
||||||
|
className="op-checkbox op-checkbox-xs"
|
||||||
|
onChange={() => setIsDateReadOnly(!isDateReadOnly)}
|
||||||
|
/>
|
||||||
|
<label
|
||||||
|
className="ml-1.5 mb-0 capitalize text-[13px]"
|
||||||
|
htmlFor="isreadonly"
|
||||||
|
>
|
||||||
|
{t("read-only")}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<div className="h-[1px] w-full my-[15px] bg-[#9f9f9f]"></div>
|
<div className="h-[1px] w-full my-[15px] bg-[#9f9f9f]"></div>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
import { themeColor } from "../../constant/const";
|
|
||||||
import {
|
|
||||||
defaultWidthHeight,
|
|
||||||
isMobile,
|
|
||||||
radioButtonWidget,
|
|
||||||
resizeBorderExtraWidth,
|
|
||||||
textWidget
|
|
||||||
} from "../../constant/Utils";
|
|
||||||
function PlaceholderBorder(props) {
|
|
||||||
const getResizeBorderExtraWidth = resizeBorderExtraWidth();
|
|
||||||
const defaultWidth = defaultWidthHeight(props.pos.type).width;
|
|
||||||
const defaultHeight = defaultWidthHeight(props.pos.type).height;
|
|
||||||
const width = () => {
|
|
||||||
const getWidth =
|
|
||||||
props.placeholderBorder.w || props.pos.Width || defaultWidth;
|
|
||||||
return (
|
|
||||||
getWidth * props.scale * props.containerScale + getResizeBorderExtraWidth
|
|
||||||
);
|
|
||||||
};
|
|
||||||
const height = () => {
|
|
||||||
const getHeight =
|
|
||||||
props.placeholderBorder.h || props.pos.Height || defaultHeight;
|
|
||||||
|
|
||||||
return (
|
|
||||||
getHeight * props.scale * props.containerScale + getResizeBorderExtraWidth
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleMinWidth = () => {
|
|
||||||
if (props.pos.type === "checkbox" || props.pos.type === radioButtonWidget) {
|
|
||||||
return props.getCheckboxRenderWidth.width + getResizeBorderExtraWidth;
|
|
||||||
} else {
|
|
||||||
return width();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const handleMinHeight = () => {
|
|
||||||
if (props.pos.type === "checkbox" || props.pos.type === radioButtonWidget) {
|
|
||||||
return props.getCheckboxRenderWidth.height + getResizeBorderExtraWidth;
|
|
||||||
} else {
|
|
||||||
return height();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className="absolute inline-block w-[14px] h-[14px] border-[0.2px] overflow-hidden border-dashed"
|
|
||||||
style={{
|
|
||||||
borderColor: themeColor,
|
|
||||||
minWidth: handleMinWidth() || 0,
|
|
||||||
minHeight: handleMinHeight() || 0
|
|
||||||
}}
|
|
||||||
></div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default PlaceholderBorder;
|
|
||||||
@@ -4,6 +4,7 @@ import {
|
|||||||
getYear,
|
getYear,
|
||||||
radioButtonWidget,
|
radioButtonWidget,
|
||||||
textInputWidget,
|
textInputWidget,
|
||||||
|
cellsWidget,
|
||||||
textWidget,
|
textWidget,
|
||||||
months,
|
months,
|
||||||
years,
|
years,
|
||||||
@@ -14,8 +15,9 @@ import DatePicker from "react-datepicker";
|
|||||||
import "react-datepicker/dist/react-datepicker.css";
|
import "react-datepicker/dist/react-datepicker.css";
|
||||||
import "../../styles/signature.css";
|
import "../../styles/signature.css";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import CellsWidget from "./CellsWidget";
|
||||||
const textWidgetCls =
|
const textWidgetCls =
|
||||||
"w-full h-full md:min-w-full md:min-h-full z-[999] text-[12px] rounded-[2px] border-[1px] border-[#007bff] overflow-hidden resize-none outline-none text-base-content item-center whitespace-pre-wrap bg-white";
|
"w-full h-full md:min-w-full md:min-h-full z-[999] text-[12px] rounded-[2px] border-[1px] border-[#007bff] overflow-hidden resize-none outline-none text-base-content item-center whitespace-pre-wrap";
|
||||||
const selectWidgetCls =
|
const selectWidgetCls =
|
||||||
"w-full h-full absolute left-0 top-0 border-[1px] border-[#007bff] rounded-[2px] focus:outline-none text-base-content";
|
"w-full h-full absolute left-0 top-0 border-[1px] border-[#007bff] rounded-[2px] focus:outline-none text-base-content";
|
||||||
const widgetCls =
|
const widgetCls =
|
||||||
@@ -27,8 +29,12 @@ function PlaceholderType(props) {
|
|||||||
props.isSignYourself ||
|
props.isSignYourself ||
|
||||||
((props.isSelfSign || props.isNeedSign) &&
|
((props.isSelfSign || props.isNeedSign) &&
|
||||||
props.data?.signerObjId === props.signerObjId);
|
props.data?.signerObjId === props.signerObjId);
|
||||||
|
const isReadOnly =
|
||||||
|
props.pos.options?.isReadOnly ||
|
||||||
|
props.data?.signerObjId !== props.signerObjId;
|
||||||
|
// prefer the latest response value over any default value
|
||||||
const widgetData =
|
const widgetData =
|
||||||
props.pos?.options?.defaultValue || props.pos?.options?.response;
|
props.pos?.options?.response ?? props.pos?.options?.defaultValue ?? "";
|
||||||
const widgetTypeTranslation = t(`widgets-name.${props?.pos?.type}`);
|
const widgetTypeTranslation = t(`widgets-name.${props?.pos?.type}`);
|
||||||
const inputRef = useRef(null);
|
const inputRef = useRef(null);
|
||||||
const [widgetValue, setwidgetValue] = useState();
|
const [widgetValue, setwidgetValue] = useState();
|
||||||
@@ -56,16 +62,13 @@ function PlaceholderType(props) {
|
|||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if (widgetData) {
|
// keep displayed value in sync with the stored response
|
||||||
setwidgetValue(widgetData);
|
setwidgetValue(widgetData);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (props.pos?.options?.hint) {
|
if (props.pos?.options?.hint) {
|
||||||
setHint(props.pos?.options.hint);
|
setHint(props.pos?.options.hint);
|
||||||
} else if (props.pos?.options?.validation?.type) {
|
} else if (props.pos?.options?.validation?.type) {
|
||||||
checkRegularExpress(props.pos?.options?.validation?.type, setHint);
|
checkRegularExpress(props.pos?.options?.validation?.type, setHint);
|
||||||
} else {
|
|
||||||
setHint(props.pos?.type);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
@@ -77,7 +80,8 @@ function PlaceholderType(props) {
|
|||||||
color: fontColor,
|
color: fontColor,
|
||||||
fontFamily: "Arial, sans-serif"
|
fontFamily: "Arial, sans-serif"
|
||||||
}}
|
}}
|
||||||
className={`${selectWidgetCls} overflow-hidden`}
|
className={`${isReadOnly ? `select-none` : ``} ${selectWidgetCls} overflow-hidden`}
|
||||||
|
disabled={isReadOnly}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
>
|
>
|
||||||
@@ -98,22 +102,6 @@ function PlaceholderType(props) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//handle height on enter press in text area
|
|
||||||
// const handleEnterPress = (e) => {
|
|
||||||
// const height = 18;
|
|
||||||
// if (e.key === "Enter") {
|
|
||||||
// //function to save height of text area
|
|
||||||
// onChangeHeightOfTextArea(
|
|
||||||
// height,
|
|
||||||
// props.pos.type,
|
|
||||||
// props.pos.key,
|
|
||||||
// props.xyPosition,
|
|
||||||
// props.index,
|
|
||||||
// props.setXyPosition,
|
|
||||||
// props.data && props.data?.Id
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "signature":
|
case "signature":
|
||||||
return props.pos.SignUrl ? (
|
return props.pos.SignUrl ? (
|
||||||
@@ -164,41 +152,42 @@ function PlaceholderType(props) {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
case "checkbox":
|
case "checkbox":
|
||||||
|
const checkBoxLayout = props.pos.options?.layout || "vertical";
|
||||||
|
const isMultipleCheckbox =
|
||||||
|
props.pos.options?.values?.length > 0 ? true : false;
|
||||||
|
const checkBoxWrapperClass = `flex items-start ${
|
||||||
|
checkBoxLayout === "horizontal"
|
||||||
|
? `flex-row flex-wrap ${isMultipleCheckbox ? "gap-x-2" : ""}`
|
||||||
|
: `flex-col ${isMultipleCheckbox ? "gap-y-[5px]" : ""}`
|
||||||
|
}`; // Using gap-y-1 for consistency, adjust if needed
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ zIndex: props.isSignYourself && "99" }}>
|
<div
|
||||||
{props.pos.options?.values?.map((data, ind) => {
|
className={checkBoxWrapperClass}
|
||||||
return (
|
style={{ zIndex: props.isSignYourself && "99" }}
|
||||||
<div
|
>
|
||||||
key={ind}
|
{props.pos.options?.values?.map((data, ind) => (
|
||||||
className="select-none-cls flex items-center text-center gap-0.5 pointer-events-none"
|
<div key={ind} className="select-none-cls pointer-events-none">
|
||||||
|
<label
|
||||||
|
htmlFor={`checkbox-${props.pos.key + ind}`}
|
||||||
|
style={{ fontSize: fontSize, color: fontColor }}
|
||||||
|
className={`mb-0 flex items-center gap-1`}
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
id={`checkbox-${props.pos.key + ind}`}
|
id={`checkbox-${props.pos.key + ind}`}
|
||||||
style={{ width: fontSize, height: fontSize }}
|
style={{ width: fontSize, height: fontSize }}
|
||||||
className={`${
|
className="op-checkbox rounded-[1px]"
|
||||||
ind === 0 ? "mt-0" : "mt-[5px]"
|
disabled={props.isNeedSign && isReadOnly}
|
||||||
} flex justify-center op-checkbox rounded-[1px] `}
|
|
||||||
disabled={
|
|
||||||
props.isNeedSign &&
|
|
||||||
(props.pos.options?.isReadOnly ||
|
|
||||||
props.data?.signerObjId !== props.signerObjId)
|
|
||||||
}
|
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
readOnly
|
readOnly
|
||||||
checked={!!selectCheckbox(ind, selectedCheckbox)}
|
checked={!!selectCheckbox(ind, selectedCheckbox)}
|
||||||
/>
|
/>
|
||||||
{!props.pos.options?.isHideLabel && (
|
{!props.pos.options?.isHideLabel && (
|
||||||
<label
|
<span className="leading-none">{data}</span>
|
||||||
htmlFor={`checkbox-${props.pos.key + ind}`}
|
|
||||||
style={{ fontSize: fontSize, color: fontColor }}
|
|
||||||
className="text-xs mb-0 text-center"
|
|
||||||
>
|
|
||||||
{data}
|
|
||||||
</label>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</label>
|
||||||
);
|
</div>
|
||||||
})}
|
))}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
case textInputWidget:
|
case textInputWidget:
|
||||||
@@ -208,24 +197,15 @@ function PlaceholderType(props) {
|
|||||||
placeholder={hint || t("widgets-name.text")}
|
placeholder={hint || t("widgets-name.text")}
|
||||||
rows={1}
|
rows={1}
|
||||||
value={widgetValue}
|
value={widgetValue}
|
||||||
className={`${
|
className={`${textWidgetCls} ${isReadOnly ? "select-none" : ""}`}
|
||||||
props.pos.options?.isReadOnly ||
|
|
||||||
props.data?.signerObjId !== props.signerObjId
|
|
||||||
? "select-none"
|
|
||||||
: textWidgetCls
|
|
||||||
}`}
|
|
||||||
style={{
|
style={{
|
||||||
fontSize: fontSize,
|
fontSize: fontSize,
|
||||||
color: fontColor,
|
color: fontColor,
|
||||||
background: props.data?.blockColor,
|
background: isReadOnly ? props.data?.blockColor : "white",
|
||||||
pointerEvents: "none"
|
pointerEvents: "none"
|
||||||
}}
|
}}
|
||||||
readOnly
|
readOnly
|
||||||
disabled={
|
disabled={props.isNeedSign && isReadOnly}
|
||||||
props.isNeedSign &&
|
|
||||||
(props.pos.options?.isReadOnly ||
|
|
||||||
props.data?.signerObjId !== props.signerObjId)
|
|
||||||
}
|
|
||||||
cols="50"
|
cols="50"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -233,17 +213,34 @@ function PlaceholderType(props) {
|
|||||||
<span>{hint || widgetTypeTranslation}</span>
|
<span>{hint || widgetTypeTranslation}</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
case cellsWidget: {
|
||||||
|
const count = props.pos.options?.cellCount || 5;
|
||||||
|
const cells = (widgetValue || "").split("");
|
||||||
|
const height = "100%";
|
||||||
|
const handleCellResize = (newCount) => {
|
||||||
|
if (props.setCellCount) props.setCellCount(props.pos.key, newCount);
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<CellsWidget
|
||||||
|
count={count}
|
||||||
|
height={height}
|
||||||
|
value={cells.join("")}
|
||||||
|
editable={props.isPlaceholder}
|
||||||
|
resizable={props.isPlaceholder}
|
||||||
|
onCellCountChange={handleCellResize}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
case "dropdown":
|
case "dropdown":
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={textWidgetStyle}
|
style={textWidgetStyle}
|
||||||
className="select-none-cls flex justify-between items-center"
|
className="select-none-cls flex justify-between items-center"
|
||||||
>
|
>
|
||||||
{widgetData || hint || widgetTypeTranslation}
|
{widgetData || t("choose-one")}
|
||||||
<i className="fa-light fa-circle-chevron-down mr-1 "></i>
|
<i className="fa-light fa-circle-chevron-down mr-1 "></i>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
case "initials":
|
case "initials":
|
||||||
return props.pos.SignUrl ? (
|
return props.pos.SignUrl ? (
|
||||||
<img
|
<img
|
||||||
@@ -276,13 +273,15 @@ function PlaceholderType(props) {
|
|||||||
placeholder={hint || widgetTypeTranslation}
|
placeholder={hint || widgetTypeTranslation}
|
||||||
rows={1}
|
rows={1}
|
||||||
value={widgetValue}
|
value={widgetValue}
|
||||||
className={textWidgetCls}
|
className={`${textWidgetCls} ${isReadOnly ? "select-none" : ""}`}
|
||||||
style={{
|
style={{
|
||||||
fontSize: fontSize,
|
fontSize: fontSize,
|
||||||
color: fontColor,
|
color: fontColor,
|
||||||
|
background: isReadOnly ? props.data?.blockColor : "white",
|
||||||
pointerEvents: "none"
|
pointerEvents: "none"
|
||||||
}}
|
}}
|
||||||
cols="50"
|
cols="50"
|
||||||
|
disabled={props.isNeedSign && isReadOnly}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex h-full select-none-cls" style={textWidgetStyle}>
|
<div className="flex h-full select-none-cls" style={textWidgetStyle}>
|
||||||
@@ -297,13 +296,15 @@ function PlaceholderType(props) {
|
|||||||
placeholder={hint || widgetTypeTranslation}
|
placeholder={hint || widgetTypeTranslation}
|
||||||
rows={1}
|
rows={1}
|
||||||
value={widgetValue}
|
value={widgetValue}
|
||||||
className={textWidgetCls}
|
className={`${textWidgetCls} ${isReadOnly ? "select-none" : ""}`}
|
||||||
style={{
|
style={{
|
||||||
fontSize: fontSize,
|
fontSize: fontSize,
|
||||||
color: fontColor,
|
color: fontColor,
|
||||||
|
background: isReadOnly ? props.data?.blockColor : "white",
|
||||||
pointerEvents: "none"
|
pointerEvents: "none"
|
||||||
}}
|
}}
|
||||||
cols="50"
|
cols="50"
|
||||||
|
disabled={props.isNeedSign && isReadOnly}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div style={textWidgetStyle} className="select-none-cls">
|
<div style={textWidgetStyle} className="select-none-cls">
|
||||||
@@ -318,13 +319,15 @@ function PlaceholderType(props) {
|
|||||||
placeholder={hint || widgetTypeTranslation}
|
placeholder={hint || widgetTypeTranslation}
|
||||||
rows={1}
|
rows={1}
|
||||||
value={widgetValue}
|
value={widgetValue}
|
||||||
className={textWidgetCls}
|
className={`${textWidgetCls} ${isReadOnly ? "select-none" : ""}`}
|
||||||
style={{
|
style={{
|
||||||
fontSize: fontSize,
|
fontSize: fontSize,
|
||||||
color: fontColor,
|
color: fontColor,
|
||||||
|
background: isReadOnly ? props.data?.blockColor : "white",
|
||||||
pointerEvents: "none"
|
pointerEvents: "none"
|
||||||
}}
|
}}
|
||||||
cols="50"
|
cols="50"
|
||||||
|
disabled={props.isNeedSign && isReadOnly}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div style={textWidgetStyle} className="select-none-cls">
|
<div style={textWidgetStyle} className="select-none-cls">
|
||||||
@@ -422,15 +425,15 @@ function PlaceholderType(props) {
|
|||||||
placeholder={hint || widgetTypeTranslation}
|
placeholder={hint || widgetTypeTranslation}
|
||||||
rows={1}
|
rows={1}
|
||||||
value={widgetValue}
|
value={widgetValue}
|
||||||
className={textWidgetCls}
|
className={`${textWidgetCls} ${isReadOnly ? "select-none" : ""}`}
|
||||||
style={{
|
style={{
|
||||||
fontSize: fontSize,
|
fontSize: fontSize,
|
||||||
color: fontColor,
|
color: fontColor,
|
||||||
fontFamily: "Arial, sans-serif",
|
background: isReadOnly ? props.data?.blockColor : "white",
|
||||||
pointerEvents: "none"
|
pointerEvents: "none"
|
||||||
}}
|
}}
|
||||||
disabled
|
|
||||||
cols="1"
|
cols="1"
|
||||||
|
disabled={props.isNeedSign && isReadOnly}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div style={textWidgetStyle} className="select-none-cls">
|
<div style={textWidgetStyle} className="select-none-cls">
|
||||||
@@ -438,45 +441,39 @@ function PlaceholderType(props) {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
case radioButtonWidget:
|
case radioButtonWidget:
|
||||||
|
const radioLayout = props.pos.options?.layout || "vertical";
|
||||||
|
const isOnlyOneBtn = props.pos.options?.values?.length > 0 ? true : false;
|
||||||
|
const radioWrapperClass = `flex items-start ${
|
||||||
|
radioLayout === "horizontal"
|
||||||
|
? `flex-row flex-wrap ${isOnlyOneBtn ? "gap-x-2" : ""}`
|
||||||
|
: `flex-col ${isOnlyOneBtn ? "gap-y-[5px]" : ""}`
|
||||||
|
}`; // Using gap-y-1 for consistency, adjust if needed
|
||||||
return (
|
return (
|
||||||
<div>
|
<div className={radioWrapperClass}>
|
||||||
{props.pos.options?.values.map((data, ind) => {
|
{props.pos.options?.values.map((data, ind) => (
|
||||||
return (
|
<div key={ind} className="select-none-cls pointer-events-none">
|
||||||
<div
|
<label
|
||||||
key={ind}
|
htmlFor={`radio-${props.pos.key + ind}`}
|
||||||
className="select-none-cls flex items-center text-center gap-0.5 pointer-events-none"
|
style={{ fontSize: fontSize, color: fontColor }}
|
||||||
|
className="text-xs mb-0 flex items-center gap-1"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
readOnly
|
readOnly
|
||||||
id={`radio-${props.pos.key + ind}`}
|
id={`radio-${props.pos.key + ind}`}
|
||||||
style={{
|
style={{ width: fontSize, height: fontSize, lineHeight: 2 }}
|
||||||
width: fontSize,
|
className={`op-radio rounded-full border-black appearance-none bg-white inline-block align-middle relative ${
|
||||||
height: fontSize,
|
|
||||||
marginTop: ind > 0 ? "10px" : "0px"
|
|
||||||
}}
|
|
||||||
className={`op-radio rounded-full border- border-black appearance-none bg-white inline-block align-middle relative ${
|
|
||||||
handleRadioCheck(data) ? "checked-radio" : ""
|
handleRadioCheck(data) ? "checked-radio" : ""
|
||||||
}`}
|
}`}
|
||||||
type="radio"
|
type="radio"
|
||||||
disabled={
|
disabled={props.isNeedSign && isReadOnly}
|
||||||
props.isNeedSign &&
|
|
||||||
(props.pos.options?.isReadOnly ||
|
|
||||||
props.data?.signerObjId !== props.signerObjId)
|
|
||||||
}
|
|
||||||
checked={handleRadioCheck(data)}
|
checked={handleRadioCheck(data)}
|
||||||
/>
|
/>
|
||||||
{!props.pos.options?.isHideLabel && (
|
{!props.pos.options?.isHideLabel && (
|
||||||
<label
|
<span className="leading-none">{data}</span>
|
||||||
htmlFor={`radio-${props.pos.key + ind}`}
|
|
||||||
style={{ fontSize: fontSize, color: fontColor }}
|
|
||||||
className="text-xs mb-0"
|
|
||||||
>
|
|
||||||
{data}
|
|
||||||
</label>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</label>
|
||||||
);
|
</div>
|
||||||
})}
|
))}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
case textWidget:
|
case textWidget:
|
||||||
@@ -490,7 +487,8 @@ function PlaceholderType(props) {
|
|||||||
style={{
|
style={{
|
||||||
fontFamily: "Arial, sans-serif",
|
fontFamily: "Arial, sans-serif",
|
||||||
fontSize: fontSize,
|
fontSize: fontSize,
|
||||||
color: fontColor
|
color: fontColor,
|
||||||
|
background: "white"
|
||||||
}}
|
}}
|
||||||
cols="50"
|
cols="50"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ function RenderPdf(props) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//function for render placeholder block over pdf document
|
// function for render placeholder block over pdf document (all signing flow)
|
||||||
const checkSignedSigners = (data) => {
|
const checkSignedSigners = (data) => {
|
||||||
let checkSign = [];
|
let checkSign = [];
|
||||||
//condition to handle quick send flow and using normal request sign flow
|
//condition to handle quick send flow and using normal request sign flow
|
||||||
@@ -91,73 +91,71 @@ function RenderPdf(props) {
|
|||||||
: [];
|
: [];
|
||||||
return (
|
return (
|
||||||
checkSign.length === 0 &&
|
checkSign.length === 0 &&
|
||||||
data?.placeHolder?.map((placeData, key) => {
|
data?.placeHolder?.map((placeData, key) => (
|
||||||
return (
|
<React.Fragment key={key}>
|
||||||
<React.Fragment key={key}>
|
{placeData.pageNumber === props.pageNumber &&
|
||||||
{placeData.pageNumber === props.pageNumber &&
|
placeData.pos.map(
|
||||||
placeData.pos.map((pos, ind) => {
|
(pos, ind) =>
|
||||||
return (
|
pos && (
|
||||||
pos && (
|
<React.Fragment key={ind}>
|
||||||
<React.Fragment key={ind}>
|
<Placeholder
|
||||||
<Placeholder
|
pos={pos}
|
||||||
pos={pos}
|
handleSignYourselfImageResize={handleImageResize}
|
||||||
handleSignYourselfImageResize={handleImageResize}
|
index={props.pageNumber}
|
||||||
index={props.pageNumber}
|
xyPosition={props.signerPos}
|
||||||
xyPosition={props.signerPos}
|
setXyPosition={props.setSignerPos}
|
||||||
setXyPosition={props.setSignerPos}
|
data={data}
|
||||||
data={data}
|
setIsResize={props.setIsResize}
|
||||||
setIsResize={props.setIsResize}
|
isShowBorder={props.isSelfSign}
|
||||||
isShowBorder={props.isSelfSign}
|
isAlllowModify={props.isAlllowModify}
|
||||||
isAlllowModify={props.isAlllowModify}
|
signerObjId={props.signerObjectId}
|
||||||
signerObjId={props.signerObjectId}
|
isShowDropdown={true}
|
||||||
isShowDropdown={true}
|
isNeedSign={props.pdfRequest}
|
||||||
isNeedSign={props.pdfRequest}
|
isSelfSign={true}
|
||||||
isSelfSign={true}
|
isSignYourself={false}
|
||||||
isSignYourself={false}
|
posWidth={posWidth}
|
||||||
posWidth={posWidth}
|
posHeight={posHeight}
|
||||||
posHeight={posHeight}
|
isDragging={props.isDragging}
|
||||||
isDragging={props.isDragging}
|
pdfDetails={props.pdfDetails}
|
||||||
pdfDetails={props.pdfDetails}
|
unSignedWidgetId={props.unSignedWidgetId}
|
||||||
unSignedWidgetId={props.unSignedWidgetId}
|
setCurrWidgetsDetails={props.setCurrWidgetsDetails}
|
||||||
setCurrWidgetsDetails={props.setCurrWidgetsDetails}
|
uniqueId={props.uniqueId}
|
||||||
uniqueId={props.uniqueId}
|
scale={props.scale}
|
||||||
scale={props.scale}
|
containerWH={props.containerWH}
|
||||||
containerWH={props.containerWH}
|
pdfOriginalWH={props.pdfOriginalWH}
|
||||||
pdfOriginalWH={props.pdfOriginalWH}
|
pageNumber={props.pageNumber}
|
||||||
pageNumber={props.pageNumber}
|
ispublicTemplate={props.ispublicTemplate}
|
||||||
ispublicTemplate={props.ispublicTemplate}
|
handleUserDetails={props.handleUserDetails}
|
||||||
handleUserDetails={props.handleUserDetails}
|
isResize={props.isResize}
|
||||||
isResize={props.isResize}
|
setIsAgreeTour={props.setIsAgreeTour}
|
||||||
setIsAgreeTour={props.setIsAgreeTour}
|
isAgree={props.isAgree}
|
||||||
isAgree={props.isAgree}
|
handleTabDrag={props.handleTabDrag}
|
||||||
handleTabDrag={props.handleTabDrag}
|
handleStop={props.handleStop}
|
||||||
handleStop={props.handleStop}
|
setUniqueId={props.setUniqueId}
|
||||||
setUniqueId={props.setUniqueId}
|
setIsSelectId={props.setIsSelectId}
|
||||||
setIsSelectId={props.setIsSelectId}
|
handleDeleteSign={props.handleDeleteSign}
|
||||||
handleDeleteSign={props.handleDeleteSign}
|
setIsPageCopy={props.setIsPageCopy}
|
||||||
setIsPageCopy={props.setIsPageCopy}
|
handleTextSettingModal={props.handleTextSettingModal}
|
||||||
handleTextSettingModal={props.handleTextSettingModal}
|
setIsCheckbox={props.setIsCheckbox}
|
||||||
setIsCheckbox={props.setIsCheckbox}
|
isFreeResize={false}
|
||||||
isFreeResize={false}
|
isOpenSignPad={true}
|
||||||
isOpenSignPad={true}
|
assignedWidgetId={props.assignedWidgetId}
|
||||||
assignedWidgetId={props.assignedWidgetId}
|
isApplyAll={true}
|
||||||
isApplyAll={true}
|
setCellCount={props.setCellCount}
|
||||||
setFontSize={props.setFontSize}
|
setFontSize={props.setFontSize}
|
||||||
fontSize={props.fontSize}
|
fontSize={props.fontSize}
|
||||||
fontColor={props.fontColor}
|
fontColor={props.fontColor}
|
||||||
setFontColor={props.setFontColor}
|
setFontColor={props.setFontColor}
|
||||||
setRequestSignTour={props.setRequestSignTour}
|
setRequestSignTour={props.setRequestSignTour}
|
||||||
calculateFontsize={calculateFontsize}
|
calculateFontsize={calculateFontsize}
|
||||||
currWidgetsDetails={props?.currWidgetsDetails}
|
currWidgetsDetails={props?.currWidgetsDetails}
|
||||||
setTempSignerId={props.setTempSignerId}
|
setTempSignerId={props.setTempSignerId}
|
||||||
/>
|
/>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
);
|
)}
|
||||||
})}
|
</React.Fragment>
|
||||||
</React.Fragment>
|
))
|
||||||
);
|
|
||||||
})
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -172,148 +170,138 @@ function RenderPdf(props) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const pdfDataBase64 = `data:application/pdf;base64,${props.pdfBase64Url}`;
|
const pdfDataBase64 = `data:application/pdf;base64,${props.pdfBase64Url}`;
|
||||||
//calculate render height of pdf in mobile view
|
// calculate render height of pdf in mobile view
|
||||||
const handlePageLoadSuccess = (page) => {
|
const handlePageLoadSuccess = (page) => {
|
||||||
const containerWidth = props.divRef.current.offsetWidth; // Get container width
|
if (isMobile) {
|
||||||
const viewport = page.getViewport({ scale: 1 });
|
const containerWidth = props.divRef.current.offsetWidth; // Get container width
|
||||||
const scale = containerWidth / viewport.width; // Scale to fit container width
|
const viewport = page.getViewport({ scale: 1 });
|
||||||
const scaleHeight = viewport.height * scale;
|
const scale = containerWidth / viewport.width; // Scale to fit container width
|
||||||
setScaledHeight(scaleHeight);
|
const scaleHeight = viewport.height * scale;
|
||||||
|
setScaledHeight(scaleHeight);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{props.successEmail && (
|
{props.successEmail && (
|
||||||
<Alert type={"success"}>{t("success-email-alert")}</Alert>
|
<Alert type={"success"}>{t("success-email-alert")}</Alert>
|
||||||
)}
|
)}
|
||||||
{isMobile ? (
|
<RSC
|
||||||
<RSC
|
style={{
|
||||||
|
position: "relative",
|
||||||
|
boxShadow: "rgba(17, 12, 46, 0.15) 0px 48px 100px 0px",
|
||||||
|
height: isMobile
|
||||||
|
? isGuestSigner
|
||||||
|
? window.innerHeight - 49 // 49 is height of header
|
||||||
|
: scaledHeight
|
||||||
|
: `${window.innerHeight}px`,
|
||||||
|
zIndex: 0
|
||||||
|
}}
|
||||||
|
noScrollY={isMobile ? props.scale === 1 : false}
|
||||||
|
noScrollX={props.scale === 1}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
data-tut={isMobile ? "reactourForth" : undefined}
|
||||||
|
className={
|
||||||
|
isMobile
|
||||||
|
? `${isGuestSigner ? "30px" : ""} border-[0.1px] border-[#ebe8e8] overflow-x-auto`
|
||||||
|
: ""
|
||||||
|
}
|
||||||
style={{
|
style={{
|
||||||
position: "relative",
|
width:
|
||||||
boxShadow: "rgba(17, 12, 46, 0.15) 0px 48px 100px 0px",
|
props.containerWH?.width && props.containerWH?.width * props.scale
|
||||||
//49 is height of header
|
|
||||||
height: isGuestSigner ? window.innerHeight - 49 : scaledHeight,
|
|
||||||
zIndex: 0
|
|
||||||
}}
|
}}
|
||||||
noScrollY={props.scale === 1 ? true : false}
|
ref={props.drop}
|
||||||
noScrollX={props.scale === 1 ? true : false}
|
id="container"
|
||||||
>
|
>
|
||||||
<div
|
{props.pdfLoad !== false &&
|
||||||
data-tut="reactourForth"
|
props.containerWH?.width &&
|
||||||
className={`${
|
props.pdfOriginalWH.length > 0 && (
|
||||||
isGuestSigner ? "30px" : ""
|
<>
|
||||||
} border-[0.1px] border-[#ebe8e8] overflow-x-auto`}
|
{props.pdfRequest || props.isSelfSign
|
||||||
style={{
|
? // request sign, guest sign,
|
||||||
width:
|
props.signerPos?.map((data, key) => (
|
||||||
props.containerWH?.width &&
|
|
||||||
props.containerWH?.width * props.scale
|
|
||||||
}}
|
|
||||||
ref={props.drop}
|
|
||||||
id="container"
|
|
||||||
>
|
|
||||||
{props.containerWH?.width &&
|
|
||||||
props.pdfOriginalWH.length > 0 &&
|
|
||||||
(props.pdfRequest || props.isSelfSign
|
|
||||||
? props.signerPos?.map((data, key) => {
|
|
||||||
return (
|
|
||||||
<React.Fragment key={key}>
|
<React.Fragment key={key}>
|
||||||
{checkSignedSigners(data)}
|
{checkSignedSigners(data)}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
))
|
||||||
})
|
: props.placeholder // placeholdersign document, draft document, create template, draft template
|
||||||
: props.placeholder // placeholder mobile
|
? props.signerPos?.map((data, ind) => (
|
||||||
? props.signerPos?.map((data, ind) => {
|
|
||||||
return (
|
|
||||||
<React.Fragment key={ind}>
|
<React.Fragment key={ind}>
|
||||||
{data?.placeHolder &&
|
{data?.placeHolder &&
|
||||||
data?.placeHolder.map((placeData, index) => {
|
data?.placeHolder.map((placeData, index) => (
|
||||||
return (
|
<React.Fragment key={index}>
|
||||||
<React.Fragment key={index}>
|
{placeData.pageNumber === props.pageNumber &&
|
||||||
{placeData.pageNumber === props.pageNumber &&
|
placeData.pos.map((pos) => (
|
||||||
placeData.pos.map((pos) => {
|
<React.Fragment key={pos.key}>
|
||||||
return (
|
<Placeholder
|
||||||
<React.Fragment key={pos.key}>
|
pos={pos}
|
||||||
<Placeholder
|
setIsPageCopy={props.setIsPageCopy}
|
||||||
pos={pos}
|
handleDeleteSign={
|
||||||
setIsPageCopy={props.setIsPageCopy}
|
props.handleDeleteSign
|
||||||
handleDeleteSign={
|
}
|
||||||
props.handleDeleteSign
|
handleTabDrag={props.handleTabDrag}
|
||||||
}
|
handleStop={props.handleStop}
|
||||||
handleTabDrag={props.handleTabDrag}
|
handleSignYourselfImageResize={
|
||||||
handleStop={props.handleStop}
|
handleImageResize
|
||||||
handleSignYourselfImageResize={
|
}
|
||||||
handleImageResize
|
index={props.pageNumber}
|
||||||
}
|
xyPosition={props.signerPos}
|
||||||
index={props.pageNumber}
|
setXyPosition={props.setSignerPos}
|
||||||
xyPosition={props.signerPos}
|
data={data}
|
||||||
setXyPosition={props.setSignerPos}
|
setIsResize={props.setIsResize}
|
||||||
data={data}
|
setShowDropdown={props.setShowDropdown}
|
||||||
setIsResize={props.setIsResize}
|
isShowBorder={true}
|
||||||
setShowDropdown={
|
isPlaceholder={true}
|
||||||
props.setShowDropdown
|
setUniqueId={props.setUniqueId}
|
||||||
}
|
handleLinkUser={props.handleLinkUser}
|
||||||
isShowBorder={true}
|
isSignYourself={false}
|
||||||
isPlaceholder={true}
|
posWidth={posWidth}
|
||||||
setUniqueId={props.setUniqueId}
|
posHeight={posHeight}
|
||||||
handleLinkUser={
|
isDragging={props.isDragging}
|
||||||
props.handleLinkUser
|
setIsValidate={props.setIsValidate}
|
||||||
}
|
setIsRadio={props.setIsRadio}
|
||||||
isSignYourself={false}
|
setIsCheckbox={props.setIsCheckbox}
|
||||||
posWidth={posWidth}
|
setCurrWidgetsDetails={
|
||||||
posHeight={posHeight}
|
props.setCurrWidgetsDetails
|
||||||
isDragging={props.isDragging}
|
}
|
||||||
setIsValidate={props.setIsValidate}
|
handleNameModal={props.handleNameModal}
|
||||||
setIsRadio={props.setIsRadio}
|
setTempSignerId={props.setTempSignerId}
|
||||||
setIsCheckbox={props.setIsCheckbox}
|
uniqueId={props.uniqueId}
|
||||||
setCurrWidgetsDetails={
|
handleTextSettingModal={
|
||||||
props.setCurrWidgetsDetails
|
props.handleTextSettingModal
|
||||||
}
|
}
|
||||||
handleNameModal={
|
scale={props.scale}
|
||||||
props.handleNameModal
|
containerWH={props.containerWH}
|
||||||
}
|
pdfOriginalWH={props.pdfOriginalWH}
|
||||||
setTempSignerId={
|
pageNumber={props.pageNumber}
|
||||||
props.setTempSignerId
|
setIsSelectId={props.setIsSelectId}
|
||||||
}
|
fontSize={props.fontSize}
|
||||||
uniqueId={props.uniqueId}
|
setFontSize={props.setFontSize}
|
||||||
handleTextSettingModal={
|
setCellCount={props.setCellCount}
|
||||||
props.handleTextSettingModal
|
fontColor={props.fontColor}
|
||||||
}
|
setFontColor={props.setFontColor}
|
||||||
scale={props.scale}
|
isResize={props.isResize}
|
||||||
containerWH={props.containerWH}
|
unSignedWidgetId={
|
||||||
pdfOriginalWH={props.pdfOriginalWH}
|
props.unSignedWidgetId
|
||||||
pageNumber={props.pageNumber}
|
}
|
||||||
setIsSelectId={props.setIsSelectId}
|
isFreeResize={true}
|
||||||
fontSize={props.fontSize}
|
calculateFontsize={calculateFontsize}
|
||||||
setFontSize={props.setFontSize}
|
currWidgetsDetails={
|
||||||
fontColor={props.fontColor}
|
props?.currWidgetsDetails
|
||||||
setFontColor={props.setFontColor}
|
}
|
||||||
isResize={props.isResize}
|
/>
|
||||||
unSignedWidgetId={
|
</React.Fragment>
|
||||||
props.unSignedWidgetId
|
))}
|
||||||
}
|
</React.Fragment>
|
||||||
isFreeResize={true}
|
))}
|
||||||
calculateFontsize={
|
|
||||||
calculateFontsize
|
|
||||||
}
|
|
||||||
currWidgetsDetails={
|
|
||||||
props?.currWidgetsDetails
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</React.Fragment>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</React.Fragment>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
))
|
||||||
})
|
: !props.pdfDetails?.[0]?.IsCompleted && // signyourself flow
|
||||||
: !props.pdfDetails?.[0]?.IsCompleted &&
|
props.xyPosition?.map((data, ind) => (
|
||||||
props.xyPosition?.map((data, ind) => {
|
|
||||||
return (
|
|
||||||
<React.Fragment key={ind}>
|
<React.Fragment key={ind}>
|
||||||
{data.pageNumber === props.pageNumber &&
|
{data.pageNumber === props.pageNumber &&
|
||||||
data.pos.map((pos, id) => {
|
data.pos.map(
|
||||||
return (
|
(pos, id) =>
|
||||||
pos && (
|
pos && (
|
||||||
<Placeholder
|
<Placeholder
|
||||||
key={id}
|
key={id}
|
||||||
@@ -359,247 +347,43 @@ function RenderPdf(props) {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
);
|
)}
|
||||||
})}
|
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
))}
|
||||||
}))}
|
</>
|
||||||
{/* Mobile */}
|
)}
|
||||||
<Document
|
<Document
|
||||||
error={<p className="mx-2">{t("failed-to-load-refresh-page")}</p>}
|
error={<p className="mx-2">{t("failed-to-load-refresh-page")}</p>}
|
||||||
onLoadError={() => props.setPdfLoad(false)}
|
onLoadError={(e) => {
|
||||||
loading={t("loading-doc")}
|
console.log("PDF load error", e);
|
||||||
onLoadSuccess={props.pageDetails}
|
props.setPdfLoad(false);
|
||||||
onClick={() =>
|
|
||||||
props.setCurrWidgetsDetails && props.setCurrWidgetsDetails({})
|
|
||||||
}
|
|
||||||
file={pdfDataBase64}
|
|
||||||
>
|
|
||||||
<Page
|
|
||||||
onLoadSuccess={handlePageLoadSuccess}
|
|
||||||
scale={props.scale || 1}
|
|
||||||
key={props.index}
|
|
||||||
pageNumber={props.pageNumber}
|
|
||||||
width={props.containerWH.width}
|
|
||||||
renderAnnotationLayer={false}
|
|
||||||
renderTextLayer={false}
|
|
||||||
onGetAnnotationsError={(error) => {
|
|
||||||
console.log("annotation error", error);
|
|
||||||
}}
|
|
||||||
className="select-none touch-callout-none"
|
|
||||||
/>
|
|
||||||
</Document>
|
|
||||||
</div>
|
|
||||||
</RSC>
|
|
||||||
) : (
|
|
||||||
<RSC
|
|
||||||
style={{
|
|
||||||
position: "relative",
|
|
||||||
boxShadow: "rgba(17, 12, 46, 0.15) 0px 48px 100px 0px",
|
|
||||||
height: window.innerHeight + "px",
|
|
||||||
zIndex: 0
|
|
||||||
}}
|
|
||||||
noScrollY={false}
|
|
||||||
noScrollX={props.scale === 1 ? true : false}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
width:
|
|
||||||
props.containerWH?.width &&
|
|
||||||
props.containerWH?.width * props.scale
|
|
||||||
}}
|
}}
|
||||||
ref={props.drop}
|
loading={t("loading-doc")}
|
||||||
id="container"
|
onLoadSuccess={(pdf) => {
|
||||||
|
props.setPdfLoad(true);
|
||||||
|
props.pageDetails(pdf);
|
||||||
|
}}
|
||||||
|
onClick={() =>
|
||||||
|
props.setCurrWidgetsDetails && props.setCurrWidgetsDetails({})
|
||||||
|
}
|
||||||
|
file={pdfDataBase64}
|
||||||
>
|
>
|
||||||
{props.pdfLoad &&
|
<Page
|
||||||
props.containerWH?.width &&
|
key={props.index}
|
||||||
props.pdfOriginalWH.length > 0 &&
|
onLoadSuccess={handlePageLoadSuccess}
|
||||||
(props.pdfRequest || props.isSelfSign //pdf request sign flow
|
width={props.containerWH.width}
|
||||||
? props.signerPos?.map((data, key) => {
|
scale={props.scale || 1}
|
||||||
return (
|
className={isMobile ? "select-none touch-callout-none" : "-z-[1]"}
|
||||||
<React.Fragment key={key}>
|
pageNumber={props.pageNumber}
|
||||||
{checkSignedSigners(data)}
|
renderAnnotationLayer={false}
|
||||||
</React.Fragment>
|
renderTextLayer={false}
|
||||||
);
|
onGetAnnotationsError={(error) => {
|
||||||
})
|
console.log("annotation error", error);
|
||||||
: props.placeholder //placeholder and template flow
|
}}
|
||||||
? props.signerPos.map((data, ind) => {
|
/>
|
||||||
return (
|
</Document>
|
||||||
<React.Fragment key={ind}>
|
</div>
|
||||||
{data?.placeHolder &&
|
</RSC>
|
||||||
data?.placeHolder.map((placeData, index) => {
|
|
||||||
return (
|
|
||||||
<React.Fragment key={index}>
|
|
||||||
{placeData.pageNumber === props.pageNumber &&
|
|
||||||
placeData.pos.map((pos) => {
|
|
||||||
return (
|
|
||||||
<React.Fragment key={pos.key}>
|
|
||||||
<Placeholder
|
|
||||||
pos={pos}
|
|
||||||
setIsPageCopy={props.setIsPageCopy}
|
|
||||||
handleDeleteSign={
|
|
||||||
props.handleDeleteSign
|
|
||||||
}
|
|
||||||
handleTabDrag={props.handleTabDrag}
|
|
||||||
handleStop={props.handleStop}
|
|
||||||
handleSignYourselfImageResize={
|
|
||||||
handleImageResize
|
|
||||||
}
|
|
||||||
index={props.pageNumber}
|
|
||||||
xyPosition={props.signerPos}
|
|
||||||
setXyPosition={props.setSignerPos}
|
|
||||||
data={data}
|
|
||||||
setIsResize={props.setIsResize}
|
|
||||||
setShowDropdown={
|
|
||||||
props.setShowDropdown
|
|
||||||
}
|
|
||||||
isShowBorder={true}
|
|
||||||
isPlaceholder={true}
|
|
||||||
setUniqueId={props.setUniqueId}
|
|
||||||
handleLinkUser={
|
|
||||||
props.handleLinkUser
|
|
||||||
}
|
|
||||||
isSignYourself={false}
|
|
||||||
posWidth={posWidth}
|
|
||||||
posHeight={posHeight}
|
|
||||||
isDragging={props.isDragging}
|
|
||||||
setIsValidate={props.setIsValidate}
|
|
||||||
setIsRadio={props.setIsRadio}
|
|
||||||
setIsCheckbox={props.setIsCheckbox}
|
|
||||||
setCurrWidgetsDetails={
|
|
||||||
props.setCurrWidgetsDetails
|
|
||||||
}
|
|
||||||
handleNameModal={
|
|
||||||
props.handleNameModal
|
|
||||||
}
|
|
||||||
setTempSignerId={
|
|
||||||
props.setTempSignerId
|
|
||||||
}
|
|
||||||
uniqueId={props.uniqueId}
|
|
||||||
handleTextSettingModal={
|
|
||||||
props.handleTextSettingModal
|
|
||||||
}
|
|
||||||
scale={props.scale}
|
|
||||||
containerWH={props.containerWH}
|
|
||||||
pdfOriginalWH={props.pdfOriginalWH}
|
|
||||||
pageNumber={props.pageNumber}
|
|
||||||
setIsSelectId={props.setIsSelectId}
|
|
||||||
fontSize={props.fontSize}
|
|
||||||
setFontSize={props.setFontSize}
|
|
||||||
fontColor={props.fontColor}
|
|
||||||
setFontColor={props.setFontColor}
|
|
||||||
isResize={props.isResize}
|
|
||||||
unSignedWidgetId={
|
|
||||||
props.unSignedWidgetId
|
|
||||||
}
|
|
||||||
isFreeResize={true}
|
|
||||||
calculateFontsize={
|
|
||||||
calculateFontsize
|
|
||||||
}
|
|
||||||
currWidgetsDetails={
|
|
||||||
props?.currWidgetsDetails
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</React.Fragment>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</React.Fragment>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</React.Fragment>
|
|
||||||
);
|
|
||||||
})
|
|
||||||
: !props.pdfDetails?.[0]?.IsCompleted &&
|
|
||||||
props.xyPosition?.map((data, ind) => {
|
|
||||||
// signyourself flow
|
|
||||||
return (
|
|
||||||
<React.Fragment key={ind}>
|
|
||||||
{data.pageNumber === props.pageNumber &&
|
|
||||||
data.pos.map((pos) => {
|
|
||||||
return (
|
|
||||||
<React.Fragment key={pos.key}>
|
|
||||||
<Placeholder
|
|
||||||
pos={pos}
|
|
||||||
setIsPageCopy={props.setIsPageCopy}
|
|
||||||
handleDeleteSign={props.handleDeleteSign}
|
|
||||||
handleTabDrag={props.handleTabDrag}
|
|
||||||
handleStop={(event, dragElement) =>
|
|
||||||
props.handleStop(
|
|
||||||
event,
|
|
||||||
dragElement,
|
|
||||||
pos.type
|
|
||||||
)
|
|
||||||
}
|
|
||||||
handleSignYourselfImageResize={
|
|
||||||
handleSignYourselfImageResize
|
|
||||||
}
|
|
||||||
index={props.index}
|
|
||||||
xyPosition={props.xyPosition}
|
|
||||||
setXyPosition={props.setXyPosition}
|
|
||||||
isShowBorder={true}
|
|
||||||
isSignYourself={true}
|
|
||||||
posWidth={posWidth}
|
|
||||||
posHeight={posHeight}
|
|
||||||
pdfDetails={props.pdfDetails[0]}
|
|
||||||
isDragging={props.isDragging}
|
|
||||||
setIsCheckbox={props.setIsCheckbox}
|
|
||||||
setCurrWidgetsDetails={
|
|
||||||
props.setCurrWidgetsDetails
|
|
||||||
}
|
|
||||||
handleTextSettingModal={
|
|
||||||
props.handleTextSettingModal
|
|
||||||
}
|
|
||||||
scale={props.scale}
|
|
||||||
containerWH={props.containerWH}
|
|
||||||
pdfOriginalWH={props.pdfOriginalWH}
|
|
||||||
pageNumber={props.pageNumber}
|
|
||||||
fontSize={props.fontSize}
|
|
||||||
setFontSize={props.setFontSize}
|
|
||||||
fontColor={props.fontColor}
|
|
||||||
setFontColor={props.setFontColor}
|
|
||||||
isResize={props.isResize}
|
|
||||||
setIsResize={props.setIsResize}
|
|
||||||
isFreeResize={false}
|
|
||||||
isOpenSignPad={true}
|
|
||||||
calculateFontsize={calculateFontsize}
|
|
||||||
currWidgetsDetails={
|
|
||||||
props?.currWidgetsDetails
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</React.Fragment>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</React.Fragment>
|
|
||||||
);
|
|
||||||
}))}
|
|
||||||
{/* large device */}
|
|
||||||
{/* this component for render pdf document is in middle of the component */}
|
|
||||||
<Document
|
|
||||||
error={<p className="mx-2">{t("failed-to-load-refresh-page")}</p>}
|
|
||||||
onLoadError={() => props.setPdfLoad(false)}
|
|
||||||
loading={t("loading-doc")}
|
|
||||||
onLoadSuccess={props.pageDetails}
|
|
||||||
onClick={() =>
|
|
||||||
props.setCurrWidgetsDetails && props.setCurrWidgetsDetails({})
|
|
||||||
}
|
|
||||||
file={pdfDataBase64}
|
|
||||||
>
|
|
||||||
<Page
|
|
||||||
key={props.index}
|
|
||||||
width={props.containerWH.width}
|
|
||||||
scale={props.scale || 1}
|
|
||||||
className={"-z-[1]"} // when user zoom-in in tablet widgets move backward that's why pass -z-[1]
|
|
||||||
pageNumber={props.pageNumber}
|
|
||||||
renderAnnotationLayer={false}
|
|
||||||
renderTextLayer={false}
|
|
||||||
onGetAnnotationsError={(error) => {
|
|
||||||
console.log("annotation error", error);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Document>
|
|
||||||
</div>
|
|
||||||
</RSC>
|
|
||||||
)}
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ function SelectLanguage(props) {
|
|||||||
{ value: "es", text: "Española" }, //spanish
|
{ value: "es", text: "Española" }, //spanish
|
||||||
{ value: "fr", text: "Français" }, //french
|
{ value: "fr", text: "Français" }, //french
|
||||||
{ value: "it", text: "Italiano" }, //italian
|
{ value: "it", text: "Italiano" }, //italian
|
||||||
{ value: "de", text: "Deutsch" } //german
|
{ value: "de", text: "Deutsch" }, //german
|
||||||
|
{ value: "hi", text: "हिन्दी" } //hindi
|
||||||
];
|
];
|
||||||
const defaultLanguage = i18next.language || "en";
|
const defaultLanguage = i18next.language || "en";
|
||||||
const [lang, setLang] = useState(defaultLanguage);
|
const [lang, setLang] = useState(defaultLanguage);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
isMobile,
|
isMobile,
|
||||||
radioButtonWidget,
|
radioButtonWidget,
|
||||||
textInputWidget,
|
textInputWidget,
|
||||||
|
cellsWidget,
|
||||||
textWidget,
|
textWidget,
|
||||||
widgets
|
widgets
|
||||||
} from "../../constant/Utils";
|
} from "../../constant/Utils";
|
||||||
@@ -37,6 +38,10 @@ function WidgetComponent(props) {
|
|||||||
type: "BOX",
|
type: "BOX",
|
||||||
item: { type: "BOX", id: 7, text: textInputWidget }
|
item: { type: "BOX", id: 7, text: textInputWidget }
|
||||||
});
|
});
|
||||||
|
const [, cells] = useDrag({
|
||||||
|
type: "BOX",
|
||||||
|
item: { type: "BOX", id: 17, text: cellsWidget }
|
||||||
|
});
|
||||||
const [, initials] = useDrag({
|
const [, initials] = useDrag({
|
||||||
type: "BOX",
|
type: "BOX",
|
||||||
item: { type: "BOX", id: 8, text: "initials" }
|
item: { type: "BOX", id: 8, text: "initials" }
|
||||||
@@ -89,6 +94,7 @@ function WidgetComponent(props) {
|
|||||||
date,
|
date,
|
||||||
text,
|
text,
|
||||||
textInput,
|
textInput,
|
||||||
|
cells,
|
||||||
checkbox,
|
checkbox,
|
||||||
dropdown,
|
dropdown,
|
||||||
radioButton,
|
radioButton,
|
||||||
@@ -132,7 +138,9 @@ function WidgetComponent(props) {
|
|||||||
);
|
);
|
||||||
const filterWidgets = widget.filter(
|
const filterWidgets = widget.filter(
|
||||||
(data) =>
|
(data) =>
|
||||||
!["dropdown", radioButtonWidget, textInputWidget].includes(data.type)
|
!["dropdown", radioButtonWidget, textInputWidget].includes(
|
||||||
|
data.type
|
||||||
|
)
|
||||||
);
|
);
|
||||||
const textWidgetData = widget.filter((data) => data.type !== textWidget);
|
const textWidgetData = widget.filter((data) => data.type !== textWidget);
|
||||||
const updateWidgets = props.isSignYourself
|
const updateWidgets = props.isSignYourself
|
||||||
@@ -241,6 +249,7 @@ function WidgetComponent(props) {
|
|||||||
handleDivClick={props.handleDivClick}
|
handleDivClick={props.handleDivClick}
|
||||||
handleMouseLeave={props.handleMouseLeave}
|
handleMouseLeave={props.handleMouseLeave}
|
||||||
signRef={signRef}
|
signRef={signRef}
|
||||||
|
addPositionOfSignature={props.addPositionOfSignature}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import RegexParser from "regex-parser";
|
|||||||
import {
|
import {
|
||||||
signatureTypes,
|
signatureTypes,
|
||||||
textInputWidget,
|
textInputWidget,
|
||||||
|
cellsWidget,
|
||||||
textWidget
|
textWidget
|
||||||
} from "../../constant/Utils";
|
} from "../../constant/Utils";
|
||||||
import { fontColorArr, fontsizeArr } from "../../constant/Utils";
|
import { fontColorArr, fontsizeArr } from "../../constant/Utils";
|
||||||
@@ -19,7 +20,8 @@ const WidgetNameModal = (props) => {
|
|||||||
status: "required",
|
status: "required",
|
||||||
hint: "",
|
hint: "",
|
||||||
textvalidate: "",
|
textvalidate: "",
|
||||||
isReadOnly: false
|
isReadOnly: false,
|
||||||
|
cellCount: 5
|
||||||
});
|
});
|
||||||
const [isValid, setIsValid] = useState(true);
|
const [isValid, setIsValid] = useState(true);
|
||||||
const statusArr = ["Required", "Optional"];
|
const statusArr = ["Required", "Optional"];
|
||||||
@@ -51,12 +53,14 @@ const WidgetNameModal = (props) => {
|
|||||||
props.defaultdata?.options?.validation?.type === "regex"
|
props.defaultdata?.options?.validation?.type === "regex"
|
||||||
? props.defaultdata?.options?.validation?.pattern
|
? props.defaultdata?.options?.validation?.pattern
|
||||||
: props.defaultdata?.options?.validation?.type || "",
|
: props.defaultdata?.options?.validation?.type || "",
|
||||||
isReadOnly: props.defaultdata?.options?.isReadOnly || false
|
isReadOnly: props.defaultdata?.options?.isReadOnly || false,
|
||||||
|
cellCount: props.defaultdata?.options?.cellCount || 5
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setFormdata({
|
setFormdata({
|
||||||
...formdata,
|
...formdata,
|
||||||
name: props.defaultdata?.options?.name || ""
|
name: props.defaultdata?.options?.name || "",
|
||||||
|
cellCount: props.defaultdata?.options?.cellCount || 5
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,6 +87,21 @@ const WidgetNameModal = (props) => {
|
|||||||
props.handleData(data, props.defaultdata?.type);
|
props.handleData(data, props.defaultdata?.type);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
const isTextInput = [textInputWidget, cellsWidget].includes(
|
||||||
|
props.defaultdata?.type
|
||||||
|
);
|
||||||
|
const { isReadOnly, defaultValue, status } = formdata;
|
||||||
|
// If it’s a text‐input widget, enforce that read-only fields have
|
||||||
|
// either a defaultValue or an "optional" status.
|
||||||
|
if (isTextInput) {
|
||||||
|
const readOnlyWithoutValue =
|
||||||
|
isReadOnly && !defaultValue && status !== "optional";
|
||||||
|
|
||||||
|
if (readOnlyWithoutValue) {
|
||||||
|
alert(t("readonly-textinput-error"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
props.handleData(formdata);
|
props.handleData(formdata);
|
||||||
}
|
}
|
||||||
setFormdata({
|
setFormdata({
|
||||||
@@ -91,7 +110,8 @@ const WidgetNameModal = (props) => {
|
|||||||
defaultValue: "",
|
defaultValue: "",
|
||||||
status: "required",
|
status: "required",
|
||||||
hint: "",
|
hint: "",
|
||||||
textvalidate: ""
|
textvalidate: "",
|
||||||
|
cellCount: 5
|
||||||
});
|
});
|
||||||
setSignatureType(signTypes);
|
setSignatureType(signTypes);
|
||||||
}
|
}
|
||||||
@@ -112,7 +132,11 @@ const WidgetNameModal = (props) => {
|
|||||||
} else {
|
} else {
|
||||||
setIsValid(true);
|
setIsValid(true);
|
||||||
}
|
}
|
||||||
setFormdata({ ...formdata, [e.target.name]: e.target.value });
|
const val =
|
||||||
|
props.defaultdata?.type === cellsWidget
|
||||||
|
? e.target.value.slice(0, formdata.cellCount)
|
||||||
|
: e.target.value;
|
||||||
|
setFormdata({ ...formdata, [e.target.name]: val });
|
||||||
};
|
};
|
||||||
|
|
||||||
function handleValidation(type) {
|
function handleValidation(type) {
|
||||||
@@ -123,6 +147,8 @@ const WidgetNameModal = (props) => {
|
|||||||
return "/^\\d+$/";
|
return "/^\\d+$/";
|
||||||
case "text":
|
case "text":
|
||||||
return "/^[a-zA-Zs]+$/";
|
return "/^[a-zA-Zs]+$/";
|
||||||
|
case "ssn":
|
||||||
|
return "^\\d{3}-\\d{2}-\\d{4}$";
|
||||||
default:
|
default:
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
@@ -150,7 +176,7 @@ const WidgetNameModal = (props) => {
|
|||||||
<form
|
<form
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
className={`${
|
className={`${
|
||||||
props.defaultdata?.type === textInputWidget
|
[textInputWidget, cellsWidget].includes(props.defaultdata?.type)
|
||||||
? "pt-0"
|
? "pt-0"
|
||||||
: ["signature", "initials"].includes(props.defaultdata?.type)
|
: ["signature", "initials"].includes(props.defaultdata?.type)
|
||||||
? "pt-2"
|
? "pt-2"
|
||||||
@@ -174,7 +200,21 @@ const WidgetNameModal = (props) => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{props.defaultdata?.type === textInputWidget && (
|
{props.defaultdata?.type === cellsWidget && (
|
||||||
|
<div className="mb-[0.75rem] text-[13px]">
|
||||||
|
<label htmlFor="cellCount">{t("cell-count")}</label>
|
||||||
|
<input
|
||||||
|
className="op-input op-input-bordered op-input-sm focus:outline-none hover:border-base-content w-full text-xs"
|
||||||
|
type="number"
|
||||||
|
min="1"
|
||||||
|
name="cellCount"
|
||||||
|
value={formdata.cellCount}
|
||||||
|
onChange={(e) => handleChange(e)}
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{[textInputWidget, cellsWidget].includes(props.defaultdata?.type) && (
|
||||||
<>
|
<>
|
||||||
<div className="mb-[0.75rem]">
|
<div className="mb-[0.75rem]">
|
||||||
<label htmlFor="name" className="text-[13px]">
|
<label htmlFor="name" className="text-[13px]">
|
||||||
@@ -186,6 +226,11 @@ const WidgetNameModal = (props) => {
|
|||||||
value={formdata.defaultValue}
|
value={formdata.defaultValue}
|
||||||
onChange={(e) => handledefaultChange(e)}
|
onChange={(e) => handledefaultChange(e)}
|
||||||
autoComplete="off"
|
autoComplete="off"
|
||||||
|
maxLength={
|
||||||
|
props.defaultdata?.type === cellsWidget
|
||||||
|
? formdata.cellCount
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
onBlur={() => {
|
onBlur={() => {
|
||||||
if (isValid === false) {
|
if (isValid === false) {
|
||||||
setFormdata({ ...formdata, defaultValue: "" });
|
setFormdata({ ...formdata, defaultValue: "" });
|
||||||
@@ -237,7 +282,9 @@ const WidgetNameModal = (props) => {
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
{[textInputWidget].includes(props.defaultdata?.type) && (
|
{[textInputWidget, cellsWidget].includes(
|
||||||
|
props.defaultdata?.type
|
||||||
|
) && (
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<input
|
<input
|
||||||
id="isReadOnly"
|
id="isReadOnly"
|
||||||
@@ -252,7 +299,7 @@ const WidgetNameModal = (props) => {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<label className="ml-1 mb-0" htmlFor="isreadonly">
|
<label className="ml-1.5 mb-0 capitalize text-[13px]" htmlFor="isreadonly">
|
||||||
{t("read-only")}
|
{t("read-only")}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -304,6 +351,7 @@ const WidgetNameModal = (props) => {
|
|||||||
{[
|
{[
|
||||||
textInputWidget,
|
textInputWidget,
|
||||||
textWidget,
|
textWidget,
|
||||||
|
cellsWidget,
|
||||||
"name",
|
"name",
|
||||||
"company",
|
"company",
|
||||||
"job title",
|
"job title",
|
||||||
|
|||||||
@@ -14,11 +14,12 @@ import {
|
|||||||
onSaveSign,
|
onSaveSign,
|
||||||
radioButtonWidget,
|
radioButtonWidget,
|
||||||
selectCheckbox,
|
selectCheckbox,
|
||||||
signatureTypes,
|
|
||||||
textInputWidget,
|
textInputWidget,
|
||||||
|
cellsWidget,
|
||||||
textWidget,
|
textWidget,
|
||||||
years
|
years
|
||||||
} from "../../constant/Utils";
|
} from "../../constant/Utils";
|
||||||
|
import CellsWidget from "./CellsWidget";
|
||||||
import DatePicker from "react-datepicker";
|
import DatePicker from "react-datepicker";
|
||||||
import "react-datepicker/dist/react-datepicker.css";
|
import "react-datepicker/dist/react-datepicker.css";
|
||||||
import SignatureCanvas from "react-signature-canvas";
|
import SignatureCanvas from "react-signature-canvas";
|
||||||
@@ -85,7 +86,8 @@ function WidgetsValueModal(props) {
|
|||||||
setXyPosition,
|
setXyPosition,
|
||||||
isSave,
|
isSave,
|
||||||
setUniqueId,
|
setUniqueId,
|
||||||
tempSignerId
|
tempSignerId,
|
||||||
|
signatureTypes
|
||||||
} = props;
|
} = props;
|
||||||
const [penColor, setPenColor] = useState("blue");
|
const [penColor, setPenColor] = useState("blue");
|
||||||
const [isOptional, setIsOptional] = useState(true);
|
const [isOptional, setIsOptional] = useState(true);
|
||||||
@@ -93,7 +95,6 @@ function WidgetsValueModal(props) {
|
|||||||
const [isTab, setIsTab] = useState("");
|
const [isTab, setIsTab] = useState("");
|
||||||
const [textWidth, setTextWidth] = useState(0);
|
const [textWidth, setTextWidth] = useState(0);
|
||||||
const [textHeight, setTextHeight] = useState(0);
|
const [textHeight, setTextHeight] = useState(0);
|
||||||
const [signatureType, setSignatureType] = useState("");
|
|
||||||
const [isSignTypes, setIsSignTypes] = useState(true);
|
const [isSignTypes, setIsSignTypes] = useState(true);
|
||||||
const [typedSignature, setTypedSignature] = useState("");
|
const [typedSignature, setTypedSignature] = useState("");
|
||||||
const [selectDate, setSelectDate] = useState({});
|
const [selectDate, setSelectDate] = useState({});
|
||||||
@@ -119,13 +120,33 @@ function WidgetsValueModal(props) {
|
|||||||
const currentUserName = jsonSender && jsonSender?.name;
|
const currentUserName = jsonSender && jsonSender?.name;
|
||||||
const widgetTypeTranslation = t(`widgets-name.${currWidgetsDetails?.type}`);
|
const widgetTypeTranslation = t(`widgets-name.${currWidgetsDetails?.type}`);
|
||||||
const [widgetValue, setWidgetValue] = useState(
|
const [widgetValue, setWidgetValue] = useState(
|
||||||
currWidgetsDetails?.options?.response ||
|
currWidgetsDetails.type !== "checkbox" &&
|
||||||
currWidgetsDetails?.options?.defaultValue
|
(currWidgetsDetails?.options?.response ||
|
||||||
|
currWidgetsDetails?.options?.defaultValue)
|
||||||
);
|
);
|
||||||
const [selectedCheckbox, setSelectedCheckbox] = useState(
|
const [cellsValue, setCellsValue] = useState(() => {
|
||||||
currWidgetsDetails?.options?.response ||
|
const count = currWidgetsDetails?.options?.cellCount || 5;
|
||||||
|
const val =
|
||||||
|
currWidgetsDetails?.options?.response ||
|
||||||
currWidgetsDetails?.options?.defaultValue ||
|
currWidgetsDetails?.options?.defaultValue ||
|
||||||
[]
|
"";
|
||||||
|
return Array.from({ length: count }, (_, i) => val[i] || "");
|
||||||
|
});
|
||||||
|
const cellRefs = useRef([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const count = currWidgetsDetails?.options?.cellCount || 5;
|
||||||
|
const val =
|
||||||
|
currWidgetsDetails?.options?.response ||
|
||||||
|
currWidgetsDetails?.options?.defaultValue ||
|
||||||
|
"";
|
||||||
|
setCellsValue(Array.from({ length: count }, (_, i) => val[i] || ""));
|
||||||
|
}, [currWidgetsDetails?.key]);
|
||||||
|
const [selectedCheckbox, setSelectedCheckbox] = useState(
|
||||||
|
currWidgetsDetails.type === "checkbox" &&
|
||||||
|
(currWidgetsDetails?.options?.response ||
|
||||||
|
currWidgetsDetails?.options?.defaultValue ||
|
||||||
|
[])
|
||||||
);
|
);
|
||||||
const [startDate, setStartDate] = useState(
|
const [startDate, setStartDate] = useState(
|
||||||
currWidgetsDetails?.options?.response
|
currWidgetsDetails?.options?.response
|
||||||
@@ -156,34 +177,6 @@ function WidgetsValueModal(props) {
|
|||||||
setHint(currWidgetsDetails?.type);
|
setHint(currWidgetsDetails?.type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//set already draw or save signature url/text url of signature text type and draw type for initial type and signature type widgets
|
|
||||||
if (currWidgetsDetails && canvasRef.current) {
|
|
||||||
const isWidgetType = currWidgetsDetails?.type;
|
|
||||||
const signatureType = currWidgetsDetails?.signatureType;
|
|
||||||
const url = currWidgetsDetails?.SignUrl;
|
|
||||||
//checking widget type and draw type signature url
|
|
||||||
if (currWidgetsDetails?.type === "initials") {
|
|
||||||
if (isWidgetType === "initials" && signatureType === "draw" && url) {
|
|
||||||
canvasRef.current.fromDataURL(url);
|
|
||||||
}
|
|
||||||
} else if (
|
|
||||||
isWidgetType === "signature" &&
|
|
||||||
signatureType === "draw" &&
|
|
||||||
url
|
|
||||||
) {
|
|
||||||
canvasRef.current.fromDataURL(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
const trimmedName = currentUserName && currentUserName?.trim();
|
|
||||||
const firstCharacter = trimmedName?.charAt(0);
|
|
||||||
const userName =
|
|
||||||
currWidgetsDetails?.type === "initials"
|
|
||||||
? firstCharacter
|
|
||||||
: currentUserName;
|
|
||||||
const signatureValue = currWidgetsDetails?.typeSignature;
|
|
||||||
setTypedSignature(signatureValue || userName || "");
|
|
||||||
setFontSelect("Fasthand");
|
|
||||||
}
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [currWidgetsDetails]); // Added currWidgetsDetails to dependency array for reset logic
|
}, [currWidgetsDetails]); // Added currWidgetsDetails to dependency array for reset logic
|
||||||
|
|
||||||
@@ -231,7 +224,9 @@ function WidgetsValueModal(props) {
|
|||||||
setXyPosition,
|
setXyPosition,
|
||||||
uniqueId,
|
uniqueId,
|
||||||
false,
|
false,
|
||||||
data?.format
|
data?.format,
|
||||||
|
currWidgetsDetails?.options?.fontSize || 12,
|
||||||
|
currWidgetsDetails?.options?.fontColor || "black"
|
||||||
);
|
);
|
||||||
setSelectDate({ date: date, format: data?.format });
|
setSelectDate({ date: date, format: data?.format });
|
||||||
};
|
};
|
||||||
@@ -398,10 +393,9 @@ function WidgetsValueModal(props) {
|
|||||||
|
|
||||||
if (getIndex !== -1) {
|
if (getIndex !== -1) {
|
||||||
setIsSignTypes(true);
|
setIsSignTypes(true);
|
||||||
const tab = signatureTypes[getIndex].name;
|
const tab = signatureTypes?.[getIndex].name;
|
||||||
if (tab === "draw") {
|
if (tab === "draw") {
|
||||||
setIsTab("draw");
|
setIsTab("draw");
|
||||||
setSignatureType("draw");
|
|
||||||
} else if (tab === "upload") {
|
} else if (tab === "upload") {
|
||||||
setIsImageSelect(true);
|
setIsImageSelect(true);
|
||||||
setIsTab("uploadImage");
|
setIsTab("uploadImage");
|
||||||
@@ -425,7 +419,7 @@ function WidgetsValueModal(props) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function isTabEnabled(tabName) {
|
function isTabEnabled(tabName) {
|
||||||
const isEnabled = signatureTypes.find((x) => x.name === tabName)?.enabled;
|
const isEnabled = signatureTypes?.find((x) => x.name === tabName)?.enabled;
|
||||||
return isEnabled;
|
return isEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -447,7 +441,32 @@ function WidgetsValueModal(props) {
|
|||||||
setTypedSignature("");
|
setTypedSignature("");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setWidgetValue("");
|
if (currWidgetsDetails?.type === cellsWidget) {
|
||||||
|
const count =
|
||||||
|
currWidgetsDetails?.options?.cellCount || cellsValue.length || 1;
|
||||||
|
const cleared = Array.from({ length: count }, () => "");
|
||||||
|
setCellsValue(cleared);
|
||||||
|
const combined = cleared.join("");
|
||||||
|
setWidgetValue(combined);
|
||||||
|
onChangeInput(
|
||||||
|
combined,
|
||||||
|
currWidgetsDetails?.key,
|
||||||
|
xyPosition,
|
||||||
|
props.index,
|
||||||
|
setXyPosition,
|
||||||
|
uniqueId
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
setWidgetValue("");
|
||||||
|
onChangeInput(
|
||||||
|
"",
|
||||||
|
currWidgetsDetails?.key,
|
||||||
|
xyPosition,
|
||||||
|
props.index,
|
||||||
|
setXyPosition,
|
||||||
|
uniqueId
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//function for set signature url
|
//function for set signature url
|
||||||
@@ -581,7 +600,7 @@ function WidgetsValueModal(props) {
|
|||||||
if (isTab === "mysignature") {
|
if (isTab === "mysignature") {
|
||||||
setSignature("");
|
setSignature("");
|
||||||
if (currWidgetsDetails?.type === "initials") {
|
if (currWidgetsDetails?.type === "initials") {
|
||||||
handleSaveSignature(signatureType, "initials");
|
handleSaveSignature(isTab, "initials");
|
||||||
} else {
|
} else {
|
||||||
handleSaveSignature(null, "default");
|
handleSaveSignature(null, "default");
|
||||||
}
|
}
|
||||||
@@ -602,34 +621,32 @@ function WidgetsValueModal(props) {
|
|||||||
} else {
|
} else {
|
||||||
setSignature("");
|
setSignature("");
|
||||||
canvasRef?.current?.clear();
|
canvasRef?.current?.clear();
|
||||||
handleSaveSignature(signatureType);
|
handleSaveSignature(isTab);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setPenColor("blue");
|
setPenColor("blue");
|
||||||
} else {
|
} else {
|
||||||
setSignature("");
|
setSignature("");
|
||||||
handleSaveImage(signatureType);
|
handleSaveImage();
|
||||||
}
|
}
|
||||||
setIsImageSelect(false);
|
setIsImageSelect(false);
|
||||||
setIsDefaultSign(false);
|
setIsDefaultSign(false);
|
||||||
setImage();
|
setImage();
|
||||||
handleTab();
|
handleTab();
|
||||||
};
|
};
|
||||||
const autoSignAll = () => {
|
const autoSignAll = (
|
||||||
return (
|
<label className="mb-0 cursor-pointer flex items-center text-sm">
|
||||||
<label className="cursor-pointer flex items-center text-sm">
|
<input
|
||||||
<input
|
className="mr-2 md:mr-3 op-checkbox op-checkbox-xs md:op-checkbox-sm"
|
||||||
className="mr-2 md:mr-3 op-checkbox op-checkbox-xs md:op-checkbox-sm"
|
type="checkbox"
|
||||||
type="checkbox"
|
value={isAutoSign}
|
||||||
value={isAutoSign}
|
onChange={(e) => {
|
||||||
onChange={(e) => {
|
setIsAutoSign(e.target.checked);
|
||||||
setIsAutoSign(e.target.checked);
|
}}
|
||||||
}}
|
/>
|
||||||
/>
|
{t("auto-sign-mssg")}
|
||||||
{t("auto-sign-mssg")}
|
</label>
|
||||||
</label>
|
);
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const loadFont = async () => {
|
const loadFont = async () => {
|
||||||
@@ -649,24 +666,21 @@ function WidgetsValueModal(props) {
|
|||||||
}, [fontSelect]);
|
}, [fontSelect]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (currWidgetsDetails?.options?.response) {
|
||||||
["signature", "initials"].includes(currWidgetsDetails?.type) &&
|
const url = currWidgetsDetails?.options?.response;
|
||||||
widgetValue
|
if (["signature", "initials"].includes(currWidgetsDetails?.type)) {
|
||||||
) {
|
if (isTab === "draw" && currWidgetsDetails?.signatureType === "draw") {
|
||||||
if (isTab === "draw" && currWidgetsDetails?.signatureType === "draw") {
|
setSignature(url);
|
||||||
setSignature(widgetValue);
|
// Load the default signature after the component mounts
|
||||||
} else if (isTab === "uploadImage" && currWidgetsDetails?.ImageType) {
|
if (canvasRef.current) {
|
||||||
setImage({ imgType: currWidgetsDetails?.ImageType, src: widgetValue });
|
canvasRef.current.fromDataURL(url);
|
||||||
|
}
|
||||||
|
} else if (isTab === "uploadImage" && currWidgetsDetails?.ImageType) {
|
||||||
|
setImage({ imgType: currWidgetsDetails?.ImageType, src: url });
|
||||||
|
}
|
||||||
|
} else if (["image", "stamp"].includes(currWidgetsDetails?.type)) {
|
||||||
|
setImage({ imgType: currWidgetsDetails?.ImageType, src: url });
|
||||||
}
|
}
|
||||||
} else if (
|
|
||||||
["image", "stamp"].includes(currWidgetsDetails?.type) &&
|
|
||||||
widgetValue
|
|
||||||
) {
|
|
||||||
setImage({ imgType: currWidgetsDetails?.ImageType, src: widgetValue });
|
|
||||||
}
|
|
||||||
// Load the default signature after the component mounts
|
|
||||||
if (canvasRef.current) {
|
|
||||||
canvasRef.current.fromDataURL(signature);
|
|
||||||
}
|
}
|
||||||
if (isTab === "type") {
|
if (isTab === "type") {
|
||||||
const trimmedName = typedSignature
|
const trimmedName = typedSignature
|
||||||
@@ -683,51 +697,64 @@ function WidgetsValueModal(props) {
|
|||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [isTab]);
|
}, [isTab]);
|
||||||
//function for convert input text value in image
|
// function for convert input text value in image
|
||||||
const convertToImg = async (fontStyle, text, color) => {
|
const convertToImg = async (fontStyle, text, color) => {
|
||||||
//get text content to convert in image
|
// 1) Read the max widget dimensions:
|
||||||
const textContent = text;
|
const maxWidth = currWidgetsDetails.Width; // e.g. 150 px
|
||||||
const fontfamily = fontStyle
|
const maxHeight = currWidgetsDetails.Height; // e.g. 40 px
|
||||||
? fontStyle
|
|
||||||
: fontSelect
|
// 2) Pick a “baseline” font size for measurement:
|
||||||
? fontSelect
|
const baselineFontSizePx = 40;
|
||||||
: "Fasthand";
|
const chosenFontFamily = fontStyle || fontSelect || "Fasthand";
|
||||||
const fontSizeValue = "40px";
|
const fillColor = color || penColor;
|
||||||
//creating span for getting text content width
|
|
||||||
|
// 3) Create a temporary <span> (hidden) to measure the text at 40px:
|
||||||
const span = document.createElement("span");
|
const span = document.createElement("span");
|
||||||
span.textContent = textContent;
|
span.textContent = text;
|
||||||
span.style.font = `${fontSizeValue} ${fontfamily}`; // here put your text size and font family
|
span.style.font = `${baselineFontSizePx}px ${chosenFontFamily}`;
|
||||||
span.style.color = color ? color : penColor;
|
span.style.visibility = "hidden"; // keep it in the DOM so offsetWidth/Height works
|
||||||
span.style.display = "hidden";
|
span.style.whiteSpace = "nowrap"; // so we measure a single line
|
||||||
document.body.appendChild(span); // Replace 'container' with the ID of the container element
|
document.body.appendChild(span);
|
||||||
|
|
||||||
//create canvas to render text in canvas and convert in image
|
// Measured size at 40px:
|
||||||
const canvasElement = document.createElement("canvas");
|
const measuredWidth = span.offsetWidth;
|
||||||
// Draw the text content on the canvas
|
const measuredHeight = span.offsetHeight;
|
||||||
const ctx = canvasElement.getContext("2d");
|
document.body.removeChild(span);
|
||||||
|
|
||||||
|
// 4) Compute uniform scale so that 40px‐sized text fits inside (maxWidth × maxHeight):
|
||||||
|
const scaleX = maxWidth / measuredWidth;
|
||||||
|
const scaleY = maxHeight / measuredHeight;
|
||||||
|
const scale = Math.min(scaleX, scaleY, 1); // never scale up beyond 1
|
||||||
|
|
||||||
|
// 5) Final text size in **CSS px**:
|
||||||
|
const finalFontSizePx = baselineFontSizePx * scale;
|
||||||
|
|
||||||
|
// 6) Create a <canvas> that is ALWAYS maxWidth × maxHeight in **CSS px**,
|
||||||
|
// but use devicePixelRatio for sharpness.
|
||||||
const pixelRatio = window.devicePixelRatio || 1;
|
const pixelRatio = window.devicePixelRatio || 1;
|
||||||
const addExtraWidth = currWidgetsDetails?.type === "initials" ? 10 : 50;
|
const canvas = document.createElement("canvas");
|
||||||
const width = span.offsetWidth + addExtraWidth;
|
|
||||||
const height = span.offsetHeight;
|
|
||||||
setTextWidth(width);
|
|
||||||
setTextHeight(height);
|
|
||||||
const font = span.style["font"];
|
|
||||||
// Set the canvas dimensions to match the span
|
|
||||||
canvasElement.width = width * pixelRatio;
|
|
||||||
canvasElement.height = height * pixelRatio;
|
|
||||||
|
|
||||||
// You can customize text styles if needed
|
// ★ Instead of using `finalTextWidth/Height`, force it to be the max box:
|
||||||
ctx.font = font;
|
canvas.width = Math.ceil(maxWidth * pixelRatio);
|
||||||
ctx.fillStyle = color ? color : penColor; // Set the text color
|
canvas.height = Math.ceil(maxHeight * pixelRatio);
|
||||||
|
|
||||||
|
const ctx = canvas.getContext("2d");
|
||||||
|
ctx.scale(pixelRatio, pixelRatio);
|
||||||
|
|
||||||
|
// 7) Draw the text **centered** inside the full maxWidth×maxHeight box:
|
||||||
|
ctx.font = `${finalFontSizePx}px ${chosenFontFamily}`;
|
||||||
|
ctx.fillStyle = fillColor;
|
||||||
ctx.textAlign = "center";
|
ctx.textAlign = "center";
|
||||||
ctx.textBaseline = "middle";
|
ctx.textBaseline = "middle";
|
||||||
ctx.scale(pixelRatio, pixelRatio);
|
|
||||||
// Draw the content of the span onto the canvas
|
// ★ Center = (maxWidth/2, maxHeight/2):
|
||||||
ctx.fillText(span.textContent, width / 2, height / 2); // Adjust the x,y-coordinate as needed
|
const centerX = maxWidth / 2;
|
||||||
//remove span tag
|
const centerY = maxHeight / 2;
|
||||||
document.body.removeChild(span);
|
|
||||||
// Convert the canvas to image data
|
ctx.fillText(text, centerX, centerY);
|
||||||
const dataUrl = canvasElement.toDataURL("image/png");
|
|
||||||
|
// 8) Export to a PNG data-URL:
|
||||||
|
const dataUrl = canvas.toDataURL("image/png");
|
||||||
setSignature(dataUrl);
|
setSignature(dataUrl);
|
||||||
};
|
};
|
||||||
const PenColorComponent = (props) => {
|
const PenColorComponent = (props) => {
|
||||||
@@ -857,7 +884,7 @@ function WidgetsValueModal(props) {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
const savesigncheckbox = (
|
const savesigncheckbox = (
|
||||||
<label className="cursor-pointer flex items-center mb-0 text-center text-[11px] md:text-base">
|
<label className="cursor-pointer flex items-center mb-0 text-center text-sm">
|
||||||
<input
|
<input
|
||||||
className="mr-2 md:mr-3 op-checkbox op-checkbox-xs md:op-checkbox-sm"
|
className="mr-2 md:mr-3 op-checkbox op-checkbox-xs md:op-checkbox-sm"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@@ -940,6 +967,65 @@ function WidgetsValueModal(props) {
|
|||||||
uniqueId
|
uniqueId
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
const handleCellsInput = (e, idx) => {
|
||||||
|
const val = e.target.value.slice(0, 1);
|
||||||
|
const updated = [...cellsValue];
|
||||||
|
updated[idx] = val;
|
||||||
|
setCellsValue(updated);
|
||||||
|
const combined = updated.join("");
|
||||||
|
setWidgetValue(combined);
|
||||||
|
onChangeInput(
|
||||||
|
combined,
|
||||||
|
currWidgetsDetails?.key,
|
||||||
|
xyPosition,
|
||||||
|
props.index,
|
||||||
|
setXyPosition,
|
||||||
|
uniqueId
|
||||||
|
);
|
||||||
|
if (val) {
|
||||||
|
if (idx < cellRefs.current.length - 1) {
|
||||||
|
cellRefs.current[idx + 1]?.focus();
|
||||||
|
}
|
||||||
|
} else if (idx > 0) {
|
||||||
|
// move focus back when a cell becomes empty
|
||||||
|
cellRefs.current[idx - 1]?.focus();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const handleCellsKeyDown = (e, idx) => {
|
||||||
|
if (e.key === "Backspace" && !cellsValue[idx] && idx > 0) {
|
||||||
|
e.preventDefault();
|
||||||
|
const updated = [...cellsValue];
|
||||||
|
updated[idx - 1] = "";
|
||||||
|
const combined = updated.join("");
|
||||||
|
setCellsValue(updated);
|
||||||
|
setWidgetValue(combined);
|
||||||
|
onChangeInput(
|
||||||
|
combined,
|
||||||
|
currWidgetsDetails?.key,
|
||||||
|
xyPosition,
|
||||||
|
props.index,
|
||||||
|
setXyPosition,
|
||||||
|
uniqueId
|
||||||
|
);
|
||||||
|
cellRefs.current[idx - 1]?.focus();
|
||||||
|
}
|
||||||
|
if (e.key === "Delete") {
|
||||||
|
e.preventDefault();
|
||||||
|
const updated = [...cellsValue];
|
||||||
|
updated[idx] = "";
|
||||||
|
const combined = updated.join("");
|
||||||
|
setCellsValue(updated);
|
||||||
|
setWidgetValue(combined);
|
||||||
|
onChangeInput(
|
||||||
|
combined,
|
||||||
|
currWidgetsDetails?.key,
|
||||||
|
xyPosition,
|
||||||
|
props.index,
|
||||||
|
setXyPosition,
|
||||||
|
uniqueId
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
//function is used to show widgets on modal according to selected widget type checkbox/date/radio/drodown/textbox/signature/image
|
//function is used to show widgets on modal according to selected widget type checkbox/date/radio/drodown/textbox/signature/image
|
||||||
const getWidgetType = (type) => {
|
const getWidgetType = (type) => {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -970,7 +1056,6 @@ function WidgetsValueModal(props) {
|
|||||||
setIsDefaultSign(true);
|
setIsDefaultSign(true);
|
||||||
setIsImageSelect(true);
|
setIsImageSelect(true);
|
||||||
setIsTab("mysignature");
|
setIsTab("mysignature");
|
||||||
setSignatureType("");
|
|
||||||
setImage();
|
setImage();
|
||||||
}}
|
}}
|
||||||
className={`${
|
className={`${
|
||||||
@@ -990,7 +1075,6 @@ function WidgetsValueModal(props) {
|
|||||||
setIsDefaultSign(true);
|
setIsDefaultSign(true);
|
||||||
setIsImageSelect(true);
|
setIsImageSelect(true);
|
||||||
setIsTab("mysignature");
|
setIsTab("mysignature");
|
||||||
setSignatureType("");
|
|
||||||
setImage();
|
setImage();
|
||||||
}}
|
}}
|
||||||
className={`${
|
className={`${
|
||||||
@@ -1027,7 +1111,6 @@ function WidgetsValueModal(props) {
|
|||||||
setIsDefaultSign(false);
|
setIsDefaultSign(false);
|
||||||
setIsImageSelect(true);
|
setIsImageSelect(true);
|
||||||
setIsTab("uploadImage");
|
setIsTab("uploadImage");
|
||||||
setSignatureType("");
|
|
||||||
}}
|
}}
|
||||||
className={`${
|
className={`${
|
||||||
isTab === "uploadImage" && `${isTabCls}`
|
isTab === "uploadImage" && `${isTabCls}`
|
||||||
@@ -1044,7 +1127,6 @@ function WidgetsValueModal(props) {
|
|||||||
setIsDefaultSign(false);
|
setIsDefaultSign(false);
|
||||||
setIsImageSelect(false);
|
setIsImageSelect(false);
|
||||||
setIsTab("type");
|
setIsTab("type");
|
||||||
setSignatureType("");
|
|
||||||
setImage();
|
setImage();
|
||||||
}}
|
}}
|
||||||
className={`${
|
className={`${
|
||||||
@@ -1059,7 +1141,14 @@ function WidgetsValueModal(props) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="mt-4 h-full">
|
<div
|
||||||
|
className={`${
|
||||||
|
currWidgetsDetails?.type === "stamp" ||
|
||||||
|
currWidgetsDetails?.type === "image"
|
||||||
|
? ""
|
||||||
|
: "mt-3"
|
||||||
|
} h-full`}
|
||||||
|
>
|
||||||
{isDefaultSign ? (
|
{isDefaultSign ? (
|
||||||
<>
|
<>
|
||||||
{currWidgetsDetails?.type !== "initials" &&
|
{currWidgetsDetails?.type !== "initials" &&
|
||||||
@@ -1085,7 +1174,7 @@ function WidgetsValueModal(props) {
|
|||||||
{/* Standalone autoSignAll for "My Signature/Initials" (isDefaultSign) if conditions met */}
|
{/* Standalone autoSignAll for "My Signature/Initials" (isDefaultSign) if conditions met */}
|
||||||
{setIsAutoSign && uniqueId && (
|
{setIsAutoSign && uniqueId && (
|
||||||
<div className="flex justify-center my-2">
|
<div className="flex justify-center my-2">
|
||||||
{autoSignAll()}
|
{autoSignAll}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
@@ -1114,7 +1203,7 @@ function WidgetsValueModal(props) {
|
|||||||
{/* Standalone autoSignAll for "My Signature/Initials" (isDefaultSign) if conditions met */}
|
{/* Standalone autoSignAll for "My Signature/Initials" (isDefaultSign) if conditions met */}
|
||||||
{setIsAutoSign && uniqueId && (
|
{setIsAutoSign && uniqueId && (
|
||||||
<div className="flex justify-center my-2">
|
<div className="flex justify-center my-2">
|
||||||
{autoSignAll()}
|
{autoSignAll}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
@@ -1163,9 +1252,8 @@ function WidgetsValueModal(props) {
|
|||||||
["image", "stamp"].includes(
|
["image", "stamp"].includes(
|
||||||
currWidgetsDetails?.type
|
currWidgetsDetails?.type
|
||||||
)))) && (
|
)))) && (
|
||||||
<div className="flex justify-center items-center space-x-4 my-2">
|
<div className="flex justify-center items-center gap-x-2 my-2">
|
||||||
{setIsAutoSign && uniqueId && autoSignAll()}
|
{setIsAutoSign && uniqueId && autoSignAll}
|
||||||
|
|
||||||
{image &&
|
{image &&
|
||||||
(isImageSelect ||
|
(isImageSelect ||
|
||||||
["image", "stamp"].includes(
|
["image", "stamp"].includes(
|
||||||
@@ -1173,7 +1261,7 @@ function WidgetsValueModal(props) {
|
|||||||
)) && (
|
)) && (
|
||||||
<label
|
<label
|
||||||
htmlFor={`removeBgToggleModal-${currWidgetsDetails?.key}`}
|
htmlFor={`removeBgToggleModal-${currWidgetsDetails?.key}`}
|
||||||
className="cursor-pointer flex items-center text-sm"
|
className="mb-0 cursor-pointer flex items-center text-sm"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
@@ -1253,16 +1341,18 @@ function WidgetsValueModal(props) {
|
|||||||
<div className="flex flex-row justify-between mt-[10px]">
|
<div className="flex flex-row justify-between mt-[10px]">
|
||||||
<PenColorComponent />
|
<PenColorComponent />
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col mt-2">
|
<div className="flex flex-row ml-1 mt-2 gap-x-3">
|
||||||
{/* Standalone autoSignAll for "Type" tab if conditions met */}
|
{/* Standalone autoSignAll for "Type" tab if conditions met */}
|
||||||
{setIsAutoSign && uniqueId && (
|
{setIsAutoSign && uniqueId && (
|
||||||
<div className="flex justify-start my-1">
|
<div className="flex justify-start my-1">
|
||||||
{autoSignAll()}
|
{autoSignAll}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{accesstoken && (
|
||||||
|
<div className="flex justify-start my-1">
|
||||||
|
{saveSignCheckbox?.isVisible && savesigncheckbox}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{accesstoken &&
|
|
||||||
saveSignCheckbox?.isVisible &&
|
|
||||||
savesigncheckbox}
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
@@ -1287,55 +1377,56 @@ function WidgetsValueModal(props) {
|
|||||||
<div className="flex flex-row justify-between mt-[10px]">
|
<div className="flex flex-row justify-between mt-[10px]">
|
||||||
<PenColorComponent />
|
<PenColorComponent />
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col mt-2">
|
<div className="flex flex-row ml-1 mt-1 gap-x-3">
|
||||||
{/* Standalone autoSignAll for "Draw" tab if conditions met */}
|
{/* Standalone autoSignAll for "Draw" tab if conditions met */}
|
||||||
{setIsAutoSign && uniqueId && (
|
{setIsAutoSign && uniqueId && (
|
||||||
<div className="flex justify-start my-1">
|
<div className="flex justify-start my-1">
|
||||||
{autoSignAll()}
|
{autoSignAll}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{accesstoken && (
|
||||||
|
<div className="flex justify-start my-1">
|
||||||
|
{saveSignCheckbox?.isVisible && savesigncheckbox}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{accesstoken &&
|
|
||||||
saveSignCheckbox?.isVisible &&
|
|
||||||
savesigncheckbox}
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<div className="mx-3 mb-6 mt-3">
|
||||||
<div className="relative flex flex-row items-center justify-between">
|
<p>{t("at-least-one-signature-type")}</p>
|
||||||
<div className="text-base-content font-bold text-lg">
|
|
||||||
{t("signature")}
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
className="text-[1.5rem] cursor-pointer"
|
|
||||||
onClick={handleCancelBtn}
|
|
||||||
>
|
|
||||||
×
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="mx-3 mb-6 mt-3">
|
|
||||||
<p>{t("at-least-one-signature-type")}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
case "checkbox":
|
case "checkbox":
|
||||||
|
const checkBoxLayout =
|
||||||
|
currWidgetsDetails?.options?.layout || "vertical";
|
||||||
|
const isMultipleCheckbox =
|
||||||
|
currWidgetsDetails?.options?.values?.length > 0 ? true : false;
|
||||||
|
const checkBoxWrapperClass = `flex items-start ${
|
||||||
|
checkBoxLayout === "horizontal"
|
||||||
|
? `flex-row flex-wrap ${isMultipleCheckbox ? "gap-x-2" : ""}`
|
||||||
|
: `flex-col ${isMultipleCheckbox ? "gap-y-[5px]" : ""}`
|
||||||
|
}`; // Using gap-y-1 for consistency, adjust if needed
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="border-[1px] border-gray-300 rounded-[2px] p-1 px-3">
|
<div
|
||||||
{currWidgetsDetails?.options?.values?.map((data, ind) => {
|
className={`border-[1px] border-gray-300 rounded-[2px] pt-1 px-2.5 ${checkBoxWrapperClass}`}
|
||||||
return (
|
>
|
||||||
<div
|
{currWidgetsDetails?.options?.values?.map((data, ind) => (
|
||||||
key={ind}
|
<div key={ind} className=" select-none-cls">
|
||||||
className=" select-none-cls flex items-center text-center gap-0.5"
|
<label
|
||||||
|
htmlFor={`checkbox-${currWidgetsDetails?.key + ind}`}
|
||||||
|
className="text-xs flex items-center gap-1"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
id={`checkbox-${currWidgetsDetails?.key + ind}`}
|
id={`checkbox-${currWidgetsDetails?.key + ind}`}
|
||||||
className={`${
|
className={`${
|
||||||
ind === 0 ? "mt-0" : "mt-[5px]"
|
ind === 0 ? "mt-0" : "mt-[5px]"
|
||||||
} op-checkbox op-checkbox-sm rounded-[1px] `}
|
} op-checkbox op-checkbox-xs rounded-[1px] mt-1`}
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={!!selectCheckbox(ind, selectedCheckbox)}
|
checked={!!selectCheckbox(ind, selectedCheckbox)}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
@@ -1360,17 +1451,10 @@ function WidgetsValueModal(props) {
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{!currWidgetsDetails?.options?.isHideLabel && (
|
{data}
|
||||||
<label
|
</label>
|
||||||
htmlFor={`checkbox-${currWidgetsDetails?.key + ind}`}
|
</div>
|
||||||
className="text-xs mb-0 text-center"
|
))}
|
||||||
>
|
|
||||||
{data}
|
|
||||||
</label>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
case textInputWidget:
|
case textInputWidget:
|
||||||
@@ -1383,6 +1467,19 @@ function WidgetsValueModal(props) {
|
|||||||
className={textInputcls}
|
className={textInputcls}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
case cellsWidget:
|
||||||
|
return (
|
||||||
|
<CellsWidget
|
||||||
|
count={cellsValue.length}
|
||||||
|
height="100%"
|
||||||
|
value={cellsValue.join("")}
|
||||||
|
editable={true}
|
||||||
|
resizable={false}
|
||||||
|
onChange={handleCellsInput}
|
||||||
|
onKeyDown={handleCellsKeyDown}
|
||||||
|
inputRefs={cellRefs}
|
||||||
|
/>
|
||||||
|
);
|
||||||
case "dropdown":
|
case "dropdown":
|
||||||
return (
|
return (
|
||||||
<select
|
<select
|
||||||
@@ -1400,18 +1497,11 @@ function WidgetsValueModal(props) {
|
|||||||
>
|
>
|
||||||
{currWidgetsDetails?.options?.name}
|
{currWidgetsDetails?.options?.name}
|
||||||
</option>
|
</option>
|
||||||
|
{currWidgetsDetails?.options?.values?.map((data, ind) => (
|
||||||
{currWidgetsDetails?.options?.values?.map((data, ind) => {
|
<option key={ind} value={data}>
|
||||||
return (
|
{data}
|
||||||
<option
|
</option>
|
||||||
// style={{ fontSize: fontSize, color: fontColor }}
|
))}
|
||||||
key={ind}
|
|
||||||
value={data}
|
|
||||||
>
|
|
||||||
{data}
|
|
||||||
</option>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</select>
|
</select>
|
||||||
);
|
);
|
||||||
case "name":
|
case "name":
|
||||||
@@ -1511,20 +1601,27 @@ function WidgetsValueModal(props) {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
case radioButtonWidget:
|
case radioButtonWidget:
|
||||||
|
const radioLayout = currWidgetsDetails.options?.layout || "vertical";
|
||||||
|
const isOnlyOneBtn =
|
||||||
|
currWidgetsDetails.options?.values?.length > 0 ? true : false;
|
||||||
|
const radioWrapperClass = `flex items-start ${
|
||||||
|
radioLayout === "horizontal"
|
||||||
|
? `flex-row flex-wrap ${isOnlyOneBtn ? "gap-x-2" : ""}`
|
||||||
|
: `flex-col ${isOnlyOneBtn ? "gap-y-[5px]" : ""}`
|
||||||
|
}`; // Using gap-y-1 for consistency, adjust if needed
|
||||||
return (
|
return (
|
||||||
<div className="border-[1px] border-gray-300 rounded-[2px] p-1 px-3">
|
<div
|
||||||
{currWidgetsDetails?.options?.values.map((data, ind) => {
|
className={`border-[1px] border-gray-300 rounded-[2px] pt-1 px-2.5 ${radioWrapperClass}`}
|
||||||
return (
|
>
|
||||||
<div
|
{currWidgetsDetails?.options?.values.map((data, ind) => (
|
||||||
key={ind}
|
<div key={ind} className="select-none-cls">
|
||||||
className="select-none-cls flex items-center text-center gap-0.5"
|
<label
|
||||||
|
htmlFor={`radio-${currWidgetsDetails?.key + ind}`}
|
||||||
|
className="cursor-pointer flex items-center text-sm gap-1"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
id={`radio-${currWidgetsDetails?.key + ind}`}
|
id={`radio-${currWidgetsDetails?.key + ind}`}
|
||||||
style={{
|
className={`op-radio op-radio-xs mt-1`}
|
||||||
marginTop: ind > 0 ? "10px" : "0px"
|
|
||||||
}}
|
|
||||||
className={`flex justify-center op-radio`}
|
|
||||||
type="radio"
|
type="radio"
|
||||||
value={data}
|
value={data}
|
||||||
checked={handleRadioCheck(data)}
|
checked={handleRadioCheck(data)}
|
||||||
@@ -1532,18 +1629,10 @@ function WidgetsValueModal(props) {
|
|||||||
handleCheckRadio(e.target.value);
|
handleCheckRadio(e.target.value);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{!currWidgetsDetails?.options?.isHideLabel && (
|
<span>{data}</span>
|
||||||
<label
|
</label>
|
||||||
htmlFor={`radio-${currWidgetsDetails?.key + ind}`}
|
</div>
|
||||||
// style={{ fontSize: fontSize, color: fontColor }}
|
))}
|
||||||
className="text-xs mb-0"
|
|
||||||
>
|
|
||||||
{data}
|
|
||||||
</label>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
case textWidget:
|
case textWidget:
|
||||||
@@ -1581,15 +1670,9 @@ function WidgetsValueModal(props) {
|
|||||||
const minCount =
|
const minCount =
|
||||||
currWidgetsDetails?.options?.validation?.minRequiredCount;
|
currWidgetsDetails?.options?.validation?.minRequiredCount;
|
||||||
const parseMin = minCount && parseInt(minCount);
|
const parseMin = minCount && parseInt(minCount);
|
||||||
//get maximum required count if exist
|
if (parseMin > 0) {
|
||||||
const maxCount =
|
|
||||||
currWidgetsDetails?.options?.validation?.maxRequiredCount;
|
|
||||||
const parseMax = maxCount && parseInt(maxCount);
|
|
||||||
if (parseMin > 0 && parseMax > 0) {
|
|
||||||
isRequired = true;
|
isRequired = true;
|
||||||
}
|
}
|
||||||
} else if (isRadio) {
|
|
||||||
isRequired = true;
|
|
||||||
} else {
|
} else {
|
||||||
isRequired = currWidgetsDetails.options?.status === "required";
|
isRequired = currWidgetsDetails.options?.status === "required";
|
||||||
}
|
}
|
||||||
@@ -1652,7 +1735,7 @@ function WidgetsValueModal(props) {
|
|||||||
const validateExpression = (regexValidation) => {
|
const validateExpression = (regexValidation) => {
|
||||||
if (widgetValue && regexValidation) {
|
if (widgetValue && regexValidation) {
|
||||||
let regexObject = regexValidation;
|
let regexObject = regexValidation;
|
||||||
if (props.pos?.options?.validation?.type === "regex") {
|
if (currWidgetsDetails?.options?.validation?.type === "regex") {
|
||||||
regexObject = RegexParser(regexValidation);
|
regexObject = RegexParser(regexValidation);
|
||||||
}
|
}
|
||||||
let isValidate = regexObject.test(widgetValue);
|
let isValidate = regexObject.test(widgetValue);
|
||||||
@@ -1675,7 +1758,12 @@ function WidgetsValueModal(props) {
|
|||||||
validateExpression(regexValidation);
|
validateExpression(regexValidation);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
regexValidation = props.pos?.options?.validation?.pattern || "";
|
// Grab the current pattern (if it exists)
|
||||||
|
const pattern = currWidgetsDetails?.options?.validation?.pattern;
|
||||||
|
// Removed `backwordSupportPattern` (/^[a-zA-Z0-9s]+$/) — it blocked spaces and special characters.
|
||||||
|
const backwordSupportPattern =
|
||||||
|
pattern && pattern === "/^[a-zA-Z0-9s]+$/" ? "" : pattern; // If it matches exactly '/^[a-zA-Z0-9s]+$/', clear it
|
||||||
|
regexValidation = backwordSupportPattern || "";
|
||||||
validateExpression(regexValidation);
|
validateExpression(regexValidation);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1785,21 +1873,70 @@ function WidgetsValueModal(props) {
|
|||||||
setUniqueId(tempSignerId);
|
setUniqueId(tempSignerId);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
//function is used to excecute on click finish button functionality
|
||||||
const handleFinish = () => {
|
const handleFinish = () => {
|
||||||
props?.finishDocument();
|
props?.finishDocument();
|
||||||
dispatch(setIsShowModal({}));
|
dispatch(setIsShowModal({}));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isSave) {
|
||||||
|
handleFinishButton();
|
||||||
|
}
|
||||||
|
}, [isSave]);
|
||||||
|
//'handleFinishButton' function is used to show finish button click on any widge if all required widgtes have response
|
||||||
|
const handleFinishButton = () => {
|
||||||
|
const widgetsPosition = xyPosition?.find((data) => data.Id === uniqueId);
|
||||||
|
//using 'flatMap' create all nested array in one level
|
||||||
|
const editableWidgets = widgetsPosition?.placeHolder?.flatMap((page) =>
|
||||||
|
page.pos
|
||||||
|
.filter((widget) => !widget.options?.isReadOnly)
|
||||||
|
.map((widget) => widget)
|
||||||
|
);
|
||||||
|
const getcurrentwidget = editableWidgets?.find(
|
||||||
|
(data) => data?.key === currWidgetsDetails?.key
|
||||||
|
);
|
||||||
|
if (getcurrentwidget?.options?.response) {
|
||||||
|
props?.setCurrWidgetsDetails(getcurrentwidget);
|
||||||
|
}
|
||||||
|
let isResponse = true;
|
||||||
|
//condition to check all required widgets have response or not then show finish buutton
|
||||||
|
for (const data of editableWidgets) {
|
||||||
|
if (data?.type === "checkbox") {
|
||||||
|
const minCount = data.options?.validation?.minRequiredCount;
|
||||||
|
const parseMin = minCount && parseInt(minCount);
|
||||||
|
const hasNoResponse =
|
||||||
|
(!Array.isArray(data?.options?.response) ||
|
||||||
|
data.options.response.length === 0) &&
|
||||||
|
(!Array.isArray(data?.options?.defaultValue) ||
|
||||||
|
data.options.defaultValue.length === 0);
|
||||||
|
if (parseMin > 0 && hasNoResponse) {
|
||||||
|
isResponse = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (
|
||||||
|
!data.options.response &&
|
||||||
|
!data?.options?.defaultValue &&
|
||||||
|
data.options?.status === "required"
|
||||||
|
) {
|
||||||
|
isResponse = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isResponse) {
|
||||||
|
setIsLastWidget(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ModalUi
|
<ModalUi
|
||||||
isOpen={true}
|
isOpen={true}
|
||||||
handleClose={() => !isShowValidation && handleclose()}
|
handleClose={() => !isShowValidation && handleclose()}
|
||||||
|
position="bottom"
|
||||||
>
|
>
|
||||||
<div className="h-[100%] p-[20px]">
|
<div className="h-[100%] p-[18px]">
|
||||||
{isFinish ? (
|
{isFinish ? (
|
||||||
<>
|
<>
|
||||||
{" "}
|
|
||||||
<div className="p-1 mt-3">
|
<div className="p-1 mt-3">
|
||||||
<span className="text-base">{t("finish-mssg")}</span>
|
<span className="text-base">{t("finish-mssg")}</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -1824,7 +1961,7 @@ function WidgetsValueModal(props) {
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<div className="p-1 m-1">
|
<div>
|
||||||
<div className="relative inline-block">
|
<div className="relative inline-block">
|
||||||
<span className="text-base">
|
<span className="text-base">
|
||||||
{currWidgetsDetails?.options?.name || widgetTypeTranslation}
|
{currWidgetsDetails?.options?.name || widgetTypeTranslation}
|
||||||
@@ -1835,7 +1972,7 @@ function WidgetsValueModal(props) {
|
|||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col justify-center m-2 mt-4">
|
<div className="flex flex-col justify-center m-2 mt-3">
|
||||||
<div className="flex justify-center">
|
<div className="flex justify-center">
|
||||||
{getWidgetType(currWidgetsDetails?.type)}
|
{getWidgetType(currWidgetsDetails?.type)}
|
||||||
</div>
|
</div>
|
||||||
@@ -1852,15 +1989,18 @@ function WidgetsValueModal(props) {
|
|||||||
) ? (
|
) ? (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="op-btn op-btn-ghost mr-1 mt-[2px]"
|
className="op-btn op-btn-ghost op-btn-sm mr-1"
|
||||||
onClick={() => handleClear()}
|
onClick={() => handleClear()}
|
||||||
>
|
>
|
||||||
{t("clear")}
|
{t("clear")}
|
||||||
</button>
|
</button>
|
||||||
) : (
|
) : (
|
||||||
<div className="w-[80px]"></div>
|
<button
|
||||||
|
type="button"
|
||||||
|
className="op-btn op-btn-ghost op-btn-sm mr-1 cursor-default"
|
||||||
|
></button>
|
||||||
)}
|
)}
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{!isSave && <HandleRequiredField />}
|
{!isSave && <HandleRequiredField />}
|
||||||
{isSave ? (
|
{isSave ? (
|
||||||
<button
|
<button
|
||||||
@@ -1888,7 +2028,7 @@ function WidgetsValueModal(props) {
|
|||||||
) : (
|
) : (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="op-btn op-btn-primary op-btn-sm"
|
className="op-btn op-btn-primary op-btn-sm text-xs md:text-sm"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
handleClickOnNext();
|
handleClickOnNext();
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -2,9 +2,19 @@ import React, { useEffect, useState } from "react";
|
|||||||
import AsyncSelect from "react-select/async";
|
import AsyncSelect from "react-select/async";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import { handleUnlinkSigner } from "../../../constant/Utils";
|
||||||
|
|
||||||
const SelectSigners = (props) => {
|
const SelectSigners = (props) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const {
|
||||||
|
signerPos,
|
||||||
|
setSignerPos,
|
||||||
|
signersData,
|
||||||
|
setSignersData,
|
||||||
|
uniqueId,
|
||||||
|
isRemove,
|
||||||
|
handleAddUser
|
||||||
|
} = props;
|
||||||
const [userList, setUserList] = useState([]);
|
const [userList, setUserList] = useState([]);
|
||||||
const [selected, setSelected] = useState();
|
const [selected, setSelected] = useState();
|
||||||
const [userData, setUserData] = useState({});
|
const [userData, setUserData] = useState({});
|
||||||
@@ -30,7 +40,7 @@ const SelectSigners = (props) => {
|
|||||||
//checking if user select no signer option from dropdown
|
//checking if user select no signer option from dropdown
|
||||||
if (item) {
|
if (item) {
|
||||||
//checking selected signer is already assign to the document or not
|
//checking selected signer is already assign to the document or not
|
||||||
const alreadyAssign = props.signersData.some(
|
const alreadyAssign = signersData.some(
|
||||||
(item2) => item2.objectId === item.value
|
(item2) => item2.objectId === item.value
|
||||||
);
|
);
|
||||||
if (alreadyAssign) {
|
if (alreadyAssign) {
|
||||||
@@ -49,7 +59,7 @@ const SelectSigners = (props) => {
|
|||||||
};
|
};
|
||||||
const handleAdd = () => {
|
const handleAdd = () => {
|
||||||
if (userData && userData.objectId) {
|
if (userData && userData.objectId) {
|
||||||
props.details(userData);
|
handleAddUser(userData);
|
||||||
if (props.closePopup) {
|
if (props.closePopup) {
|
||||||
props.closePopup();
|
props.closePopup();
|
||||||
}
|
}
|
||||||
@@ -60,7 +70,13 @@ const SelectSigners = (props) => {
|
|||||||
};
|
};
|
||||||
//function to use remove signer from assigned widgets in create template flow
|
//function to use remove signer from assigned widgets in create template flow
|
||||||
const handleRemove = () => {
|
const handleRemove = () => {
|
||||||
props.handleUnlinkSigner();
|
handleUnlinkSigner(
|
||||||
|
signerPos,
|
||||||
|
setSignerPos,
|
||||||
|
signersData,
|
||||||
|
setSignersData,
|
||||||
|
uniqueId
|
||||||
|
);
|
||||||
if (props.closePopup) {
|
if (props.closePopup) {
|
||||||
props.closePopup();
|
props.closePopup();
|
||||||
}
|
}
|
||||||
@@ -161,7 +177,7 @@ const SelectSigners = (props) => {
|
|||||||
<button className="op-btn op-btn-primary" onClick={() => handleAdd()}>
|
<button className="op-btn op-btn-primary" onClick={() => handleAdd()}>
|
||||||
{t("submit")}
|
{t("submit")}
|
||||||
</button>
|
</button>
|
||||||
{props.isExistSigner && props.handleUnlinkSigner && (
|
{props.isExistSigner && isRemove && (
|
||||||
<button
|
<button
|
||||||
className="op-btn op-btn-accent op-btn-outline"
|
className="op-btn op-btn-accent op-btn-outline"
|
||||||
onClick={() => handleRemove()}
|
onClick={() => handleRemove()}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import React from "react";
|
|
||||||
import { PDFDocument, rgb, degrees } from "pdf-lib";
|
import { PDFDocument, rgb, degrees } from "pdf-lib";
|
||||||
import Parse from "parse";
|
import Parse from "parse";
|
||||||
import { appInfo } from "./appinfo";
|
import { appInfo } from "./appinfo";
|
||||||
@@ -21,7 +20,10 @@ export const isTabAndMobile = window.innerWidth < 1023;
|
|||||||
export const textInputWidget = "text input";
|
export const textInputWidget = "text input";
|
||||||
export const textWidget = "text";
|
export const textWidget = "text";
|
||||||
export const radioButtonWidget = "radio button";
|
export const radioButtonWidget = "radio button";
|
||||||
|
export const cellsWidget = "cells";
|
||||||
|
export function getEnv() {
|
||||||
|
return window?.RUNTIME_ENV || {};
|
||||||
|
}
|
||||||
|
|
||||||
//function for create list of year for date widget
|
//function for create list of year for date widget
|
||||||
export const range = (start, end, step) => {
|
export const range = (start, end, step) => {
|
||||||
@@ -256,6 +258,7 @@ export const widgets = [
|
|||||||
{ type: "date", icon: "fa-light fa-calendar-days", iconSize: "20px" },
|
{ type: "date", icon: "fa-light fa-calendar-days", iconSize: "20px" },
|
||||||
{ type: textWidget, icon: "fa-light fa-text-width", iconSize: "20px" },
|
{ type: textWidget, icon: "fa-light fa-text-width", iconSize: "20px" },
|
||||||
{ type: textInputWidget, icon: "fa-light fa-font", iconSize: "21px" },
|
{ type: textInputWidget, icon: "fa-light fa-font", iconSize: "21px" },
|
||||||
|
{ type: cellsWidget, icon: "fa-light fa-table-cells", iconSize: "20px" },
|
||||||
{ type: "checkbox", icon: "fa-light fa-square-check", iconSize: "22px" },
|
{ type: "checkbox", icon: "fa-light fa-square-check", iconSize: "22px" },
|
||||||
{
|
{
|
||||||
type: "dropdown",
|
type: "dropdown",
|
||||||
@@ -348,6 +351,15 @@ export const addWidgetOptions = (type, signer, widgetValue) => {
|
|||||||
};
|
};
|
||||||
case textInputWidget:
|
case textInputWidget:
|
||||||
return { ...status, name: "Text", isReadOnly: false };
|
return { ...status, name: "Text", isReadOnly: false };
|
||||||
|
case cellsWidget:
|
||||||
|
return {
|
||||||
|
...status,
|
||||||
|
name: "Cells",
|
||||||
|
cellCount: 5,
|
||||||
|
defaultValue: "",
|
||||||
|
validation: { type: "", pattern: "" },
|
||||||
|
isReadOnly: false
|
||||||
|
};
|
||||||
case "initials":
|
case "initials":
|
||||||
return { ...status, name: "Initials" };
|
return { ...status, name: "Initials" };
|
||||||
case "name":
|
case "name":
|
||||||
@@ -415,6 +427,14 @@ export const addWidgetSelfsignOptions = (type, getWidgetValue, owner) => {
|
|||||||
return { name: "Checkbox" };
|
return { name: "Checkbox" };
|
||||||
case textWidget:
|
case textWidget:
|
||||||
return { name: "Text" };
|
return { name: "Text" };
|
||||||
|
case cellsWidget:
|
||||||
|
return {
|
||||||
|
name: "Cells",
|
||||||
|
cellCount: 5,
|
||||||
|
defaultValue: "",
|
||||||
|
validation: { type: "", pattern: "" },
|
||||||
|
isReadOnly: false
|
||||||
|
};
|
||||||
case "initials":
|
case "initials":
|
||||||
return { name: "Initials" };
|
return { name: "Initials" };
|
||||||
case "name":
|
case "name":
|
||||||
@@ -485,6 +505,8 @@ export const defaultWidthHeight = (type) => {
|
|||||||
return { width: 15, height: 19 };
|
return { width: 15, height: 19 };
|
||||||
case textInputWidget:
|
case textInputWidget:
|
||||||
return { width: 150, height: 19 };
|
return { width: 150, height: 19 };
|
||||||
|
case cellsWidget:
|
||||||
|
return { width: 112, height: 22 };
|
||||||
case "dropdown":
|
case "dropdown":
|
||||||
return { width: 120, height: 22 };
|
return { width: 120, height: 22 };
|
||||||
case "initials":
|
case "initials":
|
||||||
@@ -510,10 +532,6 @@ export const defaultWidthHeight = (type) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const resizeBorderExtraWidth = () => {
|
|
||||||
return 20;
|
|
||||||
};
|
|
||||||
|
|
||||||
export async function getBase64FromUrl(url, autosign) {
|
export async function getBase64FromUrl(url, autosign) {
|
||||||
const data = await fetch(url);
|
const data = await fetch(url);
|
||||||
const blob = await data.blob();
|
const blob = await data.blob();
|
||||||
@@ -686,10 +704,14 @@ export const signPdfFun = async (
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const randomId = () => {
|
export const randomId = () => {
|
||||||
const randomBytes = crypto.getRandomValues(new Uint16Array(1));
|
// 1. Grab a cryptographically-secure 32-bit random value
|
||||||
const randomValue = randomBytes[0];
|
const randomBytes = crypto.getRandomValues(new Uint32Array(1));
|
||||||
const randomDigit = 1000 + (randomValue % 9000);
|
const raw = randomBytes[0]; // 0 … 4 294 967 295
|
||||||
return randomDigit;
|
|
||||||
|
// 2. Collapse into a 90 000 000-wide band (0…89 999 999), then shift to 10 000 000…99 999 999
|
||||||
|
const eightDigit = 10_000_000 + (raw % 90_000_000);
|
||||||
|
|
||||||
|
return eightDigit;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createDocument = async (
|
export const createDocument = async (
|
||||||
@@ -862,7 +884,8 @@ export const onChangeInput = (
|
|||||||
initial,
|
initial,
|
||||||
dateFormat,
|
dateFormat,
|
||||||
fontSize,
|
fontSize,
|
||||||
fontColor
|
fontColor,
|
||||||
|
isDateReadOnly
|
||||||
) => {
|
) => {
|
||||||
const isSigners = xyPosition.some((data) => data.signerPtr);
|
const isSigners = xyPosition.some((data) => data.signerPtr);
|
||||||
let filterSignerPos;
|
let filterSignerPos;
|
||||||
@@ -891,6 +914,7 @@ export const onChangeInput = (
|
|||||||
response: value,
|
response: value,
|
||||||
fontSize: fontSize,
|
fontSize: fontSize,
|
||||||
fontColor: fontColor,
|
fontColor: fontColor,
|
||||||
|
isReadOnly: isDateReadOnly || false,
|
||||||
validation: {
|
validation: {
|
||||||
type: "date-format",
|
type: "date-format",
|
||||||
format: dateFormat // This indicates the required date format explicitly.
|
format: dateFormat // This indicates the required date format explicitly.
|
||||||
@@ -968,7 +992,6 @@ export const onChangeInput = (
|
|||||||
setXyPosition(updatePlaceholder);
|
setXyPosition(updatePlaceholder);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//function to increase height of text area on press enter
|
//function to increase height of text area on press enter
|
||||||
export const onChangeHeightOfTextArea = (
|
export const onChangeHeightOfTextArea = (
|
||||||
height,
|
height,
|
||||||
@@ -1114,7 +1137,7 @@ export const addInitialData = (signerPos, setXyPosition, value, userId) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
//function for embed document id
|
//function for embed document id
|
||||||
export const embedDocId = async (pdfDoc, documentId, allPages) => {
|
export const embedDocId = async (pdfOriginalWH, pdfDoc, documentId) => {
|
||||||
const appName =
|
const appName =
|
||||||
"OpenSign™";
|
"OpenSign™";
|
||||||
// `fontBytes` is used to embed custom font in pdf
|
// `fontBytes` is used to embed custom font in pdf
|
||||||
@@ -1123,19 +1146,21 @@ export const embedDocId = async (pdfDoc, documentId, allPages) => {
|
|||||||
);
|
);
|
||||||
pdfDoc.registerFontkit(fontkit);
|
pdfDoc.registerFontkit(fontkit);
|
||||||
const font = await pdfDoc.embedFont(fontBytes, { subset: true });
|
const font = await pdfDoc.embedFont(fontBytes, { subset: true });
|
||||||
for (let i = 0; i < allPages; i++) {
|
//pdfOriginalWH contained all pdf's pages width and height
|
||||||
|
for (let i = 0; i < pdfOriginalWH?.length; i++) {
|
||||||
const fontSize = 10;
|
const fontSize = 10;
|
||||||
const textContent =
|
const textContent =
|
||||||
documentId && `${appName} DocumentId: ${documentId} `;
|
documentId && `${appName} DocumentId: ${documentId} `;
|
||||||
const pages = pdfDoc.getPages();
|
const pages = pdfDoc.getPages();
|
||||||
const page = pages[i];
|
const page = pages[i];
|
||||||
|
const getSize = pdfOriginalWH[i];
|
||||||
try {
|
try {
|
||||||
const getObj = compensateRotation(
|
const getObj = compensateRotation(
|
||||||
page.getRotation().angle,
|
page.getRotation().angle,
|
||||||
10,
|
10,
|
||||||
5,
|
5,
|
||||||
1,
|
1,
|
||||||
page.getSize(),
|
getSize,
|
||||||
fontSize,
|
fontSize,
|
||||||
rgb(0.5, 0.5, 0.5),
|
rgb(0.5, 0.5, 0.5),
|
||||||
font,
|
font,
|
||||||
@@ -1210,8 +1235,8 @@ export function onSaveSign(
|
|||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
});
|
});
|
||||||
//condition when user click on apply(signature,image,typed signature or defaullt signature) all widgets on signature pad for same widgets
|
//condition when draw/upload signature/initials then apply it all related to widgets (signature,image,typed signature or default signature)
|
||||||
if (isAutoSign) {
|
if (isApplyAll || isAutoSign) {
|
||||||
const updatedArray = updateXYposition.map((page) => ({
|
const updatedArray = updateXYposition.map((page) => ({
|
||||||
...page,
|
...page,
|
||||||
pos: page.pos.map(
|
pos: page.pos.map(
|
||||||
@@ -1230,26 +1255,6 @@ export function onSaveSign(
|
|||||||
)
|
)
|
||||||
}));
|
}));
|
||||||
return updatedArray;
|
return updatedArray;
|
||||||
} //condition when user edit signature/initial then updated signature apply all existing drawn signatures
|
|
||||||
else if (isApplyAll) {
|
|
||||||
const updatedArray = updateXYposition.map((page) => ({
|
|
||||||
...page,
|
|
||||||
pos: page.pos.map(
|
|
||||||
(item) =>
|
|
||||||
item.SignUrl && item.type === widgetsType
|
|
||||||
? {
|
|
||||||
...item,
|
|
||||||
Width: posWidth,
|
|
||||||
Height: posHeight,
|
|
||||||
SignUrl: signatureImg,
|
|
||||||
...(type && { signatureType: type }),
|
|
||||||
options: { ...item.options, response: signatureImg },
|
|
||||||
...(typedSignature && { typeSignature: typedSignature })
|
|
||||||
}
|
|
||||||
: item // Otherwise, keep it unchanged
|
|
||||||
)
|
|
||||||
}));
|
|
||||||
return updatedArray;
|
|
||||||
} else {
|
} else {
|
||||||
return updateXYposition;
|
return updateXYposition;
|
||||||
}
|
}
|
||||||
@@ -1358,35 +1363,13 @@ export function onSaveImage(
|
|||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
});
|
});
|
||||||
//condition when user click on apply(stamp) all widgets on signature pad for same widgets
|
//condition when user upload(stamp) then apply it all related to widgets
|
||||||
if (isAutoSign) {
|
if (isApplyAll || isAutoSign) {
|
||||||
const updatedArray = updateXYposition.map((page) => ({
|
const updatedArray = updateXYposition.map((page) => ({
|
||||||
...page,
|
...page,
|
||||||
pos: page.pos.map(
|
pos: page.pos.map(
|
||||||
(item) =>
|
(item) =>
|
||||||
item.type === widgetsType
|
item.type === widgetsType && item.type !== "image"
|
||||||
? {
|
|
||||||
...item,
|
|
||||||
Width: getIMGWH.newWidth,
|
|
||||||
Height: getIMGWH.newHeight,
|
|
||||||
SignUrl: image.src,
|
|
||||||
ImageType: image.imgType,
|
|
||||||
options: {
|
|
||||||
...item.options,
|
|
||||||
response: image.src
|
|
||||||
}
|
|
||||||
}
|
|
||||||
: item // Otherwise, keep it unchanged
|
|
||||||
)
|
|
||||||
}));
|
|
||||||
return updatedArray;
|
|
||||||
} //condition when user edit stamp then updated signature apply all existing drawn signatures
|
|
||||||
else if (isApplyAll) {
|
|
||||||
const updatedArray = updateXYposition.map((page) => ({
|
|
||||||
...page,
|
|
||||||
pos: page.pos.map(
|
|
||||||
(item) =>
|
|
||||||
item.SignUrl && item.type === widgetsType && item.type !== "image"
|
|
||||||
? {
|
? {
|
||||||
...item,
|
...item,
|
||||||
Width: getIMGWH.newWidth,
|
Width: getIMGWH.newWidth,
|
||||||
@@ -1537,7 +1520,13 @@ const getWidgetsFontColor = (type) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
//function for embed multiple signature using pdf-lib
|
//function for embed multiple signature using pdf-lib
|
||||||
export const multiSignEmbed = async (widgets, pdfDoc, signyourself, scale) => {
|
export const multiSignEmbed = async (
|
||||||
|
pdfOriginalWH,
|
||||||
|
widgets,
|
||||||
|
pdfDoc,
|
||||||
|
signyourself,
|
||||||
|
scale
|
||||||
|
) => {
|
||||||
// `fontBytes` is used to embed custom font in pdf
|
// `fontBytes` is used to embed custom font in pdf
|
||||||
const fontBytes = await fileasbytes(
|
const fontBytes = await fileasbytes(
|
||||||
"https://cdn.opensignlabs.com/webfonts/times.ttf"
|
"https://cdn.opensignlabs.com/webfonts/times.ttf"
|
||||||
@@ -1546,6 +1535,11 @@ export const multiSignEmbed = async (widgets, pdfDoc, signyourself, scale) => {
|
|||||||
const font = await pdfDoc.embedFont(fontBytes, { subset: true });
|
const font = await pdfDoc.embedFont(fontBytes, { subset: true });
|
||||||
let hasError = false;
|
let hasError = false;
|
||||||
for (let item of widgets) {
|
for (let item of widgets) {
|
||||||
|
//pdfOriginalWH contained all pdf's pages width and height
|
||||||
|
//'getSize' is used to get particular pdf's page width and height
|
||||||
|
const getSize = pdfOriginalWH.find(
|
||||||
|
(page) => page?.pageNumber === item?.pageNumber
|
||||||
|
);
|
||||||
if (hasError) break; // Stop the outer loop if an error occurred
|
if (hasError) break; // Stop the outer loop if an error occurred
|
||||||
const typeExist = item.pos.some((data) => data?.type);
|
const typeExist = item.pos.some((data) => data?.type);
|
||||||
let updateItem;
|
let updateItem;
|
||||||
@@ -1641,6 +1635,7 @@ export const multiSignEmbed = async (widgets, pdfDoc, signyourself, scale) => {
|
|||||||
const WidgetsTypeTextExist = [
|
const WidgetsTypeTextExist = [
|
||||||
textWidget,
|
textWidget,
|
||||||
textInputWidget,
|
textInputWidget,
|
||||||
|
cellsWidget,
|
||||||
"name",
|
"name",
|
||||||
"company",
|
"company",
|
||||||
"job title",
|
"job title",
|
||||||
@@ -1654,9 +1649,10 @@ export const multiSignEmbed = async (widgets, pdfDoc, signyourself, scale) => {
|
|||||||
const color = position?.options?.fontColor;
|
const color = position?.options?.fontColor;
|
||||||
const updateColorInRgb = getWidgetsFontColor(color);
|
const updateColorInRgb = getWidgetsFontColor(color);
|
||||||
const fontSize = parseInt(position?.options?.fontSize || 12);
|
const fontSize = parseInt(position?.options?.fontSize || 12);
|
||||||
const widgetTypeExist = [
|
const isTextTypeWidget = [
|
||||||
textWidget,
|
textWidget,
|
||||||
textInputWidget,
|
textInputWidget,
|
||||||
|
cellsWidget,
|
||||||
"name",
|
"name",
|
||||||
"company",
|
"company",
|
||||||
"job title",
|
"job title",
|
||||||
@@ -1664,138 +1660,185 @@ export const multiSignEmbed = async (widgets, pdfDoc, signyourself, scale) => {
|
|||||||
"email"
|
"email"
|
||||||
].includes(position.type);
|
].includes(position.type);
|
||||||
if (position.type === "checkbox") {
|
if (position.type === "checkbox") {
|
||||||
let checkboxGapFromTop, isCheck;
|
// Determine layout mode: 'vertical' (default) or 'horizontal'
|
||||||
let y = yPos(position);
|
// const isHorizontal = position.layout === "horizontal";
|
||||||
const optionsFontSize = fontSize || 13;
|
const isHorizontal =
|
||||||
const checkboxSize = fontSize;
|
position?.options?.layout === "horizontal" ? true : false;
|
||||||
const checkboxTextGapFromLeft = fontSize + 5 || 22;
|
// Initial “cursor” positions
|
||||||
|
let currentX = xPos(position);
|
||||||
|
let currentY = yPos(position) + 2;
|
||||||
|
// Size and spacing settings
|
||||||
|
const checkboxSize = fontSize - 1; // checkbox diameter
|
||||||
|
const checkboxTextGapFromLeft = fontSize + 5; // gap between box and its label
|
||||||
|
const verticalGap = fontSize + 3.2; // gap between two rows (vertical layout)
|
||||||
|
let horizontalGap = 0; // will compute after drawing each label
|
||||||
if (position?.options?.values.length > 0) {
|
if (position?.options?.values.length > 0) {
|
||||||
position?.options?.values.forEach((item, ind) => {
|
position.options.values.forEach((item, ind) => {
|
||||||
const checkboxRandomId = "checkbox" + randomId();
|
// 1. Advance the “cursor” on second+ iteration
|
||||||
if (
|
|
||||||
position?.options?.response &&
|
|
||||||
position?.options?.response?.length > 0
|
|
||||||
) {
|
|
||||||
isCheck = position?.options?.response?.includes(ind);
|
|
||||||
} else if (position?.options?.defaultValue) {
|
|
||||||
isCheck = position?.options?.defaultValue?.includes(ind);
|
|
||||||
}
|
|
||||||
|
|
||||||
const checkbox = form.createCheckBox(checkboxRandomId);
|
|
||||||
|
|
||||||
if (ind > 0) {
|
if (ind > 0) {
|
||||||
y = y + checkboxGapFromTop;
|
if (isHorizontal) {
|
||||||
} else {
|
currentX += horizontalGap;
|
||||||
checkboxGapFromTop = fontSize + 5 || 26;
|
} else {
|
||||||
|
currentY += verticalGap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 2. Determine whether this checkbox should be checked
|
||||||
|
let isCheck = false;
|
||||||
|
if (
|
||||||
|
position.options.response &&
|
||||||
|
position.options.response.length > 0
|
||||||
|
) {
|
||||||
|
isCheck = position.options.response.includes(ind);
|
||||||
|
} else if (position.options.defaultValue) {
|
||||||
|
isCheck = position.options.defaultValue.includes(ind);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!position?.options?.isHideLabel) {
|
// 3. Draw the label (if labels are not hidden)
|
||||||
// below line of code is used to embed label with radio button in pdf
|
if (!position.options.isHideLabel) {
|
||||||
|
const labelX = currentX + checkboxTextGapFromLeft;
|
||||||
|
const labelY = currentY - 3;
|
||||||
|
|
||||||
const optionsPosition = compensateRotation(
|
const optionsPosition = compensateRotation(
|
||||||
page.getRotation().angle,
|
page.getRotation().angle,
|
||||||
xPos(position) + checkboxTextGapFromLeft,
|
labelX,
|
||||||
y,
|
labelY,
|
||||||
1,
|
1,
|
||||||
page.getSize(),
|
getSize,
|
||||||
optionsFontSize,
|
fontSize,
|
||||||
updateColorInRgb,
|
updateColorInRgb,
|
||||||
font,
|
font,
|
||||||
page
|
page
|
||||||
);
|
);
|
||||||
page.drawText(item, optionsPosition);
|
page.drawText(item, optionsPosition);
|
||||||
}
|
}
|
||||||
|
// 4. Create and place the actual checkbox
|
||||||
|
const checkboxRandomId = "checkbox" + randomId();
|
||||||
|
const checkbox = form.createCheckBox(checkboxRandomId);
|
||||||
let checkboxObj = {
|
let checkboxObj = {
|
||||||
x: xPos(position),
|
x: currentX,
|
||||||
y: y,
|
y: currentY,
|
||||||
width: checkboxSize,
|
width: checkboxSize,
|
||||||
height: checkboxSize
|
height: checkboxSize
|
||||||
};
|
};
|
||||||
checkboxObj = getWidgetPosition(page, checkboxObj, 1);
|
checkboxObj = getWidgetPosition(page, checkboxObj, 1, getSize);
|
||||||
checkbox.addToPage(page, checkboxObj);
|
checkbox.addToPage(page, checkboxObj);
|
||||||
|
// 5. Check or uncheck as needed, then make read‐only
|
||||||
//applied which checkbox should be checked
|
|
||||||
if (isCheck) {
|
if (isCheck) {
|
||||||
checkbox.check();
|
checkbox.check();
|
||||||
} else {
|
} else {
|
||||||
checkbox.uncheck();
|
checkbox.uncheck();
|
||||||
}
|
}
|
||||||
checkbox.enableReadOnly();
|
checkbox.enableReadOnly();
|
||||||
|
// 6. If horizontal layout, compute how far to shift next checkbox‐circle
|
||||||
|
if (isHorizontal) {
|
||||||
|
// Measure the width of this label text at `fontSize`
|
||||||
|
const textWidth = font.widthOfTextAtSize(item, fontSize);
|
||||||
|
// Next checkbox should come after: [box] + gap + [label text] + extra 10pt padding
|
||||||
|
horizontalGap =
|
||||||
|
checkboxSize + checkboxTextGapFromLeft + textWidth;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (widgetTypeExist) {
|
} else if (isTextTypeWidget) {
|
||||||
let textContent;
|
let textContent = "";
|
||||||
if (position?.options?.response) {
|
if (position?.options?.response) {
|
||||||
textContent = position.options?.response;
|
textContent = position.options?.response;
|
||||||
} else if (position?.options?.defaultValue) {
|
} else if (position?.options?.defaultValue) {
|
||||||
textContent = position?.options?.defaultValue;
|
textContent = position?.options?.defaultValue;
|
||||||
}
|
}
|
||||||
const fixedWidth = widgetWidth; // Set your fixed width
|
if (position.type === cellsWidget) {
|
||||||
const isNewOnEnterLineExist = textContent.includes("\n");
|
const cellCount =
|
||||||
|
position?.options?.cellCount || textContent.length || 1;
|
||||||
// Function to break text into lines based on the fixed width
|
const charWidth = widgetWidth / cellCount;
|
||||||
const NewbreakTextIntoLines = (textContent, width) => {
|
const y = yPos(position) - 4;
|
||||||
const lines = [];
|
for (let i = 0; i < cellCount; i++) {
|
||||||
let currentLine = "";
|
const ch = textContent[i] || "";
|
||||||
|
const charX =
|
||||||
for (const word of textContent.split(" ")) {
|
xPos(position) +
|
||||||
//get text line width
|
charWidth * i +
|
||||||
const lineWidth = font.widthOfTextAtSize(
|
(charWidth - font.widthOfTextAtSize(ch, fontSize)) / 2;
|
||||||
`${currentLine} ${word}`,
|
const textPosition = compensateRotation(
|
||||||
fontSize
|
page.getRotation().angle,
|
||||||
|
charX,
|
||||||
|
y,
|
||||||
|
1,
|
||||||
|
getSize,
|
||||||
|
fontSize,
|
||||||
|
updateColorInRgb,
|
||||||
|
font,
|
||||||
|
page
|
||||||
);
|
);
|
||||||
//check text content line width is less or equal to container width
|
if (ch) page.drawText(ch, textPosition);
|
||||||
if (lineWidth <= width) {
|
|
||||||
currentLine += ` ${word}`;
|
|
||||||
} else {
|
|
||||||
lines.push(currentLine.trim());
|
|
||||||
currentLine = `${word}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lines.push(currentLine.trim());
|
|
||||||
return lines;
|
|
||||||
};
|
|
||||||
// Function to break text into lines based on when user go next line on press enter button
|
|
||||||
const breakTextIntoLines = (textContent, width) => {
|
|
||||||
const lines = [];
|
|
||||||
for (const word of textContent.split("\n")) {
|
|
||||||
const lineWidth = font.widthOfTextAtSize(`${word}`, fontSize);
|
|
||||||
//checking string length to container width
|
|
||||||
//if string length is less then container width it means user press enter button
|
|
||||||
if (lineWidth <= width) {
|
|
||||||
lines.push(word);
|
|
||||||
}
|
|
||||||
//else adjust text content according to width and send it in new line
|
|
||||||
else {
|
|
||||||
const newLine = NewbreakTextIntoLines(word, width);
|
|
||||||
lines.push(...newLine);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
const fixedWidth = widgetWidth; // Set your fixed width
|
||||||
|
const isNewOnEnterLineExist = textContent.includes("\n");
|
||||||
|
|
||||||
return lines;
|
// Function to break text into lines based on the fixed width
|
||||||
};
|
const NewbreakTextIntoLines = (textContent, width) => {
|
||||||
//check if text content have `\n` string it means user press enter to go next line and handle condition
|
const lines = [];
|
||||||
//else auto adjust text content according to container width
|
let currentLine = "";
|
||||||
const lines = isNewOnEnterLineExist
|
|
||||||
? breakTextIntoLines(textContent, fixedWidth)
|
for (const word of textContent.split(" ")) {
|
||||||
: NewbreakTextIntoLines(textContent, fixedWidth);
|
//get text line width
|
||||||
// Set initial y-coordinate for the first line
|
const lineWidth = font.widthOfTextAtSize(
|
||||||
let x = xPos(position);
|
`${currentLine} ${word}`,
|
||||||
let y = yPos(position);
|
fontSize
|
||||||
// Embed each line on the page
|
);
|
||||||
for (const line of lines) {
|
//check text content line width is less or equal to container width
|
||||||
const textPosition = compensateRotation(
|
if (lineWidth <= width) {
|
||||||
page.getRotation().angle,
|
currentLine += ` ${word}`;
|
||||||
x,
|
} else {
|
||||||
y,
|
lines.push(currentLine.trim());
|
||||||
1,
|
currentLine = `${word}`;
|
||||||
page.getSize(),
|
}
|
||||||
fontSize,
|
}
|
||||||
updateColorInRgb,
|
lines.push(currentLine.trim());
|
||||||
font,
|
return lines;
|
||||||
page
|
};
|
||||||
);
|
// Function to break text into lines based on when user go next line on press enter button
|
||||||
page.drawText(line, textPosition);
|
const breakTextIntoLines = (textContent, width) => {
|
||||||
y += 18; // Adjust the line height as needed
|
const lines = [];
|
||||||
|
for (const word of textContent.split("\n")) {
|
||||||
|
const lineWidth = font.widthOfTextAtSize(`${word}`, fontSize);
|
||||||
|
//checking string length to container width
|
||||||
|
//if string length is less then container width it means user press enter button
|
||||||
|
if (lineWidth <= width) {
|
||||||
|
lines.push(word);
|
||||||
|
}
|
||||||
|
//else adjust text content according to width and send it in new line
|
||||||
|
else {
|
||||||
|
const newLine = NewbreakTextIntoLines(word, width);
|
||||||
|
lines.push(...newLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return lines;
|
||||||
|
};
|
||||||
|
//check if text content have `\n` string it means user press enter to go next line and handle condition
|
||||||
|
//else auto adjust text content according to container width
|
||||||
|
const lines = isNewOnEnterLineExist
|
||||||
|
? breakTextIntoLines(textContent, fixedWidth)
|
||||||
|
: NewbreakTextIntoLines(textContent, fixedWidth);
|
||||||
|
// Set initial y-coordinate for the first line
|
||||||
|
let x = xPos(position);
|
||||||
|
let y = yPos(position) - 4;
|
||||||
|
// Embed each line on the page
|
||||||
|
for (const line of lines) {
|
||||||
|
const textPosition = compensateRotation(
|
||||||
|
page.getRotation().angle,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
1,
|
||||||
|
getSize,
|
||||||
|
fontSize,
|
||||||
|
updateColorInRgb,
|
||||||
|
font,
|
||||||
|
page
|
||||||
|
);
|
||||||
|
page.drawText(line, textPosition);
|
||||||
|
y += 18; // Adjust the line height as needed
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (position.type === "dropdown") {
|
} else if (position.type === "dropdown") {
|
||||||
const dropdownRandomId = "dropdown" + randomId();
|
const dropdownRandomId = "dropdown" + randomId();
|
||||||
@@ -1822,7 +1865,12 @@ export const multiSignEmbed = async (widgets, pdfDoc, signyourself, scale) => {
|
|||||||
width: widgetWidth,
|
width: widgetWidth,
|
||||||
height: widgetHeight
|
height: widgetHeight
|
||||||
};
|
};
|
||||||
const dropdownOption = getWidgetPosition(page, dropdownObj, 1);
|
const dropdownOption = getWidgetPosition(
|
||||||
|
page,
|
||||||
|
dropdownObj,
|
||||||
|
1,
|
||||||
|
getSize
|
||||||
|
);
|
||||||
const dropdownSelected = { ...dropdownOption, font: font };
|
const dropdownSelected = { ...dropdownOption, font: font };
|
||||||
dropdown.defaultUpdateAppearances(font);
|
dropdown.defaultUpdateAppearances(font);
|
||||||
dropdown.addToPage(page, dropdownSelected);
|
dropdown.addToPage(page, dropdownSelected);
|
||||||
@@ -1830,27 +1878,46 @@ export const multiSignEmbed = async (widgets, pdfDoc, signyourself, scale) => {
|
|||||||
} else if (position.type === radioButtonWidget) {
|
} else if (position.type === radioButtonWidget) {
|
||||||
const radioRandomId = "radio" + randomId();
|
const radioRandomId = "radio" + randomId();
|
||||||
const radioGroup = form.createRadioGroup(radioRandomId);
|
const radioGroup = form.createRadioGroup(radioRandomId);
|
||||||
let radioOptionGapFromTop;
|
//getting radio buttons options text font size
|
||||||
const optionsFontSize = fontSize || 13;
|
const optionsFontSize = fontSize; // font size for option text
|
||||||
const radioTextGapFromLeft = fontSize + 5 || 20;
|
const radioTextGapFromLeft = fontSize + 6; // gap between circle and its label
|
||||||
const radioSize = fontSize;
|
const radioSize = fontSize; // circle diameter (square of width×height)
|
||||||
let y = yPos(position);
|
// Initial “cursor” positions (from your existing helpers)
|
||||||
|
let currentX = xPos(position) + 2;
|
||||||
|
let currentY = yPos(position);
|
||||||
|
// Vertical gap between two radio‐rows
|
||||||
|
const verticalGap = fontSize + 6;
|
||||||
|
// We’ll compute horizontalGap on the fly—after drawing each label
|
||||||
|
// Initialize to zero (will be set after first option is placed)
|
||||||
|
let horizontalGap = 0;
|
||||||
|
// Determine layout mode: 'vertical' or 'horizontal'.
|
||||||
|
// (You mentioned “add one variable called layout” – here we read it from position.layout.)
|
||||||
|
const isHorizontal =
|
||||||
|
position?.options?.layout === "horizontal" ? true : false;
|
||||||
|
// Loop through each option in the group
|
||||||
if (position?.options?.values.length > 0) {
|
if (position?.options?.values.length > 0) {
|
||||||
position?.options?.values.forEach((item, ind) => {
|
position.options.values.forEach((item, ind) => {
|
||||||
|
// 1. Advance cursor on second+ iteration
|
||||||
if (ind > 0) {
|
if (ind > 0) {
|
||||||
y = y + radioOptionGapFromTop;
|
if (isHorizontal) {
|
||||||
} else {
|
// Move to the right by horizontalGap
|
||||||
radioOptionGapFromTop = fontSize + 10 || 25;
|
currentX += horizontalGap;
|
||||||
|
} else {
|
||||||
|
// Move down by verticalGap (vertical stacking)
|
||||||
|
currentY += verticalGap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// 2. Draw the label text (if not hidden)
|
||||||
if (!position?.options?.isHideLabel) {
|
if (!position?.options?.isHideLabel) {
|
||||||
// below line of code is used to embed label with radio button in pdf
|
// Compute where to draw the text (just to the right of the circle)
|
||||||
|
const labelX = currentX + radioTextGapFromLeft;
|
||||||
|
const labelY = currentY - 2;
|
||||||
const optionsPosition = compensateRotation(
|
const optionsPosition = compensateRotation(
|
||||||
page.getRotation().angle,
|
page.getRotation().angle,
|
||||||
xPos(position) + radioTextGapFromLeft,
|
labelX,
|
||||||
y,
|
labelY,
|
||||||
1,
|
1,
|
||||||
page.getSize(),
|
getSize,
|
||||||
optionsFontSize,
|
optionsFontSize,
|
||||||
updateColorInRgb,
|
updateColorInRgb,
|
||||||
font,
|
font,
|
||||||
@@ -1859,22 +1926,33 @@ export const multiSignEmbed = async (widgets, pdfDoc, signyourself, scale) => {
|
|||||||
|
|
||||||
page.drawText(item, optionsPosition);
|
page.drawText(item, optionsPosition);
|
||||||
}
|
}
|
||||||
|
// 3. Place the radio‐circle itself at (currentX, currentY)
|
||||||
let radioObj = {
|
let radioObj = {
|
||||||
x: xPos(position),
|
x: currentX,
|
||||||
y: y,
|
y: currentY,
|
||||||
width: radioSize,
|
width: radioSize,
|
||||||
height: radioSize
|
height: radioSize
|
||||||
};
|
};
|
||||||
|
|
||||||
radioObj = getWidgetPosition(page, radioObj, 1);
|
radioObj = getWidgetPosition(page, radioObj, 1, getSize);
|
||||||
radioGroup.addOptionToPage(item, page, radioObj);
|
radioGroup.addOptionToPage(item, page, radioObj);
|
||||||
|
// 4. If horizontal layout, re-compute horizontalGap for next iteration:
|
||||||
|
if (isHorizontal) {
|
||||||
|
// Measure how wide the label text is, so we know how far to shift next circle
|
||||||
|
const textWidth = font.widthOfTextAtSize(item, optionsFontSize);
|
||||||
|
// radioSize = the circle. radioTextGapFromLeft = gap between circle and label.
|
||||||
|
// Add a small extra padding (e.g. 10pt) before placing next circle.
|
||||||
|
horizontalGap = radioSize + radioTextGapFromLeft + textWidth;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// 5. Pre‐select a value if provided
|
||||||
if (position?.options?.response) {
|
if (position?.options?.response) {
|
||||||
radioGroup.select(position.options?.response);
|
radioGroup.select(position.options?.response);
|
||||||
} else if (position?.options?.defaultValue) {
|
} else if (position?.options?.defaultValue) {
|
||||||
radioGroup.select(position?.options?.defaultValue);
|
radioGroup.select(position?.options?.defaultValue);
|
||||||
}
|
}
|
||||||
|
// 6. Set to read‐only (if required)
|
||||||
radioGroup.enableReadOnly();
|
radioGroup.enableReadOnly();
|
||||||
} else {
|
} else {
|
||||||
const signature = {
|
const signature = {
|
||||||
@@ -1884,7 +1962,7 @@ export const multiSignEmbed = async (widgets, pdfDoc, signyourself, scale) => {
|
|||||||
height: widgetHeight
|
height: widgetHeight
|
||||||
};
|
};
|
||||||
|
|
||||||
const imageOptions = getWidgetPosition(page, signature, 1);
|
const imageOptions = getWidgetPosition(page, signature, 1, getSize);
|
||||||
page.drawImage(img, imageOptions);
|
page.drawImage(img, imageOptions);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -2611,7 +2689,7 @@ function compensateRotation(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// `getWidgetPosition` is used to calulcate position of image type widget like x, y, width, height for pdf-lib
|
// `getWidgetPosition` is used to calulcate position of image type widget like x, y, width, height for pdf-lib
|
||||||
function getWidgetPosition(page, image, sizeRatio) {
|
function getWidgetPosition(page, image, sizeRatio, getSize) {
|
||||||
let pageWidth;
|
let pageWidth;
|
||||||
// pageHeight;
|
// pageHeight;
|
||||||
if ([90, 270].includes(page.getRotation().angle)) {
|
if ([90, 270].includes(page.getRotation().angle)) {
|
||||||
@@ -2635,7 +2713,7 @@ function getWidgetPosition(page, image, sizeRatio) {
|
|||||||
imageX,
|
imageX,
|
||||||
imageYFromTop,
|
imageYFromTop,
|
||||||
1,
|
1,
|
||||||
page.getSize(),
|
getSize,
|
||||||
imageHeight
|
imageHeight
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -3066,7 +3144,7 @@ export const mailTemplate = (param) => {
|
|||||||
"</td></tr><tr><td style='font-weight:bold;font-family:sans-serif;font-size:15px'>Note</td><td></td><td style='color:#626363;font-weight:bold'>" +
|
"</td></tr><tr><td style='font-weight:bold;font-family:sans-serif;font-size:15px'>Note</td><td></td><td style='color:#626363;font-weight:bold'>" +
|
||||||
param.note +
|
param.note +
|
||||||
"</td></tr><tr><td></td><td></td></tr></table></div> <div style='margin-left:70px'><a target=_blank href=" +
|
"</td></tr><tr><td></td><td></td></tr></table></div> <div style='margin-left:70px'><a target=_blank href=" +
|
||||||
param.sigingUrl +
|
param.signingUrl +
|
||||||
"><button style='padding:12px;background-color:#d46b0f;color:white;border:0px;font-weight:bold;margin-top:30px'>Sign here</button></a></div><div style='display:flex;justify-content:center;margin-top:10px'></div></div></div><div><p> This is an automated email from " +
|
"><button style='padding:12px;background-color:#d46b0f;color:white;border:0px;font-weight:bold;margin-top:30px'>Sign here</button></a></div><div style='display:flex;justify-content:center;margin-top:10px'></div></div></div><div><p> This is an automated email from " +
|
||||||
appName +
|
appName +
|
||||||
". For any queries regarding this email, please contact the sender " +
|
". For any queries regarding this email, please contact the sender " +
|
||||||
@@ -3157,7 +3235,53 @@ export const checkRegularExpress = (validateType, setValidatePlaceholder) => {
|
|||||||
case "text":
|
case "text":
|
||||||
setValidatePlaceholder("please enter text");
|
setValidatePlaceholder("please enter text");
|
||||||
break;
|
break;
|
||||||
|
case "ssn":
|
||||||
|
setValidatePlaceholder("123-45-6789");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
setValidatePlaceholder("please enter value");
|
setValidatePlaceholder("please enter value");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
//function to use unlink signer from widgets
|
||||||
|
export const handleUnlinkSigner = (
|
||||||
|
signerPos,
|
||||||
|
setSignerPos,
|
||||||
|
signersdata,
|
||||||
|
setSignersData,
|
||||||
|
uniqueId
|
||||||
|
) => {
|
||||||
|
//remove existing signer's details from 'signerPos' array
|
||||||
|
const updatePlaceHolder = signerPos.map((x) => {
|
||||||
|
if (x.Id === uniqueId) {
|
||||||
|
return { ...x, signerPtr: {}, signerObjId: "" };
|
||||||
|
}
|
||||||
|
return { ...x };
|
||||||
|
});
|
||||||
|
setSignerPos(updatePlaceHolder);
|
||||||
|
//remove existing signer's details from 'signersdata' array and keep role and id
|
||||||
|
const updateSigner = signersdata.map((item) => {
|
||||||
|
if (item.Id == uniqueId) {
|
||||||
|
return { Role: item.Role, Id: item.Id, blockColor: item.blockColor };
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
setSignersData(updateSigner);
|
||||||
|
};
|
||||||
|
//function is used to get pdf original width and height
|
||||||
|
export const getOriginalWH = async (pdf) => {
|
||||||
|
let pdfWHObj = [];
|
||||||
|
//get total page number
|
||||||
|
const totalPages = pdf?.numPages;
|
||||||
|
//according to page number get all pdf's pages width and height
|
||||||
|
for (let index = 0; index < totalPages; index++) {
|
||||||
|
try {
|
||||||
|
const getPage = await pdf.getPage(index + 1);
|
||||||
|
const width = getPage?.view[2];
|
||||||
|
const height = getPage?.view[3];
|
||||||
|
pdfWHObj.push({ pageNumber: index + 1, width, height });
|
||||||
|
} catch (e) {
|
||||||
|
console.log(`Error getting page ${index + 1} of PDF: ${e.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pdfWHObj;
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
import logo from "../assets/images/logo.png";
|
import logo from "../assets/images/logo.png";
|
||||||
|
import { getEnv } from "./Utils";
|
||||||
|
|
||||||
export function serverUrl_fn() {
|
export function serverUrl_fn() {
|
||||||
let baseUrl = process.env.REACT_APP_SERVERURL
|
const env = getEnv();
|
||||||
? process.env.REACT_APP_SERVERURL
|
const serverurl = env?.REACT_APP_SERVERURL
|
||||||
: window.location.origin + "/api/app";
|
? env.REACT_APP_SERVERURL // env.REACT_APP_SERVERURL is used for prod
|
||||||
|
: process.env.REACT_APP_SERVERURL; // process.env.REACT_APP_SERVERURL is used for dev (locally)
|
||||||
|
let baseUrl = serverurl ? serverurl : window.location.origin + "/api/app";
|
||||||
return baseUrl;
|
return baseUrl;
|
||||||
}
|
}
|
||||||
export const appInfo = {
|
export const appInfo = {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ i18n
|
|||||||
interpolation: {
|
interpolation: {
|
||||||
escapeValue: false // Not needed for react as it escapes by default
|
escapeValue: false // Not needed for react as it escapes by default
|
||||||
},
|
},
|
||||||
whitelist: ["en", "es", "fr", "it", "de"] // List of allowed languages
|
whitelist: ["en", "es", "fr", "it", "de", "hi"] // List of allowed languages
|
||||||
});
|
});
|
||||||
|
|
||||||
export default i18n;
|
export default i18n;
|
||||||
|
|||||||
@@ -186,6 +186,14 @@ export default function reportJson(id) {
|
|||||||
btnIcon: "fa-light fa-envelope",
|
btnIcon: "fa-light fa-envelope",
|
||||||
redirectUrl: "",
|
redirectUrl: "",
|
||||||
action: "saveastemplate"
|
action: "saveastemplate"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
btnId: "8440",
|
||||||
|
btnLabel: "Fix & resend",
|
||||||
|
hoverLabel: "Fix & resend",
|
||||||
|
btnIcon: "fa-light fa-paper-plane",
|
||||||
|
redirectUrl: "",
|
||||||
|
action: "recreatedocument"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
|
const userssetting = [
|
||||||
|
{
|
||||||
|
icon: "fa-light fa-users fa-fw",
|
||||||
|
title: "Users",
|
||||||
|
target: "_self",
|
||||||
|
pageType: "",
|
||||||
|
description: "",
|
||||||
|
objectId: "users"
|
||||||
|
}
|
||||||
|
];
|
||||||
export const subSetting = [
|
export const subSetting = [
|
||||||
{
|
{
|
||||||
icon: "fa-light fa-sliders",
|
icon: "fa-light fa-sliders",
|
||||||
@@ -7,14 +17,7 @@ export const subSetting = [
|
|||||||
description: "",
|
description: "",
|
||||||
objectId: "preferences"
|
objectId: "preferences"
|
||||||
},
|
},
|
||||||
{
|
...userssetting
|
||||||
icon: "fa-light fa-users fa-fw",
|
|
||||||
title: "Users",
|
|
||||||
target: "_self",
|
|
||||||
pageType: "",
|
|
||||||
description: "",
|
|
||||||
objectId: "users"
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const sidebarList = [
|
const sidebarList = [
|
||||||
@@ -65,7 +68,7 @@ const sidebarList = [
|
|||||||
pageType: "report",
|
pageType: "report",
|
||||||
description: "",
|
description: "",
|
||||||
objectId: "6TeaPr321t"
|
objectId: "6TeaPr321t"
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -455,7 +455,7 @@ const Forms = (props) => {
|
|||||||
setBcc([]);
|
setBcc([]);
|
||||||
setFolder({ ObjectId: "", Name: "" });
|
setFolder({ ObjectId: "", Name: "" });
|
||||||
const notifySign =
|
const notifySign =
|
||||||
extUserData?.NotifyOnSignatures
|
extUserData?.NotifyOnSignatures !== undefined
|
||||||
? extUserData?.NotifyOnSignatures
|
? extUserData?.NotifyOnSignatures
|
||||||
: true;
|
: true;
|
||||||
setFormData({
|
setFormData({
|
||||||
@@ -534,7 +534,7 @@ const Forms = (props) => {
|
|||||||
setBcc([]);
|
setBcc([]);
|
||||||
setFolder({ ObjectId: "", Name: "" });
|
setFolder({ ObjectId: "", Name: "" });
|
||||||
const notifySign =
|
const notifySign =
|
||||||
extUserData?.NotifyOnSignatures
|
extUserData?.NotifyOnSignatures !== undefined
|
||||||
? extUserData?.NotifyOnSignatures
|
? extUserData?.NotifyOnSignatures
|
||||||
: true;
|
: true;
|
||||||
let obj = {
|
let obj = {
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ function Login() {
|
|||||||
setState({ ...state, loading: false, alertType: type, alertMsg: msg });
|
setState({ ...state, loading: false, alertType: type, alertMsg: msg });
|
||||||
setTimeout(() => setState({ ...state, alertMsg: "" }), 2000);
|
setTimeout(() => setState({ ...state, alertMsg: "" }), 2000);
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkUserExt = async () => {
|
const checkUserExt = async () => {
|
||||||
const app = await getAppLogo();
|
const app = await getAppLogo();
|
||||||
if (app?.error === "invalid_json") {
|
if (app?.error === "invalid_json") {
|
||||||
@@ -82,11 +83,11 @@ function Login() {
|
|||||||
} else {
|
} else {
|
||||||
setImage(appInfo?.applogo || undefined);
|
setImage(appInfo?.applogo || undefined);
|
||||||
}
|
}
|
||||||
|
dispatch(fetchAppInfo());
|
||||||
if (localStorage.getItem("accesstoken")) {
|
if (localStorage.getItem("accesstoken")) {
|
||||||
setState({ ...state, loading: true });
|
setState({ ...state, loading: true });
|
||||||
GetLoginData();
|
GetLoginData();
|
||||||
}
|
}
|
||||||
dispatch(fetchAppInfo());
|
|
||||||
};
|
};
|
||||||
const handleChange = (event) => {
|
const handleChange = (event) => {
|
||||||
let { name, value } = event.target;
|
let { name, value } = event.target;
|
||||||
@@ -96,20 +97,15 @@ function Login() {
|
|||||||
setState({ ...state, [name]: value });
|
setState({ ...state, [name]: value });
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSubmit = async (event) => {
|
const handleLogin = async (
|
||||||
localStorage.removeItem("accesstoken");
|
) => {
|
||||||
event.preventDefault();
|
const email = state?.email
|
||||||
|
const password = state?.password
|
||||||
|
|
||||||
if (!emailRegex.test(state.email)) {
|
|
||||||
alert("Please enter a valid email address.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { email, password } = state;
|
|
||||||
if (!email || !password) {
|
if (!email || !password) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
localStorage.removeItem("accesstoken");
|
||||||
try {
|
try {
|
||||||
setState({ ...state, loading: true });
|
setState({ ...state, loading: true });
|
||||||
localStorage.setItem("appLogo", appInfo.applogo);
|
localStorage.setItem("appLogo", appInfo.applogo);
|
||||||
@@ -132,6 +128,14 @@ function Login() {
|
|||||||
showToast("danger", "Invalid username/password or region");
|
showToast("danger", "Invalid username/password or region");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const handleLoginBtn = async (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
if (!emailRegex.test(state.email)) {
|
||||||
|
alert("Please enter a valid email address.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await handleLogin();
|
||||||
|
};
|
||||||
|
|
||||||
const setThirdpartyLoader = (value) => {
|
const setThirdpartyLoader = (value) => {
|
||||||
setState({ ...state, thirdpartyLoader: value });
|
setState({ ...state, thirdpartyLoader: value });
|
||||||
@@ -275,7 +279,6 @@ function Login() {
|
|||||||
const userInformation = JSON.parse(
|
const userInformation = JSON.parse(
|
||||||
localStorage.getItem("UserInformation")
|
localStorage.getItem("UserInformation")
|
||||||
);
|
);
|
||||||
// console.log("payload ", payload);
|
|
||||||
if (payload && payload.sessionToken) {
|
if (payload && payload.sessionToken) {
|
||||||
const params = {
|
const params = {
|
||||||
userDetails: {
|
userDetails: {
|
||||||
@@ -289,7 +292,6 @@ function Login() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const userSignUp = await Parse.Cloud.run("usersignup", params);
|
const userSignUp = await Parse.Cloud.run("usersignup", params);
|
||||||
// console.log("userSignUp ", userSignUp);
|
|
||||||
if (userSignUp && userSignUp.sessionToken) {
|
if (userSignUp && userSignUp.sessionToken) {
|
||||||
const LocalUserDetails = {
|
const LocalUserDetails = {
|
||||||
name: userInformation.name,
|
name: userInformation.name,
|
||||||
@@ -430,7 +432,7 @@ function Login() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-x-2">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-x-2">
|
||||||
<div>
|
<div>
|
||||||
<form onSubmit={handleSubmit} aria-label="Login Form">
|
<form onSubmit={handleLoginBtn} aria-label="Login Form">
|
||||||
<h1 className="text-[30px] mt-6">{t("welcome")}</h1>
|
<h1 className="text-[30px] mt-6">{t("welcome")}</h1>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend className="text-[12px] text-[#878787]">
|
<legend className="text-[12px] text-[#878787]">
|
||||||
@@ -488,15 +490,14 @@ function Login() {
|
|||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="relative mt-1">
|
||||||
<div className="relative mt-1">
|
<NavLink
|
||||||
<NavLink
|
to="/forgetpassword"
|
||||||
to="/forgetpassword"
|
className="text-[13px] op-link op-link-primary underline-offset-1 focus:outline-none ml-1"
|
||||||
className="text-[13px] op-link op-link-primary underline-offset-1 focus:outline-none ml-1"
|
>
|
||||||
>
|
{t("forgot-password")}
|
||||||
{t("forgot-password")}
|
</NavLink>
|
||||||
</NavLink>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-2 text-center text-xs font-bold mt-2">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-2 text-center text-xs font-bold mt-2">
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useRef, useEffect } from "react";
|
import { useState, useRef, useEffect } from "react";
|
||||||
import { PDFDocument } from "pdf-lib";
|
import { PDFDocument } from "pdf-lib";
|
||||||
import "../styles/signature.css";
|
import "../styles/signature.css";
|
||||||
import Parse from "parse";
|
import Parse from "parse";
|
||||||
@@ -46,7 +46,8 @@ import {
|
|||||||
textWidget,
|
textWidget,
|
||||||
mailTemplate,
|
mailTemplate,
|
||||||
updateDateWidgetsRes,
|
updateDateWidgetsRes,
|
||||||
widgetDataValue
|
widgetDataValue,
|
||||||
|
getOriginalWH,
|
||||||
} from "../constant/Utils";
|
} from "../constant/Utils";
|
||||||
import Header from "../components/pdf/PdfHeader";
|
import Header from "../components/pdf/PdfHeader";
|
||||||
import RenderPdf from "../components/pdf/RenderPdf";
|
import RenderPdf from "../components/pdf/RenderPdf";
|
||||||
@@ -158,6 +159,9 @@ function PdfRequestFiles(
|
|||||||
const [assignedWidgetId, setAssignedWidgetId] = useState([]);
|
const [assignedWidgetId, setAssignedWidgetId] = useState([]);
|
||||||
const [showSignPagenumber, setShowSignPagenumber] = useState([]);
|
const [showSignPagenumber, setShowSignPagenumber] = useState([]);
|
||||||
const [owner, setOwner] = useState({});
|
const [owner, setOwner] = useState({});
|
||||||
|
const [currentIndex, setCurrentIndex] = useState(0);
|
||||||
|
const [formData, setFormData] = useState([]);
|
||||||
|
const [vacantRole, setVacantRole] = useState();
|
||||||
const [, drop] = useDrop({
|
const [, drop] = useDrop({
|
||||||
accept: "BOX",
|
accept: "BOX",
|
||||||
drop: (item, monitor) => addPositionOfSignature(item, monitor),
|
drop: (item, monitor) => addPositionOfSignature(item, monitor),
|
||||||
@@ -623,6 +627,7 @@ function PdfRequestFiles(
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("err in get email verification ", err);
|
console.log("err in get email verification ", err);
|
||||||
setHandleError(t("something-went-wrong-mssg"));
|
setHandleError(t("something-went-wrong-mssg"));
|
||||||
|
setIsUiLoading(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//check if isEmailVerified then go on next step
|
//check if isEmailVerified then go on next step
|
||||||
@@ -633,7 +638,6 @@ function PdfRequestFiles(
|
|||||||
);
|
);
|
||||||
if (checkUser && checkUser.length > 0) {
|
if (checkUser && checkUser.length > 0) {
|
||||||
let checkboxExist,
|
let checkboxExist,
|
||||||
requiredRadio,
|
|
||||||
showAlert = false,
|
showAlert = false,
|
||||||
widgetKey,
|
widgetKey,
|
||||||
radioExist,
|
radioExist,
|
||||||
@@ -704,39 +708,12 @@ function PdfRequestFiles(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//condition to check radio widget exist or not
|
//else condition to check all type widget data fill or not except checkbox
|
||||||
else if (radioExist) {
|
|
||||||
//get all required type radio button
|
|
||||||
requiredRadio = checkUser[0].placeHolder[i].pos.filter(
|
|
||||||
(position) =>
|
|
||||||
!position.options?.isReadOnly &&
|
|
||||||
position.type === radioButtonWidget
|
|
||||||
);
|
|
||||||
//if required type radio data exit then check user checked all radio button or some radio remain to check
|
|
||||||
if (requiredRadio && requiredRadio?.length > 0) {
|
|
||||||
let checkSigned;
|
|
||||||
for (let i = 0; i < requiredRadio?.length; i++) {
|
|
||||||
checkSigned = requiredRadio[i]?.options?.response;
|
|
||||||
if (!checkSigned) {
|
|
||||||
let checkDefaultSigned =
|
|
||||||
requiredRadio[i]?.options?.defaultValue;
|
|
||||||
if (!checkDefaultSigned && !showAlert) {
|
|
||||||
showAlert = true;
|
|
||||||
widgetKey = requiredRadio[i].key;
|
|
||||||
TourPageNumber = updatePage;
|
|
||||||
setminRequiredCount(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//else condition to check all type widget data fill or not except checkbox and radio button
|
|
||||||
else {
|
else {
|
||||||
//get all required type widgets except checkbox and radio
|
//get all required type widgets except checkbox and radio
|
||||||
const requiredWidgets = checkUser[0].placeHolder[i].pos.filter(
|
const requiredWidgets = checkUser[0].placeHolder[i].pos.filter(
|
||||||
(position) =>
|
(position) =>
|
||||||
position.options?.status === "required" &&
|
position.options?.status === "required" &&
|
||||||
position.type !== radioButtonWidget &&
|
|
||||||
position.type !== "checkbox"
|
position.type !== "checkbox"
|
||||||
);
|
);
|
||||||
if (requiredWidgets && requiredWidgets?.length > 0) {
|
if (requiredWidgets && requiredWidgets?.length > 0) {
|
||||||
@@ -744,16 +721,13 @@ function PdfRequestFiles(
|
|||||||
for (let i = 0; i < requiredWidgets?.length; i++) {
|
for (let i = 0; i < requiredWidgets?.length; i++) {
|
||||||
checkSigned = requiredWidgets[i]?.options?.response;
|
checkSigned = requiredWidgets[i]?.options?.response;
|
||||||
if (!checkSigned) {
|
if (!checkSigned) {
|
||||||
const checkSignUrl = requiredWidgets[i]?.pos?.SignUrl;
|
let checkDefaultSigned =
|
||||||
if (!checkSignUrl) {
|
requiredWidgets[i]?.options?.defaultValue;
|
||||||
let checkDefaultSigned =
|
if (!checkDefaultSigned && !showAlert) {
|
||||||
requiredWidgets[i]?.options?.defaultValue;
|
showAlert = true;
|
||||||
if (!checkDefaultSigned && !showAlert) {
|
widgetKey = requiredWidgets[i].key;
|
||||||
showAlert = true;
|
TourPageNumber = updatePage;
|
||||||
widgetKey = requiredWidgets[i].key;
|
setminRequiredCount(null);
|
||||||
TourPageNumber = updatePage;
|
|
||||||
setminRequiredCount(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -765,20 +739,12 @@ function PdfRequestFiles(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (checkboxExist && requiredCheckbox && showAlert) {
|
if (showAlert) {
|
||||||
setUnSignedWidgetId(widgetKey);
|
|
||||||
setPageNumber(TourPageNumber);
|
|
||||||
setWidgetsTour(true);
|
|
||||||
} else if (radioExist && showAlert) {
|
|
||||||
setUnSignedWidgetId(widgetKey);
|
|
||||||
setPageNumber(TourPageNumber);
|
|
||||||
setWidgetsTour(true);
|
|
||||||
} else if (showAlert) {
|
|
||||||
setUnSignedWidgetId(widgetKey);
|
setUnSignedWidgetId(widgetKey);
|
||||||
setPageNumber(TourPageNumber);
|
setPageNumber(TourPageNumber);
|
||||||
setWidgetsTour(true);
|
setWidgetsTour(true);
|
||||||
|
setIsUiLoading(false);
|
||||||
} else {
|
} else {
|
||||||
setIsUiLoading(true);
|
|
||||||
// `widgets` is Used to return widgets details with page number of current user
|
// `widgets` is Used to return widgets details with page number of current user
|
||||||
const widgets = checkUser?.[0]?.placeHolder;
|
const widgets = checkUser?.[0]?.placeHolder;
|
||||||
let pdfArrBuffer;
|
let pdfArrBuffer;
|
||||||
@@ -816,11 +782,13 @@ function PdfRequestFiles(
|
|||||||
//embed document's object id to all pages in pdf document
|
//embed document's object id to all pages in pdf document
|
||||||
if (!HeaderDocId) {
|
if (!HeaderDocId) {
|
||||||
if (!isDocId) {
|
if (!isDocId) {
|
||||||
await embedDocId(pdfDoc, docId, allPages);
|
//pdfOriginalWH contained all pdf's pages width,height & pagenumber in array format
|
||||||
|
await embedDocId(pdfOriginalWH, pdfDoc, docId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//embed multi signature in pdf
|
//embed all widgets in document
|
||||||
const pdfBytes = await multiSignEmbed(
|
const pdfBytes = await multiSignEmbed(
|
||||||
|
pdfOriginalWH,
|
||||||
widgets,
|
widgets,
|
||||||
pdfDoc,
|
pdfDoc,
|
||||||
isSignYourSelfFlow,
|
isSignYourSelfFlow,
|
||||||
@@ -852,17 +820,23 @@ function PdfRequestFiles(
|
|||||||
isSuccessRoute,
|
isSuccessRoute,
|
||||||
contactId
|
contactId
|
||||||
);
|
);
|
||||||
const index = pdfDetails?.[0]?.Signers.findIndex(
|
const index =
|
||||||
(x) => x.objectId === signerObjectId
|
updatedDoc.updatedPdfDetails?.[0]?.Signers.findIndex(
|
||||||
);
|
(x) => x.objectId === contactId
|
||||||
|
);
|
||||||
const newIndex = index + 1;
|
const newIndex = index + 1;
|
||||||
const usermail = {
|
const usermail = {
|
||||||
Email: pdfDetails?.[0]?.Placeholders[newIndex]?.email || ""
|
Email:
|
||||||
|
updatedDoc.updatedPdfDetails?.[0]?.Placeholders[newIndex]
|
||||||
|
?.email || ""
|
||||||
};
|
};
|
||||||
const user = usermail?.Email
|
const user = usermail?.Email
|
||||||
? usermail
|
? usermail
|
||||||
: pdfDetails?.[0]?.Signers[newIndex];
|
: updatedDoc.updatedPdfDetails?.[0]?.Signers[newIndex];
|
||||||
if (sendmail !== "false" && sendInOrder) {
|
if (
|
||||||
|
sendmail !== "false" &&
|
||||||
|
sendInOrder
|
||||||
|
) {
|
||||||
const requestBody =
|
const requestBody =
|
||||||
updatedDoc.updatedPdfDetails?.[0]?.RequestBody;
|
updatedDoc.updatedPdfDetails?.[0]?.RequestBody;
|
||||||
const requestSubject =
|
const requestSubject =
|
||||||
@@ -916,7 +890,7 @@ function PdfRequestFiles(
|
|||||||
const htmlReqBody =
|
const htmlReqBody =
|
||||||
"<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /></head><body>" +
|
"<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /></head><body>" +
|
||||||
replacedRequestBody +
|
replacedRequestBody +
|
||||||
"</body> </html>";
|
"</body></html>";
|
||||||
|
|
||||||
const variables = {
|
const variables = {
|
||||||
document_title: documentName,
|
document_title: documentName,
|
||||||
@@ -929,7 +903,7 @@ function PdfRequestFiles(
|
|||||||
receiver_phone: user?.Phone || "",
|
receiver_phone: user?.Phone || "",
|
||||||
expiry_date: localExpireDate,
|
expiry_date: localExpireDate,
|
||||||
company_name: orgName,
|
company_name: orgName,
|
||||||
signing_url: `<a href=${signPdf} target=_blank>Sign here</a>`
|
signing_url: signPdf
|
||||||
};
|
};
|
||||||
replaceVar = replaceMailVaribles(
|
replaceVar = replaceMailVaribles(
|
||||||
requestSubject,
|
requestSubject,
|
||||||
@@ -944,7 +918,7 @@ function PdfRequestFiles(
|
|||||||
title: documentName,
|
title: documentName,
|
||||||
organization: orgName,
|
organization: orgName,
|
||||||
localExpireDate: localExpireDate,
|
localExpireDate: localExpireDate,
|
||||||
sigingUrl: signPdf
|
signingUrl: signPdf
|
||||||
};
|
};
|
||||||
let params = {
|
let params = {
|
||||||
replyto: senderEmail || "",
|
replyto: senderEmail || "",
|
||||||
@@ -1017,6 +991,7 @@ function PdfRequestFiles(
|
|||||||
isShow: true,
|
isShow: true,
|
||||||
alertMessage: t("something-went-wrong-mssg")
|
alertMessage: t("something-went-wrong-mssg")
|
||||||
});
|
});
|
||||||
|
setIsUiLoading(false);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("err in embedsign", err);
|
console.log("err in embedsign", err);
|
||||||
@@ -1030,6 +1005,7 @@ function PdfRequestFiles(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleSignPdf = async () => {
|
const handleSignPdf = async () => {
|
||||||
|
setIsUiLoading(true);
|
||||||
await embedWidgetsData();
|
await embedWidgetsData();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1169,14 +1145,7 @@ function PdfRequestFiles(
|
|||||||
];
|
];
|
||||||
//function for get pdf page details
|
//function for get pdf page details
|
||||||
const pageDetails = async (pdf) => {
|
const pageDetails = async (pdf) => {
|
||||||
let pdfWHObj = [];
|
const pdfWHObj = await getOriginalWH(pdf);
|
||||||
const totalPages = pdf.numPages; // Get the total number of pages
|
|
||||||
for (let index = 0; index < totalPages; index++) {
|
|
||||||
const getPage = await pdf.getPage(index + 1);
|
|
||||||
const scale = 1;
|
|
||||||
const { width, height } = getPage.getViewport({ scale });
|
|
||||||
pdfWHObj.push({ pageNumber: index + 1, width, height });
|
|
||||||
}
|
|
||||||
setPdfOriginalWH(pdfWHObj);
|
setPdfOriginalWH(pdfWHObj);
|
||||||
setPdfLoad(true);
|
setPdfLoad(true);
|
||||||
};
|
};
|
||||||
@@ -1255,7 +1224,8 @@ function PdfRequestFiles(
|
|||||||
setRequestSignTour(true);
|
setRequestSignTour(true);
|
||||||
if (isDontShow) {
|
if (isDontShow) {
|
||||||
const isEnableOTP = pdfDetails?.[0]?.IsEnableOTP || false;
|
const isEnableOTP = pdfDetails?.[0]?.IsEnableOTP || false;
|
||||||
if (!isEnableOTP) {
|
const sessionToken = localStorage.getItem("accesstoken");
|
||||||
|
if (!isEnableOTP && !sessionToken) {
|
||||||
try {
|
try {
|
||||||
await axios.post(
|
await axios.post(
|
||||||
`${localStorage.getItem("baseUrl")}functions/updatecontacttour`,
|
`${localStorage.getItem("baseUrl")}functions/updatecontacttour`,
|
||||||
@@ -1568,11 +1538,15 @@ function PdfRequestFiles(
|
|||||||
const widgetValue = widgetDataValue(dragTypeValue, parseUser);
|
const widgetValue = widgetDataValue(dragTypeValue, parseUser);
|
||||||
//adding and updating drop position in array when user drop signature button in div
|
//adding and updating drop position in array when user drop signature button in div
|
||||||
if (item === "onclick") {
|
if (item === "onclick") {
|
||||||
|
// `getBoundingClientRect()` is used to get accurate measurement width, height of the Pdf div
|
||||||
|
const divWidth = divRef.current.getBoundingClientRect().width;
|
||||||
const divHeight = divRef.current.getBoundingClientRect().height;
|
const divHeight = divRef.current.getBoundingClientRect().height;
|
||||||
// `getBoundingClientRect()` is used to get accurate measurement height of the div
|
// Compute the pixel‐space center within the PDF viewport:
|
||||||
|
const centerX_Pixels = divWidth / 2 - widgetWidth / 2;
|
||||||
|
const xPosition_Final = centerX_Pixels / (containerScale * scale);
|
||||||
dropObj = {
|
dropObj = {
|
||||||
//onclick put placeholder center on pdf
|
//onclick put placeholder center on pdf
|
||||||
xPosition: widgetWidth / 4 + containerWH.width / 2,
|
xPosition: xPosition_Final,
|
||||||
yPosition: widgetHeight + divHeight / 2,
|
yPosition: widgetHeight + divHeight / 2,
|
||||||
isStamp:
|
isStamp:
|
||||||
(dragTypeValue === "stamp" || dragTypeValue === "image") && true,
|
(dragTypeValue === "stamp" || dragTypeValue === "image") && true,
|
||||||
@@ -1648,12 +1622,6 @@ function PdfRequestFiles(
|
|||||||
);
|
);
|
||||||
setSignerPos(updatesignerPos);
|
setSignerPos(updatesignerPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (dragTypeValue === "dropdown") {
|
|
||||||
// setShowDropdown(true);
|
|
||||||
// } else if (dragTypeValue === "checkbox") {
|
|
||||||
// setIsCheckbox(true);
|
|
||||||
// } else
|
|
||||||
if (
|
if (
|
||||||
[textWidget, "name", "company", "job title", "email"].includes(
|
[textWidget, "name", "company", "job title", "email"].includes(
|
||||||
dragTypeValue
|
dragTypeValue
|
||||||
@@ -1753,7 +1721,6 @@ function PdfRequestFiles(
|
|||||||
setShowSignPagenumber(sortedPagenumber);
|
setShowSignPagenumber(sortedPagenumber);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DndProvider backend={HTML5Backend}>
|
<DndProvider backend={HTML5Backend}>
|
||||||
<Title
|
<Title
|
||||||
@@ -1825,6 +1792,7 @@ function PdfRequestFiles(
|
|||||||
{!requestSignTour &&
|
{!requestSignTour &&
|
||||||
isAgree &&
|
isAgree &&
|
||||||
signerObjectId &&
|
signerObjectId &&
|
||||||
|
!alreadySign &&
|
||||||
requestSignTourFunction()}
|
requestSignTourFunction()}
|
||||||
<Tour
|
<Tour
|
||||||
showNumber={false}
|
showNumber={false}
|
||||||
@@ -2263,6 +2231,7 @@ function PdfRequestFiles(
|
|||||||
index={pageNumber}
|
index={pageNumber}
|
||||||
setUniqueId={setUniqueId}
|
setUniqueId={setUniqueId}
|
||||||
tempSignerId={tempSignerId}
|
tempSignerId={tempSignerId}
|
||||||
|
signatureTypes={signatureType}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<DownloadPdfZip
|
<DownloadPdfZip
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import {
|
|||||||
multiSignEmbed,
|
multiSignEmbed,
|
||||||
addWidgetOptions,
|
addWidgetOptions,
|
||||||
textInputWidget,
|
textInputWidget,
|
||||||
|
cellsWidget,
|
||||||
textWidget,
|
textWidget,
|
||||||
radioButtonWidget,
|
radioButtonWidget,
|
||||||
color,
|
color,
|
||||||
@@ -44,7 +45,8 @@ import {
|
|||||||
handleSignatureType,
|
handleSignatureType,
|
||||||
getBase64FromUrl,
|
getBase64FromUrl,
|
||||||
generatePdfName,
|
generatePdfName,
|
||||||
mailTemplate
|
mailTemplate,
|
||||||
|
getOriginalWH
|
||||||
} from "../constant/Utils";
|
} from "../constant/Utils";
|
||||||
import RenderPdf from "../components/pdf/RenderPdf";
|
import RenderPdf from "../components/pdf/RenderPdf";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
@@ -192,7 +194,7 @@ function PlaceHolderSign() {
|
|||||||
);
|
);
|
||||||
if (user) {
|
if (user) {
|
||||||
try {
|
try {
|
||||||
const defaultRequestBody = `<p>Hi {{receiver_name}},</p><br><p>We hope this email finds you well. {{sender_name}} has requested you to review and sign {{document_title}}.</p><p>Your signature is crucial to proceed with the next steps as it signifies your agreement and authorization.</p><br><p>{{signing_url}}</p><br><p>If you have any questions or need further clarification regarding the document or the signing process, please contact the sender.</p><br><p>Thanks</p><p> Team ${appName}</p><br>`;
|
const defaultRequestBody = `<p>Hi {{receiver_name}},</p><br><p>We hope this email finds you well. {{sender_name}} has requested you to review and sign {{document_title}}.</p><p>Your signature is crucial to proceed with the next steps as it signifies your agreement and authorization.</p><br><p><a href='{{signing_url}}' rel='noopener noreferrer' target='_blank'>Sign here</a></p><br><br><p>If you have any questions or need further clarification regarding the document or the signing process, please contact the sender.</p><br><p>Thanks</p><p> Team ${appName}</p><br>`;
|
||||||
const defaultSubject = `{{sender_name}} has requested you to sign {{document_title}}`;
|
const defaultSubject = `{{sender_name}} has requested you to sign {{document_title}}`;
|
||||||
setDefaultBody(defaultRequestBody);
|
setDefaultBody(defaultRequestBody);
|
||||||
setDefaultSubject(defaultSubject);
|
setDefaultSubject(defaultSubject);
|
||||||
@@ -523,11 +525,15 @@ function PlaceHolderSign() {
|
|||||||
defaultWidthHeight(dragTypeValue).height * containerScale;
|
defaultWidthHeight(dragTypeValue).height * containerScale;
|
||||||
//adding and updating drop position in array when user drop signature button in div
|
//adding and updating drop position in array when user drop signature button in div
|
||||||
if (item === "onclick") {
|
if (item === "onclick") {
|
||||||
|
// `getBoundingClientRect()` is used to get accurate measurement width, height of the Pdf div
|
||||||
|
const divWidth = divRef.current.getBoundingClientRect().width;
|
||||||
const divHeight = divRef.current.getBoundingClientRect().height;
|
const divHeight = divRef.current.getBoundingClientRect().height;
|
||||||
// `getBoundingClientRect()` is used to get accurate measurement height of the div
|
// Compute the pixel‐space center within the PDF viewport:
|
||||||
|
const centerX_Pixels = divWidth / 2 - widgetWidth / 2;
|
||||||
|
const xPosition_Final = centerX_Pixels / (containerScale * scale);
|
||||||
dropObj = {
|
dropObj = {
|
||||||
//onclick put placeholder center on pdf
|
//onclick put placeholder center on pdf
|
||||||
xPosition: widgetWidth / 4 + containerWH.width / 2,
|
xPosition: xPosition_Final,
|
||||||
yPosition: widgetHeight + divHeight / 2,
|
yPosition: widgetHeight + divHeight / 2,
|
||||||
isStamp:
|
isStamp:
|
||||||
(dragTypeValue === "stamp" || dragTypeValue === "image") && true,
|
(dragTypeValue === "stamp" || dragTypeValue === "image") && true,
|
||||||
@@ -671,14 +677,7 @@ function PlaceHolderSign() {
|
|||||||
|
|
||||||
//function for get pdf page details
|
//function for get pdf page details
|
||||||
const pageDetails = async (pdf) => {
|
const pageDetails = async (pdf) => {
|
||||||
let pdfWHObj = [];
|
const pdfWHObj = await getOriginalWH(pdf);
|
||||||
const totalPages = pdf?.numPages;
|
|
||||||
for (let index = 0; index < totalPages; index++) {
|
|
||||||
const getPage = await pdf.getPage(index + 1);
|
|
||||||
const scale = 1;
|
|
||||||
const { width, height } = getPage.getViewport({ scale });
|
|
||||||
pdfWHObj.push({ pageNumber: index + 1, width, height });
|
|
||||||
}
|
|
||||||
setPdfOriginalWH(pdfWHObj);
|
setPdfOriginalWH(pdfWHObj);
|
||||||
setPdfLoad(true);
|
setPdfLoad(true);
|
||||||
};
|
};
|
||||||
@@ -862,7 +861,9 @@ function PlaceHolderSign() {
|
|||||||
});
|
});
|
||||||
const isSignYourSelfFlow = false;
|
const isSignYourSelfFlow = false;
|
||||||
try {
|
try {
|
||||||
|
//pdfOriginalWH contained all pdf's pages width,height & pagenumber in array format
|
||||||
const pdfBase64 = await multiSignEmbed(
|
const pdfBase64 = await multiSignEmbed(
|
||||||
|
pdfOriginalWH,
|
||||||
placeholder,
|
placeholder,
|
||||||
pdfDoc,
|
pdfDoc,
|
||||||
isSignYourSelfFlow,
|
isSignYourSelfFlow,
|
||||||
@@ -1220,7 +1221,7 @@ function PlaceHolderSign() {
|
|||||||
receiver_phone: signerMail[i]?.Phone || "",
|
receiver_phone: signerMail[i]?.Phone || "",
|
||||||
expiry_date: localExpireDate,
|
expiry_date: localExpireDate,
|
||||||
company_name: orgName,
|
company_name: orgName,
|
||||||
signing_url: `<a href=${signPdf} target=_blank>Sign here</a>`
|
signing_url: signPdf
|
||||||
};
|
};
|
||||||
replaceVar = replaceMailVaribles(
|
replaceVar = replaceMailVaribles(
|
||||||
requestSubject,
|
requestSubject,
|
||||||
@@ -1249,7 +1250,7 @@ function PlaceHolderSign() {
|
|||||||
receiver_phone: signerMail[i]?.Phone || "",
|
receiver_phone: signerMail[i]?.Phone || "",
|
||||||
expiry_date: localExpireDate,
|
expiry_date: localExpireDate,
|
||||||
company_name: orgName,
|
company_name: orgName,
|
||||||
signing_url: `<a href=${signPdf} target=_blank>Sign here</a>`
|
signing_url: signPdf
|
||||||
};
|
};
|
||||||
replaceVar = replaceMailVaribles(mailSubject, htmlReqBody, variables);
|
replaceVar = replaceMailVaribles(mailSubject, htmlReqBody, variables);
|
||||||
}
|
}
|
||||||
@@ -1260,7 +1261,7 @@ function PlaceHolderSign() {
|
|||||||
title: documentName,
|
title: documentName,
|
||||||
organization: orgName,
|
organization: orgName,
|
||||||
localExpireDate: localExpireDate,
|
localExpireDate: localExpireDate,
|
||||||
sigingUrl: signPdf
|
signingUrl: signPdf
|
||||||
};
|
};
|
||||||
let params = {
|
let params = {
|
||||||
extUserId: owner?.objectId,
|
extUserId: owner?.objectId,
|
||||||
@@ -1417,7 +1418,8 @@ function PlaceHolderSign() {
|
|||||||
deleteOption,
|
deleteOption,
|
||||||
status,
|
status,
|
||||||
defaultValue,
|
defaultValue,
|
||||||
isHideLabel
|
isHideLabel,
|
||||||
|
layout
|
||||||
) => {
|
) => {
|
||||||
const filterSignerPos = signerPos.filter((data) => data.Id === uniqueId);
|
const filterSignerPos = signerPos.filter((data) => data.Id === uniqueId);
|
||||||
if (filterSignerPos.length > 0) {
|
if (filterSignerPos.length > 0) {
|
||||||
@@ -1452,6 +1454,8 @@ function PlaceHolderSign() {
|
|||||||
...position.options,
|
...position.options,
|
||||||
name: dropdownName,
|
name: dropdownName,
|
||||||
values: dropdownOptions,
|
values: dropdownOptions,
|
||||||
|
status: status,
|
||||||
|
layout: layout,
|
||||||
isReadOnly: isReadOnly || false,
|
isReadOnly: isReadOnly || false,
|
||||||
isHideLabel: isHideLabel || false,
|
isHideLabel: isHideLabel || false,
|
||||||
defaultValue: defaultValue,
|
defaultValue: defaultValue,
|
||||||
@@ -1491,6 +1495,7 @@ function PlaceHolderSign() {
|
|||||||
maxRequiredCount: maxCount
|
maxRequiredCount: maxCount
|
||||||
},
|
},
|
||||||
defaultValue: defaultValue,
|
defaultValue: defaultValue,
|
||||||
|
layout: layout,
|
||||||
isReadOnly: isReadOnly || false,
|
isReadOnly: isReadOnly || false,
|
||||||
isHideLabel: isHideLabel || false,
|
isHideLabel: isHideLabel || false,
|
||||||
fontSize:
|
fontSize:
|
||||||
@@ -1589,6 +1594,36 @@ function PlaceHolderSign() {
|
|||||||
isReadOnly: defaultdata?.isReadOnly || false
|
isReadOnly: defaultdata?.isReadOnly || false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
} else if (position.type === cellsWidget) {
|
||||||
|
return {
|
||||||
|
...position,
|
||||||
|
options: {
|
||||||
|
...position.options,
|
||||||
|
name: defaultdata?.name || "Cells",
|
||||||
|
status: defaultdata?.status || "required",
|
||||||
|
hint: defaultdata?.hint || "",
|
||||||
|
cellCount: parseInt(defaultdata?.cellCount || 5),
|
||||||
|
defaultValue: (defaultdata?.defaultValue || "").slice(
|
||||||
|
0,
|
||||||
|
parseInt(defaultdata?.cellCount || 5)
|
||||||
|
),
|
||||||
|
validation:
|
||||||
|
isSubscribe && inputype
|
||||||
|
? {
|
||||||
|
type: inputype,
|
||||||
|
pattern:
|
||||||
|
inputype === "regex" ? defaultdata.textvalidate : ""
|
||||||
|
}
|
||||||
|
: {},
|
||||||
|
fontSize:
|
||||||
|
fontSize || currWidgetsDetails?.options?.fontSize || 12,
|
||||||
|
fontColor:
|
||||||
|
fontColor ||
|
||||||
|
currWidgetsDetails?.options?.fontColor ||
|
||||||
|
"black",
|
||||||
|
isReadOnly: defaultdata?.isReadOnly || false
|
||||||
|
}
|
||||||
|
};
|
||||||
} else if (["signature"].includes(position.type)) {
|
} else if (["signature"].includes(position.type)) {
|
||||||
return {
|
return {
|
||||||
...position,
|
...position,
|
||||||
@@ -2593,6 +2628,7 @@ function PlaceHolderSign() {
|
|||||||
isSave={true}
|
isSave={true}
|
||||||
tempSignerId={tempSignerId}
|
tempSignerId={tempSignerId}
|
||||||
setUniqueId={setUniqueId}
|
setUniqueId={setUniqueId}
|
||||||
|
signatureTypes={signatureType}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<ModalUi
|
<ModalUi
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ const Preferences = () => {
|
|||||||
setIsLoader(true);
|
setIsLoader(true);
|
||||||
const updateRes = tenantRes;
|
const updateRes = tenantRes;
|
||||||
setTenantId(updateRes?.objectId);
|
setTenantId(updateRes?.objectId);
|
||||||
const defaultRequestBody = `<p>Hi {{receiver_name}},</p><br><p>We hope this email finds you well. {{sender_name}} has requested you to review and sign {{document_title}}.</p><p>Your signature is crucial to proceed with the next steps as it signifies your agreement and authorization.</p><br><p>{{signing_url}}</p><br><p>If you have any questions or need further clarification regarding the document or the signing process, please contact the sender.</p><br><p>Thanks</p><p> Team ${appName}</p><br>`;
|
const defaultRequestBody = `<p>Hi {{receiver_name}},</p><br><p>We hope this email finds you well. {{sender_name}} has requested you to review and sign {{document_title}}.</p><p>Your signature is crucial to proceed with the next steps as it signifies your agreement and authorization.</p><br><p><a href='{{signing_url}}' rel='noopener noreferrer' target='_blank'>Sign here</a></p><br><br><p>If you have any questions or need further clarification regarding the document or the signing process, please contact the sender.</p><br><p>Thanks</p><p> Team ${appName}</p><br>`;
|
||||||
if (updateRes?.RequestBody) {
|
if (updateRes?.RequestBody) {
|
||||||
setRequestBody(updateRes?.RequestBody);
|
setRequestBody(updateRes?.RequestBody);
|
||||||
setRequestSubject(updateRes?.RequestSubject);
|
setRequestSubject(updateRes?.RequestSubject);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState, useRef } from "react";
|
||||||
import ReportTable from "../primitives/GetReportDisplay";
|
import ReportTable from "../primitives/GetReportDisplay";
|
||||||
import Parse from "parse";
|
import Parse from "parse";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
@@ -27,12 +27,17 @@ const Report = () => {
|
|||||||
const [isImport, setIsImport] = useState(false);
|
const [isImport, setIsImport] = useState(false);
|
||||||
const abortController = new AbortController();
|
const abortController = new AbortController();
|
||||||
const docPerPage = 10;
|
const docPerPage = 10;
|
||||||
|
const [searchTerm, setSearchTerm] = useState("");
|
||||||
|
const [mobileSearchOpen, setMobileSearchOpen] = useState(false);
|
||||||
|
const debounceTimer = useRef(null);
|
||||||
|
|
||||||
// below useEffect is call when id param change
|
// below useEffect is call when id param change
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setReportName("");
|
setReportName("");
|
||||||
setList([]);
|
setList([]);
|
||||||
getReportData();
|
setSearchTerm("");
|
||||||
|
setMobileSearchOpen(false);
|
||||||
|
getReportData(0, docPerPage, "");
|
||||||
|
|
||||||
// Function returned from useEffect is called on unmount
|
// Function returned from useEffect is called on unmount
|
||||||
return () => {
|
return () => {
|
||||||
@@ -48,7 +53,7 @@ const Report = () => {
|
|||||||
// below useEffect call when isNextRecord state is true and fetch next record
|
// below useEffect call when isNextRecord state is true and fetch next record
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isNextRecord) {
|
if (isNextRecord) {
|
||||||
getReportData(List.length, 20);
|
getReportData(List.length, 20, searchTerm);
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
}, [isNextRecord]);
|
}, [isNextRecord]);
|
||||||
@@ -56,7 +61,46 @@ const Report = () => {
|
|||||||
const handleDontShow = (isChecked) => {
|
const handleDontShow = (isChecked) => {
|
||||||
setIsDontShow(isChecked);
|
setIsDontShow(isChecked);
|
||||||
};
|
};
|
||||||
const getReportData = async (skipUserRecord = 0, limit = 20) => {
|
|
||||||
|
const handleSearchChange = async (e) => {
|
||||||
|
const term = e.target.value.toLowerCase();
|
||||||
|
setSearchTerm(term);
|
||||||
|
if (debounceTimer.current) {
|
||||||
|
clearTimeout(debounceTimer.current);
|
||||||
|
}
|
||||||
|
debounceTimer.current = setTimeout(async () => {
|
||||||
|
try {
|
||||||
|
const headers = {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
|
||||||
|
sessiontoken: localStorage.getItem("accesstoken"),
|
||||||
|
};
|
||||||
|
const url = `${localStorage.getItem("baseUrl")}functions/getReport`;
|
||||||
|
const res = await axios.post(
|
||||||
|
url,
|
||||||
|
{ reportId: id, searchTerm: term, skip: 0, limit: docPerPage },
|
||||||
|
{ headers }
|
||||||
|
);
|
||||||
|
const data = res.data?.result || [];
|
||||||
|
if (!data.error) {
|
||||||
|
setList(data);
|
||||||
|
setIsMoreDocs(data.length >= docPerPage);
|
||||||
|
setIsNextRecord(false);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Search error:", err);
|
||||||
|
}
|
||||||
|
}, 300);
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
return () => {
|
||||||
|
if (debounceTimer.current) {
|
||||||
|
clearTimeout(debounceTimer.current);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
const getReportData = async (skipUserRecord = 0, limit = 20, term = searchTerm) => {
|
||||||
// setIsLoader(true);
|
// setIsLoader(true);
|
||||||
const json = reportJson(id);
|
const json = reportJson(id);
|
||||||
if (json) {
|
if (json) {
|
||||||
@@ -77,6 +121,9 @@ const Report = () => {
|
|||||||
const skipRecord = id === "4Hhwbp482K" ? 0 : skipUserRecord;
|
const skipRecord = id === "4Hhwbp482K" ? 0 : skipUserRecord;
|
||||||
const limitRecord = id === "4Hhwbp482K" ? 200 : limit;
|
const limitRecord = id === "4Hhwbp482K" ? 200 : limit;
|
||||||
const params = { reportId: id, skip: skipRecord, limit: limitRecord };
|
const params = { reportId: id, skip: skipRecord, limit: limitRecord };
|
||||||
|
if (term) {
|
||||||
|
params.searchTerm = term;
|
||||||
|
}
|
||||||
const url = `${localStorage.getItem("baseUrl")}functions/getReport`;
|
const url = `${localStorage.getItem("baseUrl")}functions/getReport`;
|
||||||
const res = await axios.post(url, params, {
|
const res = await axios.post(url, params, {
|
||||||
headers: headers,
|
headers: headers,
|
||||||
@@ -197,6 +244,10 @@ const Report = () => {
|
|||||||
report_help={reporthelp}
|
report_help={reporthelp}
|
||||||
tourData={tourData}
|
tourData={tourData}
|
||||||
isDontShow={isDontShow}
|
isDontShow={isDontShow}
|
||||||
|
mobileSearchOpen={mobileSearchOpen}
|
||||||
|
setMobileSearchOpen={setMobileSearchOpen}
|
||||||
|
searchTerm={searchTerm}
|
||||||
|
handleSearchChange={handleSearchChange}
|
||||||
isImport={isImport}
|
isImport={isImport}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState, useRef, useEffect } from "react";
|
import { useState, useRef, useEffect } from "react";
|
||||||
import { PDFDocument } from "pdf-lib";
|
import { PDFDocument } from "pdf-lib";
|
||||||
import "../styles/signature.css";
|
import "../styles/signature.css";
|
||||||
import Parse from "parse";
|
import Parse from "parse";
|
||||||
@@ -22,6 +22,7 @@ import {
|
|||||||
randomId,
|
randomId,
|
||||||
getDate,
|
getDate,
|
||||||
textWidget,
|
textWidget,
|
||||||
|
cellsWidget,
|
||||||
convertPdfArrayBuffer,
|
convertPdfArrayBuffer,
|
||||||
textInputWidget,
|
textInputWidget,
|
||||||
fetchImageBase64,
|
fetchImageBase64,
|
||||||
@@ -32,12 +33,13 @@ import {
|
|||||||
onClickZoomIn,
|
onClickZoomIn,
|
||||||
onClickZoomOut,
|
onClickZoomOut,
|
||||||
rotatePdfPage,
|
rotatePdfPage,
|
||||||
signatureTypes,
|
|
||||||
getBase64FromUrl,
|
getBase64FromUrl,
|
||||||
convertBase64ToFile,
|
convertBase64ToFile,
|
||||||
generatePdfName,
|
generatePdfName,
|
||||||
handleRemoveWidgets,
|
handleRemoveWidgets,
|
||||||
addWidgetSelfsignOptions
|
addWidgetSelfsignOptions,
|
||||||
|
getOriginalWH,
|
||||||
|
signatureTypes
|
||||||
} from "../constant/Utils";
|
} from "../constant/Utils";
|
||||||
import { useParams } from "react-router";
|
import { useParams } from "react-router";
|
||||||
import Tour from "../primitives/Tour";
|
import Tour from "../primitives/Tour";
|
||||||
@@ -355,9 +357,13 @@ function SignYourSelf() {
|
|||||||
);
|
);
|
||||||
const dragTypeValue = item?.text ? item.text : monitor.type;
|
const dragTypeValue = item?.text ? item.text : monitor.type;
|
||||||
const widgetValue = getWidgetValue(dragTypeValue);
|
const widgetValue = getWidgetValue(dragTypeValue);
|
||||||
const widgetTypeExist = ["name", "company", "job title", "email"].includes(
|
const widgetTypeExist = [
|
||||||
dragTypeValue
|
"name",
|
||||||
);
|
"company",
|
||||||
|
"job title",
|
||||||
|
"email",
|
||||||
|
cellsWidget
|
||||||
|
].includes(dragTypeValue);
|
||||||
const containerScale = getContainerScale(
|
const containerScale = getContainerScale(
|
||||||
pdfOriginalWH,
|
pdfOriginalWH,
|
||||||
pageNumber,
|
pageNumber,
|
||||||
@@ -365,15 +371,19 @@ function SignYourSelf() {
|
|||||||
);
|
);
|
||||||
//adding and updating drop position in array when user drop signature button in div
|
//adding and updating drop position in array when user drop signature button in div
|
||||||
if (item === "onclick") {
|
if (item === "onclick") {
|
||||||
// `getBoundingClientRect()` is used to get accurate measurement height of the div
|
// `getBoundingClientRect()` is used to get accurate measurement width, height of the Pdf div
|
||||||
const divHeight = divRef.current.getBoundingClientRect().height;
|
const divHeight = divRef.current.getBoundingClientRect().height;
|
||||||
|
const divWidth = divRef.current.getBoundingClientRect().width;
|
||||||
const getWidth = widgetTypeExist
|
const getWidth = widgetTypeExist
|
||||||
? calculateInitialWidthHeight(widgetValue).getWidth
|
? calculateInitialWidthHeight(widgetValue).getWidth
|
||||||
: defaultWidthHeight(dragTypeValue).width;
|
: defaultWidthHeight(dragTypeValue).width;
|
||||||
const getHeight = defaultWidthHeight(dragTypeValue).height;
|
const getHeight = defaultWidthHeight(dragTypeValue).height;
|
||||||
|
|
||||||
|
// Compute the pixel‐space center within the PDF viewport:
|
||||||
|
const centerX_Pixels = divWidth / 2 - getWidth / 2;
|
||||||
|
const xPosition_Final = centerX_Pixels / (containerScale * scale);
|
||||||
dropObj = {
|
dropObj = {
|
||||||
xPosition: getWidth / 2 + containerWH.width / 2,
|
xPosition: xPosition_Final,
|
||||||
yPosition: getHeight + divHeight / 2,
|
yPosition: getHeight + divHeight / 2,
|
||||||
isStamp:
|
isStamp:
|
||||||
(dragTypeValue === "stamp" || dragTypeValue === "image") && true,
|
(dragTypeValue === "stamp" || dragTypeValue === "image") && true,
|
||||||
@@ -434,6 +444,7 @@ function SignYourSelf() {
|
|||||||
[
|
[
|
||||||
textInputWidget,
|
textInputWidget,
|
||||||
textWidget,
|
textWidget,
|
||||||
|
cellsWidget,
|
||||||
"name",
|
"name",
|
||||||
"company",
|
"company",
|
||||||
"job title",
|
"job title",
|
||||||
@@ -626,10 +637,12 @@ function SignYourSelf() {
|
|||||||
const HeaderDocId = extUserPtr?.HeaderDocId;
|
const HeaderDocId = extUserPtr?.HeaderDocId;
|
||||||
//embed document's object id to all pages in pdf document
|
//embed document's object id to all pages in pdf document
|
||||||
if (!HeaderDocId) {
|
if (!HeaderDocId) {
|
||||||
await embedDocId(pdfDoc, documentId, allPages);
|
//pdfOriginalWH contained all pdf's pages width,height & pagenumber in array format
|
||||||
|
await embedDocId(pdfOriginalWH, pdfDoc, documentId);
|
||||||
}
|
}
|
||||||
//embed multi signature in pdf
|
//embed all widgets in document
|
||||||
const pdfBytes = await multiSignEmbed(
|
const pdfBytes = await multiSignEmbed(
|
||||||
|
pdfOriginalWH,
|
||||||
xyPosition,
|
xyPosition,
|
||||||
pdfDoc,
|
pdfDoc,
|
||||||
isSignYourSelfFlow,
|
isSignYourSelfFlow,
|
||||||
@@ -738,7 +751,6 @@ function SignYourSelf() {
|
|||||||
getDocumentDetails(false);
|
getDocumentDetails(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//function for save x and y position and show signature tab on that position
|
//function for save x and y position and show signature tab on that position
|
||||||
const handleTabDrag = (key) => {
|
const handleTabDrag = (key) => {
|
||||||
setDragKey(key);
|
setDragKey(key);
|
||||||
@@ -789,14 +801,7 @@ function SignYourSelf() {
|
|||||||
};
|
};
|
||||||
//function for get pdf page details
|
//function for get pdf page details
|
||||||
const pageDetails = async (pdf) => {
|
const pageDetails = async (pdf) => {
|
||||||
let pdfWHObj = [];
|
const pdfWHObj = await getOriginalWH(pdf);
|
||||||
const totalPages = pdf?.numPages;
|
|
||||||
for (let index = 0; index < totalPages; index++) {
|
|
||||||
const getPage = await pdf.getPage(index + 1);
|
|
||||||
const scale = 1;
|
|
||||||
const { width, height } = getPage.getViewport({ scale });
|
|
||||||
pdfWHObj.push({ pageNumber: index + 1, width, height });
|
|
||||||
}
|
|
||||||
setPdfOriginalWH(pdfWHObj);
|
setPdfOriginalWH(pdfWHObj);
|
||||||
setPdfLoad(true);
|
setPdfLoad(true);
|
||||||
};
|
};
|
||||||
@@ -932,7 +937,8 @@ function SignYourSelf() {
|
|||||||
deleteOption,
|
deleteOption,
|
||||||
status,
|
status,
|
||||||
defaultValue,
|
defaultValue,
|
||||||
isHideLabel
|
isHideLabel,
|
||||||
|
layout
|
||||||
) => {
|
) => {
|
||||||
const getPageNumer = xyPosition.filter(
|
const getPageNumer = xyPosition.filter(
|
||||||
(data) => data.pageNumber === pageNumber
|
(data) => data.pageNumber === pageNumber
|
||||||
@@ -940,6 +946,8 @@ function SignYourSelf() {
|
|||||||
if (getPageNumer.length > 0) {
|
if (getPageNumer.length > 0) {
|
||||||
const getXYdata = getPageNumer[0].pos;
|
const getXYdata = getPageNumer[0].pos;
|
||||||
const getPosData = getXYdata;
|
const getPosData = getXYdata;
|
||||||
|
const widgetLayout =
|
||||||
|
currWidgetsDetails?.type === "checkbox" ? { layout: layout } : {};
|
||||||
const addSignPos = getPosData.map((position) => {
|
const addSignPos = getPosData.map((position) => {
|
||||||
if (position.key === currWidgetsDetails?.key) {
|
if (position.key === currWidgetsDetails?.key) {
|
||||||
if (addOption) {
|
if (addOption) {
|
||||||
@@ -963,6 +971,7 @@ function SignYourSelf() {
|
|||||||
...position.options,
|
...position.options,
|
||||||
name: dropdownName,
|
name: dropdownName,
|
||||||
values: dropdownOptions,
|
values: dropdownOptions,
|
||||||
|
...widgetLayout,
|
||||||
isReadOnly: isReadOnly,
|
isReadOnly: isReadOnly,
|
||||||
isHideLabel: isHideLabel || false,
|
isHideLabel: isHideLabel || false,
|
||||||
fontSize:
|
fontSize:
|
||||||
@@ -1029,6 +1038,19 @@ function SignYourSelf() {
|
|||||||
handleTextSettingModal(false);
|
handleTextSettingModal(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const setCellCount = (key, newCount) => {
|
||||||
|
const getPageNumer = xyPosition.filter((data) => data.pageNumber === pageNumber);
|
||||||
|
if (getPageNumer.length > 0) {
|
||||||
|
const updatePos = getPageNumer[0].pos.map((p) =>
|
||||||
|
p.key === key ? { ...p, options: { ...p.options, cellCount: newCount } } : p
|
||||||
|
);
|
||||||
|
const updateXYposition = xyPosition.map((obj, ind) =>
|
||||||
|
ind === index ? { ...obj, pos: updatePos } : obj
|
||||||
|
);
|
||||||
|
setXyPosition(updateXYposition);
|
||||||
|
}
|
||||||
|
};
|
||||||
const clickOnZoomIn = () => {
|
const clickOnZoomIn = () => {
|
||||||
onClickZoomIn(scale, zoomPercent, setScale, setZoomPercent);
|
onClickZoomIn(scale, zoomPercent, setScale, setZoomPercent);
|
||||||
};
|
};
|
||||||
@@ -1290,6 +1312,7 @@ function SignYourSelf() {
|
|||||||
pdfBase64Url={pdfBase64Url}
|
pdfBase64Url={pdfBase64Url}
|
||||||
fontSize={fontSize}
|
fontSize={fontSize}
|
||||||
setFontSize={setFontSize}
|
setFontSize={setFontSize}
|
||||||
|
setCellCount={setCellCount}
|
||||||
fontColor={fontColor}
|
fontColor={fontColor}
|
||||||
setFontColor={setFontColor}
|
setFontColor={setFontColor}
|
||||||
isResize={isResize}
|
isResize={isResize}
|
||||||
@@ -1336,6 +1359,7 @@ function SignYourSelf() {
|
|||||||
currWidgetsDetails={currWidgetsDetails}
|
currWidgetsDetails={currWidgetsDetails}
|
||||||
index={index}
|
index={index}
|
||||||
isSave={true}
|
isSave={true}
|
||||||
|
signatureTypes={signatureTypes}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<RotateAlert
|
<RotateAlert
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState, useRef } from "react";
|
import { useEffect, useState, useRef } from "react";
|
||||||
import RenderAllPdfPage from "../components/pdf/RenderAllPdfPage";
|
import RenderAllPdfPage from "../components/pdf/RenderAllPdfPage";
|
||||||
import { useParams, useNavigate } from "react-router";
|
import { useParams, useNavigate } from "react-router";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
@@ -22,6 +22,7 @@ import {
|
|||||||
defaultWidthHeight,
|
defaultWidthHeight,
|
||||||
addWidgetOptions,
|
addWidgetOptions,
|
||||||
textInputWidget,
|
textInputWidget,
|
||||||
|
cellsWidget,
|
||||||
radioButtonWidget,
|
radioButtonWidget,
|
||||||
getContainerScale,
|
getContainerScale,
|
||||||
convertBase64ToFile,
|
convertBase64ToFile,
|
||||||
@@ -38,7 +39,8 @@ import {
|
|||||||
convertPdfArrayBuffer,
|
convertPdfArrayBuffer,
|
||||||
generatePdfName,
|
generatePdfName,
|
||||||
textWidget,
|
textWidget,
|
||||||
multiSignEmbed
|
multiSignEmbed,
|
||||||
|
getOriginalWH
|
||||||
} from "../constant/Utils";
|
} from "../constant/Utils";
|
||||||
import RenderPdf from "../components/pdf/RenderPdf";
|
import RenderPdf from "../components/pdf/RenderPdf";
|
||||||
import "../styles/AddUser.css";
|
import "../styles/AddUser.css";
|
||||||
@@ -375,11 +377,15 @@ const TemplatePlaceholder = () => {
|
|||||||
filterSignerPos;
|
filterSignerPos;
|
||||||
let placeHolder;
|
let placeHolder;
|
||||||
if (item === "onclick") {
|
if (item === "onclick") {
|
||||||
// `getBoundingClientRect()` is used to get accurate measurement height of the div
|
// `getBoundingClientRect()` is used to get accurate measurement width, height of the Pdf div
|
||||||
|
const divWidth = divRef.current.getBoundingClientRect().width;
|
||||||
const divHeight = divRef.current.getBoundingClientRect().height;
|
const divHeight = divRef.current.getBoundingClientRect().height;
|
||||||
|
// Compute the pixel‐space center within the PDF viewport:
|
||||||
|
const centerX_Pixels = divWidth / 2 - widgetWidth / 2;
|
||||||
|
const xPosition_Final = centerX_Pixels / (containerScale * scale);
|
||||||
dropObj = {
|
dropObj = {
|
||||||
//onclick put placeholder center on pdf
|
//onclick put placeholder center on pdf
|
||||||
xPosition: widgetWidth / 4 + containerWH.width / 2,
|
xPosition: xPosition_Final,
|
||||||
yPosition: widgetHeight + divHeight / 2,
|
yPosition: widgetHeight + divHeight / 2,
|
||||||
isStamp:
|
isStamp:
|
||||||
(dragTypeValue === "stamp" || dragTypeValue === "image") && true,
|
(dragTypeValue === "stamp" || dragTypeValue === "image") && true,
|
||||||
@@ -534,14 +540,7 @@ const TemplatePlaceholder = () => {
|
|||||||
|
|
||||||
//function for get pdf page details
|
//function for get pdf page details
|
||||||
const pageDetails = async (pdf) => {
|
const pageDetails = async (pdf) => {
|
||||||
let pdfWHObj = [];
|
const pdfWHObj = await getOriginalWH(pdf);
|
||||||
const totalPages = pdf?.numPages;
|
|
||||||
for (let index = 0; index < totalPages; index++) {
|
|
||||||
const getPage = await pdf.getPage(index + 1);
|
|
||||||
const scale = 1;
|
|
||||||
const { width, height } = getPage.getViewport({ scale });
|
|
||||||
pdfWHObj.push({ pageNumber: index + 1, width, height });
|
|
||||||
}
|
|
||||||
setPdfOriginalWH(pdfWHObj);
|
setPdfOriginalWH(pdfWHObj);
|
||||||
setPdfLoad(true);
|
setPdfLoad(true);
|
||||||
};
|
};
|
||||||
@@ -832,7 +831,9 @@ const TemplatePlaceholder = () => {
|
|||||||
});
|
});
|
||||||
const isSignYourSelfFlow = false;
|
const isSignYourSelfFlow = false;
|
||||||
try {
|
try {
|
||||||
|
//pdfOriginalWH contained all pdf's pages width,height & pagenumber in array format
|
||||||
const pdfBase64 = await multiSignEmbed(
|
const pdfBase64 = await multiSignEmbed(
|
||||||
|
pdfOriginalWH,
|
||||||
placeholder,
|
placeholder,
|
||||||
pdfDoc,
|
pdfDoc,
|
||||||
isSignYourSelfFlow,
|
isSignYourSelfFlow,
|
||||||
@@ -1149,25 +1150,6 @@ const TemplatePlaceholder = () => {
|
|||||||
const handleLinkUser = (id) => {
|
const handleLinkUser = (id) => {
|
||||||
setIsAddUser({ [id]: true });
|
setIsAddUser({ [id]: true });
|
||||||
};
|
};
|
||||||
//function to use unlink signer from widgets
|
|
||||||
const handleUnlinkSigner = () => {
|
|
||||||
//remove existing signer's details from 'signerPos' array
|
|
||||||
const updatePlaceHolder = signerPos.map((x) => {
|
|
||||||
if (x.Id === uniqueId) {
|
|
||||||
return { ...x, signerPtr: {}, signerObjId: "" };
|
|
||||||
}
|
|
||||||
return { ...x };
|
|
||||||
});
|
|
||||||
setSignerPos(updatePlaceHolder);
|
|
||||||
//remove existing signer's details from 'signersdata' array and keep role and id
|
|
||||||
const updateSigner = signersdata.map((item) => {
|
|
||||||
if (item.Id == uniqueId) {
|
|
||||||
return { Role: item.Role, Id: item.Id, blockColor: item.blockColor };
|
|
||||||
}
|
|
||||||
return item;
|
|
||||||
});
|
|
||||||
setSignersData(updateSigner);
|
|
||||||
};
|
|
||||||
// `handleAddUser` is used to adduser
|
// `handleAddUser` is used to adduser
|
||||||
const handleAddUser = (data) => {
|
const handleAddUser = (data) => {
|
||||||
const signerPtr = {
|
const signerPtr = {
|
||||||
@@ -1293,7 +1275,8 @@ const TemplatePlaceholder = () => {
|
|||||||
deleteOption,
|
deleteOption,
|
||||||
status,
|
status,
|
||||||
defaultValue,
|
defaultValue,
|
||||||
isHideLabel
|
isHideLabel,
|
||||||
|
layout
|
||||||
) => {
|
) => {
|
||||||
const filterSignerPos = signerPos.filter((data) => data.Id === uniqueId);
|
const filterSignerPos = signerPos.filter((data) => data.Id === uniqueId);
|
||||||
if (filterSignerPos.length > 0) {
|
if (filterSignerPos.length > 0) {
|
||||||
@@ -1332,6 +1315,7 @@ const TemplatePlaceholder = () => {
|
|||||||
name: dropdownName,
|
name: dropdownName,
|
||||||
values: dropdownOptions,
|
values: dropdownOptions,
|
||||||
status: status,
|
status: status,
|
||||||
|
layout: layout,
|
||||||
defaultValue: defaultValue,
|
defaultValue: defaultValue,
|
||||||
isReadOnly: isReadOnly || false,
|
isReadOnly: isReadOnly || false,
|
||||||
isHideLabel: isHideLabel || false,
|
isHideLabel: isHideLabel || false,
|
||||||
@@ -1370,6 +1354,7 @@ const TemplatePlaceholder = () => {
|
|||||||
minRequiredCount: minCount,
|
minRequiredCount: minCount,
|
||||||
maxRequiredCount: maxCount
|
maxRequiredCount: maxCount
|
||||||
},
|
},
|
||||||
|
layout: layout,
|
||||||
isReadOnly: isReadOnly || false,
|
isReadOnly: isReadOnly || false,
|
||||||
defaultValue: defaultValue,
|
defaultValue: defaultValue,
|
||||||
isHideLabel: isHideLabel || false,
|
isHideLabel: isHideLabel || false,
|
||||||
@@ -1470,6 +1455,36 @@ const TemplatePlaceholder = () => {
|
|||||||
"black"
|
"black"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
} else if (position.type === cellsWidget) {
|
||||||
|
return {
|
||||||
|
...position,
|
||||||
|
options: {
|
||||||
|
...position.options,
|
||||||
|
name: defaultdata?.name || "Cells",
|
||||||
|
status: defaultdata?.status || "required",
|
||||||
|
hint: defaultdata?.hint || "",
|
||||||
|
cellCount: parseInt(defaultdata?.cellCount || 5),
|
||||||
|
defaultValue: (defaultdata?.defaultValue || "").slice(
|
||||||
|
0,
|
||||||
|
parseInt(defaultdata?.cellCount || 5)
|
||||||
|
),
|
||||||
|
validation:
|
||||||
|
isSubscribe && inputype
|
||||||
|
? {
|
||||||
|
type: inputype,
|
||||||
|
pattern:
|
||||||
|
inputype === "regex" ? defaultdata.textvalidate : ""
|
||||||
|
}
|
||||||
|
: {},
|
||||||
|
isReadOnly: defaultdata?.isReadOnly || false,
|
||||||
|
fontSize:
|
||||||
|
fontSize || currWidgetsDetails?.options?.fontSize || 12,
|
||||||
|
fontColor:
|
||||||
|
fontColor ||
|
||||||
|
currWidgetsDetails?.options?.fontColor ||
|
||||||
|
"black"
|
||||||
|
}
|
||||||
|
};
|
||||||
} else if (["signature"].includes(position.type)) {
|
} else if (["signature"].includes(position.type)) {
|
||||||
return {
|
return {
|
||||||
...position,
|
...position,
|
||||||
@@ -1529,6 +1544,22 @@ const TemplatePlaceholder = () => {
|
|||||||
setIsRadio(false);
|
setIsRadio(false);
|
||||||
setIsCheckbox(false);
|
setIsCheckbox(false);
|
||||||
};
|
};
|
||||||
|
const setCellCount = (key, newCount) => {
|
||||||
|
const updated = signerPos.map((signer) => {
|
||||||
|
if (signer.Id !== uniqueId) return signer;
|
||||||
|
const placeHolder = signer.placeHolder.map((ph) => {
|
||||||
|
if (ph.pageNumber !== pageNumber) return ph;
|
||||||
|
const pos = ph.pos.map((p) =>
|
||||||
|
p.key === key
|
||||||
|
? { ...p, options: { ...p.options, cellCount: newCount } }
|
||||||
|
: p
|
||||||
|
);
|
||||||
|
return { ...ph, pos };
|
||||||
|
});
|
||||||
|
return { ...signer, placeHolder };
|
||||||
|
});
|
||||||
|
setSignerPos(updated);
|
||||||
|
};
|
||||||
|
|
||||||
const clickOnZoomIn = () => {
|
const clickOnZoomIn = () => {
|
||||||
onClickZoomIn(scale, zoomPercent, setScale, setZoomPercent);
|
onClickZoomIn(scale, zoomPercent, setScale, setZoomPercent);
|
||||||
@@ -1847,6 +1878,7 @@ const TemplatePlaceholder = () => {
|
|||||||
pdfBase64Url={pdfBase64Url}
|
pdfBase64Url={pdfBase64Url}
|
||||||
fontSize={fontSize}
|
fontSize={fontSize}
|
||||||
setFontSize={setFontSize}
|
setFontSize={setFontSize}
|
||||||
|
setCellCount={setCellCount}
|
||||||
fontColor={fontColor}
|
fontColor={fontColor}
|
||||||
setFontColor={setFontColor}
|
setFontColor={setFontColor}
|
||||||
isResize={isResize}
|
isResize={isResize}
|
||||||
@@ -1950,7 +1982,9 @@ const TemplatePlaceholder = () => {
|
|||||||
closePopup={closePopup}
|
closePopup={closePopup}
|
||||||
signersData={signersdata}
|
signersData={signersdata}
|
||||||
signerPos={signerPos}
|
signerPos={signerPos}
|
||||||
handleUnlinkSigner={handleUnlinkSigner}
|
setSignerPos={setSignerPos}
|
||||||
|
setSignersData={setSignersData}
|
||||||
|
isRemove={true}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -423,9 +423,9 @@ function UserProfile() {
|
|||||||
onClick={() =>
|
onClick={() =>
|
||||||
editmode ? handleCancel() : navigate("/changepassword")
|
editmode ? handleCancel() : navigate("/changepassword")
|
||||||
}
|
}
|
||||||
className={`op-btn ${
|
className={
|
||||||
editmode ? "op-btn-ghost w-[100px]" : "op-btn-secondary"
|
`op-btn ${editmode ? "op-btn-ghost w-[100px]" : "op-btn-secondary"}`
|
||||||
}`}
|
}
|
||||||
>
|
>
|
||||||
{editmode ? t("cancel") : t("change-password")}
|
{editmode ? t("cancel") : t("change-password")}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -0,0 +1,864 @@
|
|||||||
|
import React, { useState, useEffect } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { PDFDocument, PDFName, PDFSignature, PDFRef, PDFDict } from 'pdf-lib'; // Updated import
|
||||||
|
import * as asn1js from 'asn1js';
|
||||||
|
import { Certificate, ContentInfo, SignedData, IssuerAndSerialNumber } from 'pkijs';
|
||||||
|
// import * as jsrsasign from 'jsrsasign'; // Removed for dynamic loading
|
||||||
|
|
||||||
|
const VerifyDocument = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const [selectedFile, setSelectedFile] = useState(null);
|
||||||
|
const [fileBuffer, setFileBuffer] = useState(null);
|
||||||
|
const [verificationResult, setVerificationResult] = useState('');
|
||||||
|
const [detailedResults, setDetailedResults] = useState([]);
|
||||||
|
const [collapsedSections, setCollapsedSections] = useState({});
|
||||||
|
// const [jsrsasignStatus, setJsrsasignStatus] = useState('loading'); // Removed
|
||||||
|
|
||||||
|
// OID to human-readable label mapping
|
||||||
|
const oidMapping = {
|
||||||
|
'2.5.4.6': 'Country',
|
||||||
|
'2.5.4.10': 'Organization',
|
||||||
|
'2.5.4.11': 'Organizational Unit',
|
||||||
|
'2.5.4.17': 'Postal Code',
|
||||||
|
'2.5.4.8': 'State',
|
||||||
|
'2.5.4.7': 'Locality', // Alternative for City
|
||||||
|
'2.5.4.9': 'City',
|
||||||
|
'2.5.4.51': 'Address',
|
||||||
|
'2.5.4.3': 'Common Name',
|
||||||
|
'2.5.4.4': 'Surname',
|
||||||
|
'2.5.4.5': 'Serial Number',
|
||||||
|
'2.5.4.12': 'Title',
|
||||||
|
'2.5.4.13': 'Description',
|
||||||
|
'2.5.4.16': 'Postal Address',
|
||||||
|
'2.5.4.18': 'Post Office Box',
|
||||||
|
'2.5.4.20': 'Telephone Number',
|
||||||
|
'1.2.840.113549.1.9.1': 'Email Address',
|
||||||
|
// Common alternative OIDs
|
||||||
|
'C': 'Country',
|
||||||
|
'O': 'Organization',
|
||||||
|
'OU': 'Organizational Unit',
|
||||||
|
'CN': 'Common Name',
|
||||||
|
'ST': 'State',
|
||||||
|
'L': 'Locality',
|
||||||
|
'STREET': 'Address',
|
||||||
|
'emailAddress': 'Email Address',
|
||||||
|
'serialNumber': 'Serial Number'
|
||||||
|
};
|
||||||
|
|
||||||
|
// Function to parse certificate subject/issuer into structured data
|
||||||
|
const parseCertificateInfo = (certString) => {
|
||||||
|
if (!certString) return {};
|
||||||
|
|
||||||
|
const parsed = {};
|
||||||
|
|
||||||
|
// Find all OID patterns and their positions
|
||||||
|
const oidPattern = /(\d+\.\d+\.\d+\.\d+|\w+)=/g;
|
||||||
|
const matches = [];
|
||||||
|
let match;
|
||||||
|
|
||||||
|
while ((match = oidPattern.exec(certString)) !== null) {
|
||||||
|
matches.push({
|
||||||
|
oid: match[1],
|
||||||
|
startIndex: match.index,
|
||||||
|
equalIndex: match.index + match[1].length
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract value for each OID
|
||||||
|
for (let i = 0; i < matches.length; i++) {
|
||||||
|
const currentMatch = matches[i];
|
||||||
|
const nextMatch = matches[i + 1];
|
||||||
|
|
||||||
|
const valueStart = currentMatch.equalIndex + 1; // Skip the "=" character
|
||||||
|
const valueEnd = nextMatch ? nextMatch.startIndex - 2 : certString.length; // -2 to remove ", " before next OID
|
||||||
|
|
||||||
|
const value = certString.substring(valueStart, valueEnd).trim();
|
||||||
|
const label = oidMapping[currentMatch.oid] || currentMatch.oid;
|
||||||
|
|
||||||
|
parsed[label] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parsed;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Function to determine if status should show success icon
|
||||||
|
const isSuccessStatus = (status) => {
|
||||||
|
const successTerms = ['valid', 'success', 'parsed', 'verified'];
|
||||||
|
const errorTerms = ['error', 'invalid', 'failed', 'expired'];
|
||||||
|
|
||||||
|
const statusLower = status.toLowerCase();
|
||||||
|
|
||||||
|
// Check for explicit error terms first
|
||||||
|
if (errorTerms.some(term => statusLower.includes(term))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for success terms
|
||||||
|
return successTerms.some(term => statusLower.includes(term));
|
||||||
|
};
|
||||||
|
|
||||||
|
// Function to determine if certificate validity should show success icon
|
||||||
|
const isCertificateValid = (validityText) => {
|
||||||
|
const validityLower = validityText.toLowerCase();
|
||||||
|
|
||||||
|
// If it contains "valid" and doesn't contain negative terms
|
||||||
|
return validityLower.includes('valid') &&
|
||||||
|
!validityLower.includes('expired') &&
|
||||||
|
!validityLower.includes('not yet valid') &&
|
||||||
|
!validityLower.includes('invalid');
|
||||||
|
};
|
||||||
|
|
||||||
|
// Toggle collapsible sections
|
||||||
|
const toggleSection = (signatureIndex, section) => {
|
||||||
|
const key = `${signatureIndex}-${section}`;
|
||||||
|
setCollapsedSections(prev => ({
|
||||||
|
...prev,
|
||||||
|
[key]: !prev[key]
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
// useEffect for jsrsasign loading removed
|
||||||
|
|
||||||
|
const handleFileChange = (event) => {
|
||||||
|
const file = event.target.files[0];
|
||||||
|
if (file && file.type === 'application/pdf') {
|
||||||
|
setSelectedFile(file);
|
||||||
|
setVerificationResult('');
|
||||||
|
setDetailedResults([]);
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.onload = (e) => {
|
||||||
|
setFileBuffer(e.target.result);
|
||||||
|
};
|
||||||
|
reader.readAsArrayBuffer(file);
|
||||||
|
} else {
|
||||||
|
setSelectedFile(null);
|
||||||
|
setFileBuffer(null);
|
||||||
|
setDetailedResults([]);
|
||||||
|
setVerificationResult(t('please-select-pdf'));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const parseSignature = async (pdfDoc) => {
|
||||||
|
const signatureFields = pdfDoc.getForm().getFields().filter(field => field instanceof PDFSignature); // Updated filter logic
|
||||||
|
if (!signatureFields.length) {
|
||||||
|
return { error: t('no-signature-found') };
|
||||||
|
}
|
||||||
|
|
||||||
|
const results = [];
|
||||||
|
|
||||||
|
for (const field of signatureFields) {
|
||||||
|
try {
|
||||||
|
if (!field.acroField || !field.acroField.dict) {
|
||||||
|
results.push({
|
||||||
|
name: field.getName() || t('unnamed-signature-field'),
|
||||||
|
status: t('error-processing-signature'),
|
||||||
|
errorDetails: t('missing-acrofield-dict'),
|
||||||
|
signerInfo: t('signer-info-not-available'),
|
||||||
|
certificateSubject: '',
|
||||||
|
certificateIssuer: '',
|
||||||
|
certificateValidity: t('cert-validity-not-checked'),
|
||||||
|
isCertificateDateValid: false,
|
||||||
|
calculatedDocumentHash: t('not-available'),
|
||||||
|
messageDigestInSignature: t('not-available'),
|
||||||
|
hashComparisonResult: t('not-performed'),
|
||||||
|
authenticatedAttributesSignatureResult: t('not-performed'),
|
||||||
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// New logic to determine the actual signature dictionary
|
||||||
|
const fieldDict = field.acroField.dict;
|
||||||
|
const vEntry = fieldDict.get(PDFName.of('V'));
|
||||||
|
let actualSignatureDict = null;
|
||||||
|
|
||||||
|
if (vEntry) {
|
||||||
|
if (vEntry instanceof PDFRef) {
|
||||||
|
const lookedUp = pdfDoc.context.lookup(vEntry);
|
||||||
|
if (lookedUp instanceof PDFDict) {
|
||||||
|
actualSignatureDict = lookedUp;
|
||||||
|
}
|
||||||
|
} else if (vEntry instanceof PDFDict) {
|
||||||
|
actualSignatureDict = vEntry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use actualSignatureDict if found, otherwise behavior might be problematic (as per existing logic)
|
||||||
|
// If actualSignatureDict is null, subsequent checks for byteRangeObject etc. will fail,
|
||||||
|
// leading to an error message for this signature, which is acceptable.
|
||||||
|
const signatureDict = actualSignatureDict;
|
||||||
|
|
||||||
|
// Check if signatureDict is null (meaning actualSignatureDict was not resolved)
|
||||||
|
// and push an error if it is, before trying to get ByteRange or Contents.
|
||||||
|
if (!signatureDict) {
|
||||||
|
results.push({
|
||||||
|
name: field.getName() || t('unnamed-signature-field'),
|
||||||
|
status: t('error-processing-signature'),
|
||||||
|
errorDetails: t('signature-dictionary-not-found-or-invalid'), // New error message
|
||||||
|
signerInfo: t('signer-info-not-available'),
|
||||||
|
certificateSubject: '',
|
||||||
|
certificateIssuer: '',
|
||||||
|
certificateValidity: t('cert-validity-not-checked'),
|
||||||
|
isCertificateDateValid: false,
|
||||||
|
calculatedDocumentHash: t('not-available'),
|
||||||
|
messageDigestInSignature: t('not-available'),
|
||||||
|
hashComparisonResult: t('not-performed'),
|
||||||
|
authenticatedAttributesSignatureResult: t('not-performed'),
|
||||||
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const byteRangeObject = signatureDict.get(PDFName.of('ByteRange'));
|
||||||
|
let byteRange; // Will be assigned after validation
|
||||||
|
|
||||||
|
// Comprehensive validation for byteRangeObject and its contents
|
||||||
|
if (!byteRangeObject ||
|
||||||
|
!byteRangeObject.array ||
|
||||||
|
!Array.isArray(byteRangeObject.array) ||
|
||||||
|
byteRangeObject.array.length === 0 ||
|
||||||
|
byteRangeObject.array.length % 2 !== 0) {
|
||||||
|
results.push({
|
||||||
|
name: field.getName() || t('unnamed-signature-field'),
|
||||||
|
status: t('error-processing-signature'),
|
||||||
|
errorDetails: t('missing-or-invalid-byterange'),
|
||||||
|
signerInfo: t('signer-info-not-available'),
|
||||||
|
certificateSubject: '',
|
||||||
|
certificateIssuer: '',
|
||||||
|
certificateValidity: t('cert-validity-not-checked'),
|
||||||
|
isCertificateDateValid: false,
|
||||||
|
calculatedDocumentHash: t('not-available'),
|
||||||
|
messageDigestInSignature: t('not-available'),
|
||||||
|
hashComparisonResult: t('not-performed'),
|
||||||
|
authenticatedAttributesSignatureResult: t('not-performed'),
|
||||||
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const byteRangeNumbers = [];
|
||||||
|
let byteRangeIsValid = true;
|
||||||
|
for (const pdfObject of byteRangeObject.array) {
|
||||||
|
if (!pdfObject || typeof pdfObject.asNumber !== 'function') {
|
||||||
|
byteRangeIsValid = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const num = pdfObject.asNumber();
|
||||||
|
if (!Number.isFinite(num)) { // Checks for NaN, Infinity, -Infinity
|
||||||
|
byteRangeIsValid = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
byteRangeNumbers.push(num);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!byteRangeIsValid) {
|
||||||
|
results.push({
|
||||||
|
name: field.getName() || t('unnamed-signature-field'),
|
||||||
|
status: t('error-processing-signature'),
|
||||||
|
errorDetails: t('missing-or-invalid-byterange'), // Or a more specific error like "ByteRange contains non-numeric values"
|
||||||
|
signerInfo: t('signer-info-not-available'),
|
||||||
|
certificateSubject: '',
|
||||||
|
certificateIssuer: '',
|
||||||
|
certificateValidity: t('cert-validity-not-checked'),
|
||||||
|
isCertificateDateValid: false,
|
||||||
|
calculatedDocumentHash: t('not-available'),
|
||||||
|
messageDigestInSignature: t('not-available'),
|
||||||
|
hashComparisonResult: t('not-performed'),
|
||||||
|
authenticatedAttributesSignatureResult: t('not-performed'),
|
||||||
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
byteRange = byteRangeNumbers; // Assign the validated numbers to byteRange
|
||||||
|
|
||||||
|
const contentsObject = signatureDict.get(PDFName.of('Contents'));
|
||||||
|
if (!contentsObject || typeof contentsObject.asString !== 'function') {
|
||||||
|
results.push({
|
||||||
|
name: field.getName() || t('unnamed-signature-field'),
|
||||||
|
status: t('error-processing-signature'),
|
||||||
|
errorDetails: t('missing-or-invalid-contents'),
|
||||||
|
signerInfo: t('signer-info-not-available'),
|
||||||
|
certificateSubject: '',
|
||||||
|
certificateIssuer: '',
|
||||||
|
certificateValidity: t('cert-validity-not-checked'),
|
||||||
|
isCertificateDateValid: false,
|
||||||
|
calculatedDocumentHash: t('not-available'),
|
||||||
|
messageDigestInSignature: t('not-available'),
|
||||||
|
hashComparisonResult: t('not-performed'),
|
||||||
|
authenticatedAttributesSignatureResult: t('not-performed'),
|
||||||
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const contents = contentsObject.asString();
|
||||||
|
|
||||||
|
// The old basic check can be removed now as the more specific checks above cover these cases.
|
||||||
|
// if (!byteRange || !contents) { ... }
|
||||||
|
|
||||||
|
// Calculate totalSignedLength for accurate buffer initialization
|
||||||
|
let totalSignedLength = 0;
|
||||||
|
for (let i = 1; i < byteRange.length; i += 2) {
|
||||||
|
totalSignedLength += byteRange[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (totalSignedLength <= 0) {
|
||||||
|
results.push({
|
||||||
|
name: field.getName() || t('unnamed-signature-field'),
|
||||||
|
status: t('error-processing-signature'),
|
||||||
|
errorDetails: t('missing-or-invalid-byterange'), // totalSignedLength being non-positive implies invalid ByteRange
|
||||||
|
signerInfo: t('signer-info-not-available'),
|
||||||
|
certificateSubject: '',
|
||||||
|
certificateIssuer: '',
|
||||||
|
certificateValidity: t('cert-validity-not-checked'),
|
||||||
|
isCertificateDateValid: false,
|
||||||
|
calculatedDocumentHash: t('not-available'),
|
||||||
|
messageDigestInSignature: t('not-available'),
|
||||||
|
hashComparisonResult: t('not-performed'),
|
||||||
|
authenticatedAttributesSignatureResult: t('not-performed'),
|
||||||
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const pdfSignedDataBytes = new Uint8Array(totalSignedLength);
|
||||||
|
let offset = 0;
|
||||||
|
let reconstructionFailed = false;
|
||||||
|
|
||||||
|
for (let i = 0; i < byteRange.length; i += 2) {
|
||||||
|
const start = byteRange[i];
|
||||||
|
const length = byteRange[i+1];
|
||||||
|
|
||||||
|
if (start < 0 || length <= 0 || start + length > fileBuffer.byteLength) {
|
||||||
|
reconstructionFailed = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pdfSignedDataBytes.set(new Uint8Array(fileBuffer.slice(start, start + length)), offset);
|
||||||
|
offset += length;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reconstructionFailed) {
|
||||||
|
results.push({
|
||||||
|
name: field.getName() || t('unnamed-signature-field'),
|
||||||
|
status: t('error-processing-signature'),
|
||||||
|
errorDetails: t('missing-or-invalid-byterange'), // Error during reconstruction due to invalid segment
|
||||||
|
signerInfo: t('signer-info-not-available'),
|
||||||
|
certificateSubject: '',
|
||||||
|
certificateIssuer: '',
|
||||||
|
certificateValidity: t('cert-validity-not-checked'),
|
||||||
|
isCertificateDateValid: false,
|
||||||
|
calculatedDocumentHash: t('not-available'),
|
||||||
|
messageDigestInSignature: t('not-available'),
|
||||||
|
hashComparisonResult: t('not-performed'),
|
||||||
|
authenticatedAttributesSignatureResult: t('not-performed'),
|
||||||
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove leading/trailing null bytes from hex if present from PDF content
|
||||||
|
const pkcs7Hex = contents.trim();
|
||||||
|
|
||||||
|
if (!pkcs7Hex) {
|
||||||
|
results.push({
|
||||||
|
name: field.getName() || t('unnamed-signature-field'),
|
||||||
|
status: t('signature-invalid-basic'),
|
||||||
|
errorDetails: t('missing-signature-contents'), // New i18n key
|
||||||
|
signerInfo: t('signer-info-not-available'),
|
||||||
|
certificateSubject: '',
|
||||||
|
certificateIssuer: '',
|
||||||
|
certificateValidity: t('cert-validity-not-checked'),
|
||||||
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert hex string to ArrayBuffer
|
||||||
|
let cmsContentBuffer;
|
||||||
|
try {
|
||||||
|
cmsContentBuffer = new Uint8Array(pkcs7Hex.match(/.{1,2}/g).map(byte => parseInt(byte, 16))).buffer;
|
||||||
|
} catch (hexError) {
|
||||||
|
// console.error('Error converting hex string to ArrayBuffer:', hexError); // Removed
|
||||||
|
results.push({
|
||||||
|
name: field.getName() || t('unnamed-signature-field'),
|
||||||
|
status: t('signature-invalid-basic'),
|
||||||
|
errorDetails: t('invalid-signature-hex-format'), // New i18n key
|
||||||
|
signerInfo: t('signer-info-not-available'),
|
||||||
|
certificateSubject: '',
|
||||||
|
certificateIssuer: '',
|
||||||
|
certificateValidity: t('cert-validity-not-checked'),
|
||||||
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Parse the CMS ContentInfo
|
||||||
|
const asn1 = asn1js.fromBER(cmsContentBuffer);
|
||||||
|
if (asn1.offset === -1) {
|
||||||
|
// console.error('Error parsing ASN.1 from signature data'); // Removed
|
||||||
|
results.push({
|
||||||
|
name: field.getName() || t('unnamed-signature-field'),
|
||||||
|
status: t('signature-invalid-basic'),
|
||||||
|
errorDetails: 'ASN.1 parsing error from signature data.',
|
||||||
|
signerInfo: t('signer-info-not-available'),
|
||||||
|
certificateSubject: '',
|
||||||
|
certificateIssuer: '',
|
||||||
|
certificateValidity: t('cert-validity-not-checked'),
|
||||||
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const cmsContentInfo = new ContentInfo({ schema: asn1.result });
|
||||||
|
if (String(cmsContentInfo.contentType).trim() !== String(ContentInfo.SIGNED_DATA).trim()) {
|
||||||
|
// console.error('Not a SignedData content type. Actual type:', cmsContentInfo.contentType, 'Expected:', ContentInfo.SIGNED_DATA); // Removed
|
||||||
|
results.push({
|
||||||
|
name: field.getName() || t('unnamed-signature-field'),
|
||||||
|
status: t('signature-invalid-basic'),
|
||||||
|
errorDetails: t('unsupported-signature-format-not-signeddata'), // New i18n key
|
||||||
|
signerInfo: t('signer-info-not-available'),
|
||||||
|
certificateSubject: '',
|
||||||
|
certificateIssuer: '',
|
||||||
|
certificateValidity: t('cert-validity-not-checked'),
|
||||||
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const signedData = new SignedData({ schema: cmsContentInfo.content });
|
||||||
|
|
||||||
|
let signerInfoText = t('signer-info-not-available');
|
||||||
|
let certSubject = '';
|
||||||
|
let certIssuer = '';
|
||||||
|
let certValidity = t('cert-validity-not-checked');
|
||||||
|
let isValid = false;
|
||||||
|
|
||||||
|
if (signedData.signerInfos && signedData.signerInfos.length > 0) {
|
||||||
|
const signerInfo = signedData.signerInfos[0];
|
||||||
|
|
||||||
|
if (signedData.certificates && signedData.certificates.length > 0) {
|
||||||
|
let signerCertificate = null;
|
||||||
|
for (const cert of signedData.certificates) {
|
||||||
|
if (cert instanceof Certificate) {
|
||||||
|
const issuerAndSerialNumber = signerInfo.sid;
|
||||||
|
if (issuerAndSerialNumber instanceof IssuerAndSerialNumber) {
|
||||||
|
let certMatch = true;
|
||||||
|
if (cert.issuer.typesAndValues.length === issuerAndSerialNumber.issuer.typesAndValues.length) {
|
||||||
|
for (let i = 0; i < cert.issuer.typesAndValues.length; i++) {
|
||||||
|
if (cert.issuer.typesAndValues[i].type !== issuerAndSerialNumber.issuer.typesAndValues[i].type ||
|
||||||
|
cert.issuer.typesAndValues[i].value.valueBlock.value !== issuerAndSerialNumber.issuer.typesAndValues[i].value.valueBlock.value) {
|
||||||
|
certMatch = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
certMatch = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (certMatch && cert.serialNumber.valueBlock.valueHexView.join('') === issuerAndSerialNumber.serialNumber.valueBlock.valueHexView.join('')) {
|
||||||
|
signerCertificate = cert;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (signerCertificate) {
|
||||||
|
certSubject = signerCertificate.subject.typesAndValues.map(tv => `${tv.type}=${tv.value.valueBlock.value}`).join(', ');
|
||||||
|
certIssuer = signerCertificate.issuer.typesAndValues.map(tv => `${tv.type}=${tv.value.valueBlock.value}`).join(', ');
|
||||||
|
signerInfoText = `${t('signer')}: ${certSubject}, ${t('issuer')}: ${certIssuer}`;
|
||||||
|
|
||||||
|
const notBefore = signerCertificate.notBefore.value;
|
||||||
|
const notAfter = signerCertificate.notAfter.value;
|
||||||
|
const currentDate = new Date();
|
||||||
|
certValidity = `${t('valid-from')} ${notBefore.toLocaleDateString()} ${t('to')} ${notAfter.toLocaleDateString()}`;
|
||||||
|
if (currentDate < notBefore || currentDate > notAfter) {
|
||||||
|
certValidity += ` (${t('expired-or-not-yet-valid')})`;
|
||||||
|
isValid = false; // Explicitly false if expired
|
||||||
|
} else {
|
||||||
|
certValidity += ` (${t('valid')})`;
|
||||||
|
isValid = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
signerInfoText = t('signer-certificate-not-found'); // New i18n key
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
signerInfoText = t('no-certificates-in-signature'); // New i18n key
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
signerInfoText = t('no-signer-info-in-pkcs7'); // Re-use existing key, or make new one
|
||||||
|
}
|
||||||
|
|
||||||
|
results.push({
|
||||||
|
name: field.getName() || t('unnamed-signature-field'),
|
||||||
|
status: isValid ? t('signature-valid-basic') : t('signature-invalid-basic'),
|
||||||
|
signerInfo: signerInfoText,
|
||||||
|
certificateSubject: certSubject,
|
||||||
|
certificateIssuer: certIssuer,
|
||||||
|
certificateValidity: certValidity,
|
||||||
|
errorDetails: !isValid && signerInfoText === t('signer-info-not-available') ? t('could-not-parse-signer-info') : undefined, // New i18n key
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Error processing signature field with pkijs:', field.getName(), e);
|
||||||
|
results.push({
|
||||||
|
name: field.getName() || t('unnamed-signature-field'),
|
||||||
|
status: t('error-processing-signature'),
|
||||||
|
errorDetails: e.message,
|
||||||
|
signerInfo: t('signer-info-not-available'),
|
||||||
|
certificateSubject: '',
|
||||||
|
certificateIssuer: '',
|
||||||
|
certificateValidity: t('cert-validity-not-checked'),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return { results };
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const handleVerifyDocument = async () => {
|
||||||
|
// Removed jsrsasignStatus check
|
||||||
|
|
||||||
|
if (!fileBuffer) {
|
||||||
|
setVerificationResult(t('please-select-file-to-verify'));
|
||||||
|
setDetailedResults([]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setVerificationResult(t('verification-in-progress'));
|
||||||
|
setDetailedResults([]);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Removed window.KJUR and window.X509 check
|
||||||
|
|
||||||
|
const pdfDoc = await PDFDocument.load(fileBuffer, { ignoreEncryption: true });
|
||||||
|
const signatureInfo = await parseSignature(pdfDoc);
|
||||||
|
|
||||||
|
if (signatureInfo.error) {
|
||||||
|
setVerificationResult(signatureInfo.error);
|
||||||
|
} else if (signatureInfo.results && signatureInfo.results.length > 0) {
|
||||||
|
setDetailedResults(signatureInfo.results);
|
||||||
|
// Overall status can be determined by checking if all signatures are valid
|
||||||
|
const allValid = signatureInfo.results.every(res => res.status === t('signature-valid-basic'));
|
||||||
|
setVerificationResult(allValid ? t('all-signatures-verified-convincing') : t('some-signatures-invalid-basic'));
|
||||||
|
} else {
|
||||||
|
setVerificationResult(t('no-signatures-processed')); // Should be caught by no-signature-found earlier
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Error during PDF processing or signature verification:', e);
|
||||||
|
setVerificationResult(`${t('error-verifying-pdf')}: ${e.message}`);
|
||||||
|
setDetailedResults([]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="container mx-auto p-6 bg-base-100 shadow-xl rounded-lg mt-10">
|
||||||
|
<style>{`
|
||||||
|
.checkmark__circle {
|
||||||
|
stroke-dasharray: 166;
|
||||||
|
stroke-dashoffset: 166;
|
||||||
|
stroke-width: 2;
|
||||||
|
stroke-miterlimit: 10;
|
||||||
|
stroke: #7ac142; /* Green color */
|
||||||
|
fill: none;
|
||||||
|
animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkmark {
|
||||||
|
width: 56px;
|
||||||
|
height: 56px;
|
||||||
|
border-radius: 50%;
|
||||||
|
display: block;
|
||||||
|
stroke-width: 2;
|
||||||
|
stroke: #fff; /* White check path */
|
||||||
|
stroke-miterlimit: 10;
|
||||||
|
margin: 10px auto; /* Example margin */
|
||||||
|
box-shadow: inset 0px 0px 0px #7ac142;
|
||||||
|
animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkmark__check {
|
||||||
|
transform-origin: 50% 50%;
|
||||||
|
stroke-dasharray: 48;
|
||||||
|
stroke-dashoffset: 48;
|
||||||
|
animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes stroke {
|
||||||
|
100% {
|
||||||
|
stroke-dashoffset: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes scale {
|
||||||
|
0%, 100% {
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
transform: scale3d(1.1, 1.1, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fill {
|
||||||
|
100% {
|
||||||
|
box-shadow: inset 0px 0px 0px 30px #7ac142;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`}</style>
|
||||||
|
<h1 className="text-3xl font-bold mb-6 text-center text-base-content">
|
||||||
|
{t('verify-document-signature')}
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div className="mb-6 p-6 border border-base-300 rounded-lg bg-base-200/30 shadow-sm">
|
||||||
|
<label
|
||||||
|
htmlFor="document-upload"
|
||||||
|
className="block text-lg font-medium text-base-content mb-2"
|
||||||
|
>
|
||||||
|
{t('select-pdf-document')}
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="file"
|
||||||
|
id="document-upload"
|
||||||
|
accept=".pdf"
|
||||||
|
onChange={handleFileChange}
|
||||||
|
className="file-input file-input-bordered file-input-primary w-full max-w-xs"
|
||||||
|
/>
|
||||||
|
{selectedFile && (
|
||||||
|
<p className="mt-2 text-sm text-base-content w-full truncate">
|
||||||
|
{t('selected-file')}: {selectedFile.name}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="text-center mb-6">
|
||||||
|
<button
|
||||||
|
onClick={handleVerifyDocument}
|
||||||
|
className="op-btn op-btn-primary op-btn-md"
|
||||||
|
disabled={!selectedFile || verificationResult === t('verification-in-progress')}
|
||||||
|
>
|
||||||
|
{/* Removed jsrsasignStatus === 'loading' condition for spinner */}
|
||||||
|
{verificationResult === t('verification-in-progress') ? (
|
||||||
|
<span className="loading loading-spinner"></span>
|
||||||
|
) : (
|
||||||
|
t('verify-signature')
|
||||||
|
)}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{verificationResult && verificationResult !== t('verification-in-progress') && (
|
||||||
|
<div className="mt-8 p-6 border border-base-300 rounded-lg bg-base-200 shadow-md min-h-[120px] flex flex-col items-center justify-center">
|
||||||
|
<h2 className="text-2xl font-bold mb-4 text-base-content text-center">
|
||||||
|
{t('verification-status')}
|
||||||
|
</h2>
|
||||||
|
{verificationResult === "Document Verified: All signatures have been successfully validated." && (
|
||||||
|
<div className="flex flex-col items-center my-4">
|
||||||
|
<svg className="checkmark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52">
|
||||||
|
<circle className="checkmark__circle" cx="26" cy="26" r="25" fill="none"/>
|
||||||
|
<path className="checkmark__check" fill="none" d="M14.1 27.2l7.1 7.2 16.7-16.8"/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<p className="text-lg text-base-content mb-4 text-center">{verificationResult}</p>
|
||||||
|
{detailedResults.length > 0 && (
|
||||||
|
<div className="w-full space-y-6">
|
||||||
|
{detailedResults.map((res, index) => {
|
||||||
|
const signerInfo = parseCertificateInfo(res.certificateSubject);
|
||||||
|
const issuerInfo = parseCertificateInfo(res.certificateIssuer);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div key={index} className="bg-white border border-gray-200 rounded-xl shadow-lg overflow-hidden">
|
||||||
|
{/* Header Section */}
|
||||||
|
<div className="bg-gradient-to-r from-blue-600 to-indigo-600 text-white p-6">
|
||||||
|
<div className="flex items-center space-x-3">
|
||||||
|
<span className="text-2xl">🔏</span>
|
||||||
|
<div>
|
||||||
|
<h4 className="text-xl font-bold">Signature Details</h4>
|
||||||
|
<p className="text-blue-100 text-sm">Digital Certificate Information</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Basic Info Section */}
|
||||||
|
<div className="p-6 border-b border-gray-100">
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
|
<div>
|
||||||
|
<span className="text-sm font-medium text-gray-500 uppercase tracking-wide">Field Name</span>
|
||||||
|
<p className="mt-1 text-lg font-semibold text-gray-900 font-mono">{res.name}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span className="text-sm font-medium text-gray-500 uppercase tracking-wide">Overall Status</span>
|
||||||
|
<div className="mt-1 flex items-center space-x-2">
|
||||||
|
<span className={`text-lg ${isSuccessStatus(res.status) ? 'text-green-600' : 'text-red-600'}`}>
|
||||||
|
{isSuccessStatus(res.status) ? '✅' : '❌'}
|
||||||
|
</span>
|
||||||
|
<span className="text-lg font-semibold text-gray-900">{res.status}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Signer Information Section */}
|
||||||
|
{Object.keys(signerInfo).length > 0 && (
|
||||||
|
<div className="border-b border-gray-100">
|
||||||
|
<button
|
||||||
|
onClick={() => toggleSection(index, 'signer')}
|
||||||
|
className="w-full px-6 py-4 text-left hover:bg-gray-50 transition-colors duration-200 focus:outline-none focus:bg-gray-50"
|
||||||
|
>
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<div className="flex items-center space-x-3">
|
||||||
|
<span className="text-xl">📇</span>
|
||||||
|
<h5 className="text-lg font-semibold text-gray-900">Signer Information</h5>
|
||||||
|
</div>
|
||||||
|
<svg
|
||||||
|
className={`w-5 h-5 text-gray-400 transition-transform duration-200 ${
|
||||||
|
collapsedSections[`${index}-signer`] ? 'transform rotate-180' : ''
|
||||||
|
}`}
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" />
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
{!collapsedSections[`${index}-signer`] && (
|
||||||
|
<div className="px-6 pb-6">
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||||
|
{Object.entries(signerInfo).map(([label, value]) => (
|
||||||
|
<div key={label} className="bg-gray-50 rounded-lg p-4">
|
||||||
|
<span className="text-xs font-medium text-gray-500 uppercase tracking-wide">{label}</span>
|
||||||
|
<p className="mt-1 text-sm font-mono text-gray-900 break-all">{value}</p>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Issuer Information Section */}
|
||||||
|
{Object.keys(issuerInfo).length > 0 && (
|
||||||
|
<div className="border-b border-gray-100">
|
||||||
|
<button
|
||||||
|
onClick={() => toggleSection(index, 'issuer')}
|
||||||
|
className="w-full px-6 py-4 text-left hover:bg-gray-50 transition-colors duration-200 focus:outline-none focus:bg-gray-50"
|
||||||
|
>
|
||||||
|
<div className="flex items-center justify-between">
|
||||||
|
<div className="flex items-center space-x-3">
|
||||||
|
<span className="text-xl">🏢</span>
|
||||||
|
<h5 className="text-lg font-semibold text-gray-900">Issuer Details</h5>
|
||||||
|
</div>
|
||||||
|
<svg
|
||||||
|
className={`w-5 h-5 text-gray-400 transition-transform duration-200 ${
|
||||||
|
collapsedSections[`${index}-issuer`] ? 'transform rotate-180' : ''
|
||||||
|
}`}
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" />
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
{!collapsedSections[`${index}-issuer`] && (
|
||||||
|
<div className="px-6 pb-6">
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||||
|
{Object.entries(issuerInfo).map(([label, value]) => (
|
||||||
|
<div key={label} className="bg-gray-50 rounded-lg p-4">
|
||||||
|
<span className="text-xs font-medium text-gray-500 uppercase tracking-wide">{label}</span>
|
||||||
|
<p className="mt-1 text-sm font-mono text-gray-900 break-all">{value}</p>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Certificate Validity Section */}
|
||||||
|
{res.certificateValidity && (
|
||||||
|
<div className="p-6 bg-gray-50">
|
||||||
|
<div className="flex items-center space-x-3 mb-4">
|
||||||
|
<span className="text-xl">🕒</span>
|
||||||
|
<h5 className="text-lg font-semibold text-gray-900">Certificate Validity</h5>
|
||||||
|
</div>
|
||||||
|
<div className="bg-white rounded-lg p-4 border">
|
||||||
|
<div className="flex items-center space-x-2">
|
||||||
|
<span className={`text-lg ${isCertificateValid(res.certificateValidity) ? 'text-green-600' : 'text-red-600'}`}>
|
||||||
|
{isCertificateValid(res.certificateValidity) ? '✅' : '❌'}
|
||||||
|
</span>
|
||||||
|
<span className="text-sm font-mono text-gray-900">{res.certificateValidity}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Technical Details Section (if any) */}
|
||||||
|
{(res.calculatedDocumentHash || res.messageDigestInSignature || res.hashComparisonResult || res.authenticatedAttributesSignatureResult || res.errorDetails || res.certificateSubject || res.certificateIssuer) && (
|
||||||
|
<div className="p-6 bg-gray-50 border-t">
|
||||||
|
<details className="group">
|
||||||
|
<summary className="flex items-center justify-between cursor-pointer text-sm font-medium text-gray-700 hover:text-gray-900">
|
||||||
|
<span>🔧 Technical Details</span>
|
||||||
|
<svg className="w-4 h-4 transition-transform group-open:rotate-180" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 9l-7 7-7-7" />
|
||||||
|
</svg>
|
||||||
|
</summary>
|
||||||
|
<div className="mt-4 space-y-3">
|
||||||
|
{/* Raw Certificate Data */}
|
||||||
|
{res.certificateSubject && (
|
||||||
|
<div className="bg-white rounded p-3 border">
|
||||||
|
<span className="text-xs font-medium text-gray-500 uppercase tracking-wide block mb-1">Raw Certificate Subject</span>
|
||||||
|
<code className="text-xs text-gray-800 break-all bg-gray-100 p-2 rounded block">{res.certificateSubject}</code>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{res.certificateIssuer && (
|
||||||
|
<div className="bg-white rounded p-3 border">
|
||||||
|
<span className="text-xs font-medium text-gray-500 uppercase tracking-wide block mb-1">Raw Certificate Issuer</span>
|
||||||
|
<code className="text-xs text-gray-800 break-all bg-gray-100 p-2 rounded block">{res.certificateIssuer}</code>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{res.calculatedDocumentHash && res.calculatedDocumentHash !== t('not-available') && res.calculatedDocumentHash !== t('not-calculated') && (
|
||||||
|
<div className="bg-white rounded p-3 border">
|
||||||
|
<span className="text-xs font-medium text-gray-500 uppercase tracking-wide block mb-1">Calculated Document Hash</span>
|
||||||
|
<code className="text-xs text-gray-800 break-all bg-gray-100 p-2 rounded block">{res.calculatedDocumentHash}</code>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{res.messageDigestInSignature && res.messageDigestInSignature !== t('not-available') && res.messageDigestInSignature !== t('not-found-in-signature') && (
|
||||||
|
<div className="bg-white rounded p-3 border">
|
||||||
|
<span className="text-xs font-medium text-gray-500 uppercase tracking-wide block mb-1">Message Digest in Signature</span>
|
||||||
|
<code className="text-xs text-gray-800 break-all bg-gray-100 p-2 rounded block">{res.messageDigestInSignature}</code>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{res.hashComparisonResult && res.hashComparisonResult !== t('not-performed') && (
|
||||||
|
<div className="bg-white rounded p-3 border">
|
||||||
|
<span className="text-xs font-medium text-gray-500 uppercase tracking-wide block mb-1">Hash Comparison</span>
|
||||||
|
<span className="text-sm text-gray-800">{res.hashComparisonResult}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{res.authenticatedAttributesSignatureResult && res.authenticatedAttributesSignatureResult !== t('not-performed') && (
|
||||||
|
<div className="bg-white rounded p-3 border">
|
||||||
|
<span className="text-xs font-medium text-gray-500 uppercase tracking-wide block mb-1">Attributes Signature Verification</span>
|
||||||
|
<span className="text-sm text-gray-800">{res.authenticatedAttributesSignatureResult}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{res.errorDetails && (
|
||||||
|
<div className="bg-red-50 border border-red-200 rounded p-3">
|
||||||
|
<span className="text-xs font-medium text-red-600 uppercase tracking-wide block mb-1">Error Details</span>
|
||||||
|
<span className="text-sm text-red-800">{res.errorDetails}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{verificationResult === t('verification-in-progress') && (
|
||||||
|
<div className="mt-8 p-4 border border-base-300 rounded-lg bg-base-200 min-h-[100px] flex justify-center items-center">
|
||||||
|
<span className="loading loading-lg loading-dots"></span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{!verificationResult && !selectedFile && (
|
||||||
|
<div className="mt-8 p-4 border border-base-300 rounded-lg bg-base-200 min-h-[100px] flex justify-center items-center"> {/* Added flex for centering */}
|
||||||
|
<p className="text-base-content/60 italic text-center">{t('verification-results-will-appear-here')}</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default VerifyDocument;
|
||||||
@@ -7,6 +7,7 @@ import ModalUi from "./ModalUi";
|
|||||||
import AddSigner from "../components/AddSigner";
|
import AddSigner from "../components/AddSigner";
|
||||||
import {
|
import {
|
||||||
emailRegex,
|
emailRegex,
|
||||||
|
iconColor,
|
||||||
} from "../constant/const";
|
} from "../constant/const";
|
||||||
import Alert from "./Alert";
|
import Alert from "./Alert";
|
||||||
import Tooltip from "./Tooltip";
|
import Tooltip from "./Tooltip";
|
||||||
@@ -679,7 +680,7 @@ const ReportTable = (props) => {
|
|||||||
receiver_phone: userDetails?.Phone || "",
|
receiver_phone: userDetails?.Phone || "",
|
||||||
expiry_date: localExpireDate,
|
expiry_date: localExpireDate,
|
||||||
company_name: doc.ExtUserPtr.Company,
|
company_name: doc.ExtUserPtr.Company,
|
||||||
signing_url: `<a href=${signPdf} target=_blank>Sign here</a>`
|
signing_url: signPdf
|
||||||
};
|
};
|
||||||
const res = replaceMailVaribles(subject, "", variables);
|
const res = replaceMailVaribles(subject, "", variables);
|
||||||
setMail((prev) => ({ ...prev, subject: res.subject }));
|
setMail((prev) => ({ ...prev, subject: res.subject }));
|
||||||
@@ -710,7 +711,7 @@ const ReportTable = (props) => {
|
|||||||
receiver_phone: userDetails?.Phone || "",
|
receiver_phone: userDetails?.Phone || "",
|
||||||
expiry_date: localExpireDate,
|
expiry_date: localExpireDate,
|
||||||
company_name: doc.ExtUserPtr.Company,
|
company_name: doc.ExtUserPtr.Company,
|
||||||
signing_url: `<a href=${signPdf} target=_blank>Sign here</a>`
|
signing_url: signPdf
|
||||||
};
|
};
|
||||||
const res = replaceMailVaribles("", body, variables);
|
const res = replaceMailVaribles("", body, variables);
|
||||||
|
|
||||||
@@ -754,7 +755,7 @@ const ReportTable = (props) => {
|
|||||||
receiver_phone: user?.signerPtr?.Phone || "",
|
receiver_phone: user?.signerPtr?.Phone || "",
|
||||||
expiry_date: localExpireDate,
|
expiry_date: localExpireDate,
|
||||||
company_name: doc?.ExtUserPtr?.Company || "",
|
company_name: doc?.ExtUserPtr?.Company || "",
|
||||||
signing_url: `<a href=${signPdf} target=_blank>Sign here</a>`
|
signing_url: signPdf
|
||||||
};
|
};
|
||||||
const subject =
|
const subject =
|
||||||
doc?.RequestSubject ||
|
doc?.RequestSubject ||
|
||||||
@@ -763,7 +764,7 @@ const ReportTable = (props) => {
|
|||||||
const body =
|
const body =
|
||||||
doc?.RequestBody ||
|
doc?.RequestBody ||
|
||||||
doc?.ExtUserPtr?.TenantId?.RequestBody ||
|
doc?.ExtUserPtr?.TenantId?.RequestBody ||
|
||||||
`<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /></head><body><p>Hi {{receiver_name}},</p><br><p>We hope this email finds you well. {{sender_name}} has requested you to review and sign <b>"{{document_title}}"</b>.</p><p>Your signature is crucial to proceed with the next steps as it signifies your agreement and authorization.</p><br><p>{{signing_url}}</p><br><p>If you have any questions or need further clarification regarding the document or the signing process, please contact the sender.</p><br><p>Thanks</p><p> Team ${appName}</p><br></body> </html>`;
|
`<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /></head><body><p>Hi {{receiver_name}},</p><br><p>We hope this email finds you well. {{sender_name}} has requested you to review and sign <b>"{{document_title}}"</b>.</p><p>Your signature is crucial to proceed with the next steps as it signifies your agreement and authorization.</p><br><p><a href='{{signing_url}}' rel='noopener noreferrer' target='_blank'>Sign here</a></p><br><br><p>If you have any questions or need further clarification regarding the document or the signing process, please contact the sender.</p><br><p>Thanks</p><p> Team ${appName}</p><br></body> </html>`;
|
||||||
const res = replaceMailVaribles(subject, body, variables);
|
const res = replaceMailVaribles(subject, body, variables);
|
||||||
setMail((prev) => ({ ...prev, subject: res.subject, body: res.body }));
|
setMail((prev) => ({ ...prev, subject: res.subject, body: res.body }));
|
||||||
setIsNextStep({ [user.Id]: true });
|
setIsNextStep({ [user.Id]: true });
|
||||||
@@ -907,7 +908,6 @@ const ReportTable = (props) => {
|
|||||||
setActLoader({});
|
setActLoader({});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUpdateExpiry = async (e, item) => {
|
const handleUpdateExpiry = async (e, item) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@@ -1314,7 +1314,6 @@ const ReportTable = (props) => {
|
|||||||
try {
|
try {
|
||||||
const params = { docId: doc?.objectId };
|
const params = { docId: doc?.objectId };
|
||||||
const templateRes = await Parse.Cloud.run("saveastemplate", params);
|
const templateRes = await Parse.Cloud.run("saveastemplate", params);
|
||||||
// console.log("templateRes ", templateRes);
|
|
||||||
setTemplateId(templateRes?.id);
|
setTemplateId(templateRes?.id);
|
||||||
setIsSuccess({ [doc.objectId]: true });
|
setIsSuccess({ [doc.objectId]: true });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -1394,6 +1393,12 @@ const ReportTable = (props) => {
|
|||||||
setActLoader({});
|
setActLoader({});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const restrictBtn = (item, act) => {
|
||||||
|
return item.IsSignyourself && act.action === "recreatedocument"
|
||||||
|
? true
|
||||||
|
: false;
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
{Object.keys(actLoader)?.length > 0 && (
|
{Object.keys(actLoader)?.length > 0 && (
|
||||||
@@ -1449,6 +1454,23 @@ const ReportTable = (props) => {
|
|||||||
className="cursor-pointer fa-light fa-square-plus text-accent text-[30px] md:text-[35px]"
|
className="cursor-pointer fa-light fa-square-plus text-accent text-[30px] md:text-[35px]"
|
||||||
></i>
|
></i>
|
||||||
)}
|
)}
|
||||||
|
{/* Search input */}
|
||||||
|
<div className="hidden md:block p-2">
|
||||||
|
<input
|
||||||
|
type="search"
|
||||||
|
value={props.searchTerm}
|
||||||
|
onChange={props.handleSearchChange}
|
||||||
|
placeholder={t('search.documents')}
|
||||||
|
className="op-input op-input-bordered op-input-sm focus:outline-none hover:border-base-content w-64 text-xs"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
className="md:hidden p-2 flex justify-center items-center focus:outline-none rounded-md hover:bg-gray-200 text-[18px]"
|
||||||
|
aria-label="Search"
|
||||||
|
onClick={() => props.setMobileSearchOpen(!props.mobileSearchOpen)}
|
||||||
|
>
|
||||||
|
<i style={{ color: `${iconColor}` }} className="fa-solid fa-magnifying-glass"></i>
|
||||||
|
</button>
|
||||||
<ModalUi
|
<ModalUi
|
||||||
isOpen={isModal?.export}
|
isOpen={isModal?.export}
|
||||||
title={t("bulk-import")}
|
title={t("bulk-import")}
|
||||||
@@ -1536,6 +1558,17 @@ const ReportTable = (props) => {
|
|||||||
</ModalUi>
|
</ModalUi>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{props.mobileSearchOpen && (
|
||||||
|
<div className="top-full left-0 w-full bg-white px-4 py-2 shadow-md md:hidden">
|
||||||
|
<input
|
||||||
|
type="search"
|
||||||
|
value={props.searchTerm}
|
||||||
|
onChange={props.handleSearchChange}
|
||||||
|
placeholder="Search documents…"
|
||||||
|
className="op-input op-input-bordered op-input-sm focus:outline-none hover:border-base-content w-full text-xs"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<div
|
<div
|
||||||
className={`overflow-auto w-full border-b ${
|
className={`overflow-auto w-full border-b ${
|
||||||
props.List?.length > 0
|
props.List?.length > 0
|
||||||
@@ -1837,33 +1870,39 @@ const ReportTable = (props) => {
|
|||||||
{isOption[item.objectId] &&
|
{isOption[item.objectId] &&
|
||||||
act.action === "option" && (
|
act.action === "option" && (
|
||||||
<ul className="absolute -right-1 top-auto z-[70] w-max op-dropdown-content op-menu shadow-black/20 shadow bg-base-100 text-base-content rounded-box">
|
<ul className="absolute -right-1 top-auto z-[70] w-max op-dropdown-content op-menu shadow-black/20 shadow bg-base-100 text-base-content rounded-box">
|
||||||
{act.subaction?.map((subact) => (
|
{act.subaction?.map(
|
||||||
<li
|
(subact) =>
|
||||||
key={subact.btnId}
|
!restrictBtn(
|
||||||
onClick={() =>
|
item,
|
||||||
handleActionBtn(
|
subact
|
||||||
subact,
|
) && (
|
||||||
item
|
<li
|
||||||
)
|
key={subact.btnId}
|
||||||
}
|
onClick={() =>
|
||||||
title={t(
|
handleActionBtn(
|
||||||
`btnLabel.${subact.hoverLabel}`
|
subact,
|
||||||
)}
|
item
|
||||||
>
|
)
|
||||||
<span>
|
}
|
||||||
<i
|
title={t(
|
||||||
className={`${subact.btnIcon} mr-1.5`}
|
`btnLabel.${subact.hoverLabel}`
|
||||||
></i>
|
)}
|
||||||
{subact.btnLabel && (
|
>
|
||||||
<span className="text-[13px] capitalize font-medium">
|
<span>
|
||||||
{t(
|
<i
|
||||||
`btnLabel.${subact.btnLabel}`
|
className={`${subact.btnIcon} mr-1.5`}
|
||||||
|
></i>
|
||||||
|
{subact.btnLabel && (
|
||||||
|
<span className="text-[13px] capitalize font-medium">
|
||||||
|
{t(
|
||||||
|
`btnLabel.${subact.btnLabel}`
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
)}
|
</li>
|
||||||
</span>
|
)
|
||||||
</li>
|
)}
|
||||||
))}
|
|
||||||
</ul>
|
</ul>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -25,12 +25,10 @@ const LinkUserModal = (props) => {
|
|||||||
handleClose={props.closePopup}
|
handleClose={props.closePopup}
|
||||||
>
|
>
|
||||||
<SelectSigners
|
<SelectSigners
|
||||||
details={props.handleAddUser}
|
{...props}
|
||||||
closePopup={props.closePopup}
|
closePopup={props.closePopup}
|
||||||
signersData={props?.signersData}
|
|
||||||
isContact={isContact}
|
isContact={isContact}
|
||||||
setIsContact={setIsContact}
|
setIsContact={setIsContact}
|
||||||
handleUnlinkSigner={props.handleUnlinkSigner}
|
|
||||||
isExistSigner={isExistSigner}
|
isExistSigner={isExistSigner}
|
||||||
/>
|
/>
|
||||||
{isContact && (
|
{isContact && (
|
||||||
|
|||||||
@@ -8,13 +8,18 @@ const ModalUi = ({
|
|||||||
handleClose,
|
handleClose,
|
||||||
showHeader = true,
|
showHeader = true,
|
||||||
showClose = true,
|
showClose = true,
|
||||||
reduceWidth
|
reduceWidth,
|
||||||
|
position
|
||||||
}) => {
|
}) => {
|
||||||
const width = reduceWidth;
|
const width = reduceWidth;
|
||||||
|
const isBottom = position === "bottom" ? "items-end pb-2" : "";
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isOpen && (
|
{isOpen && (
|
||||||
<dialog id="selectSignerModal" className="op-modal op-modal-open">
|
<dialog
|
||||||
|
id="selectSignerModal"
|
||||||
|
className={`${isBottom} op-modal op-modal-open`}
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
className={`${
|
className={`${
|
||||||
width || "md:min-w-[500px]"
|
width || "md:min-w-[500px]"
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
# Use an official Node runtime as the base image
|
|
||||||
FROM node:20
|
|
||||||
|
|
||||||
# Set the working directory inside the container
|
|
||||||
WORKDIR /usr/src/app
|
|
||||||
|
|
||||||
# Copy package.json and package-lock.json first to leverage Docker cache
|
|
||||||
COPY ./package*.json ./
|
|
||||||
|
|
||||||
# Install application dependencies
|
|
||||||
RUN npm install
|
|
||||||
|
|
||||||
# If you have native dependencies, you'll need extra tools. Uncomment the following line if needed.
|
|
||||||
# RUN apk add --no-cache make gcc g++ python3
|
|
||||||
|
|
||||||
# Copy the current directory contents into the container
|
|
||||||
COPY ./ .
|
|
||||||
|
|
||||||
# Make port 8080 available to the world outside this container
|
|
||||||
EXPOSE 8080
|
|
||||||
|
|
||||||
# Define environment variables if needed
|
|
||||||
# ENV NODE_ENV production
|
|
||||||
# ENV DATABASE_URL mongodb://db:27017
|
|
||||||
|
|
||||||
# Run the application
|
|
||||||
ENTRYPOINT npm start
|
|
||||||
@@ -252,7 +252,7 @@ export const mailTemplate = param => {
|
|||||||
"</td></tr><tr><td style='font-weight:bold;font-family:sans-serif;font-size:15px'>Note</td><td></td><td style='color:#626363;font-weight:bold'>" +
|
"</td></tr><tr><td style='font-weight:bold;font-family:sans-serif;font-size:15px'>Note</td><td></td><td style='color:#626363;font-weight:bold'>" +
|
||||||
param.note +
|
param.note +
|
||||||
"</td></tr><tr><td></td><td></td></tr></table></div> <div style='margin-left:70px'><a target=_blank href=" +
|
"</td></tr><tr><td></td><td></td></tr></table></div> <div style='margin-left:70px'><a target=_blank href=" +
|
||||||
param.sigingUrl +
|
param.signingUrl +
|
||||||
"><button style='padding:12px;background-color:#d46b0f;color:white;border:0px;font-weight:bold;margin-top:30px'>Sign here</button></a></div><div style='display:flex;justify-content:center;margin-top:10px'></div></div></div><div><p> This is an automated email from " +
|
"><button style='padding:12px;background-color:#d46b0f;color:white;border:0px;font-weight:bold;margin-top:30px'>Sign here</button></a></div><div style='display:flex;justify-content:center;margin-top:10px'></div></div></div><div><p> This is an automated email from " +
|
||||||
AppName +
|
AppName +
|
||||||
'. For any queries regarding this email, please contact the sender ' +
|
'. For any queries regarding this email, please contact the sender ' +
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ export default async function Newsletter(request) {
|
|||||||
const email = request.params?.email?.toLowerCase()?.replace(/\s/g, '');
|
const email = request.params?.email?.toLowerCase()?.replace(/\s/g, '');
|
||||||
const domain = request.params.domain;
|
const domain = request.params.domain;
|
||||||
try {
|
try {
|
||||||
const envAppId = process.env.REACT_APP_APPID || 'opensign';
|
const envAppId = 'opensign';
|
||||||
const headers = { 'Content-Type': 'application/json', 'X-Parse-Application-Id': envAppId };
|
const headers = { 'Content-Type': 'application/json', 'X-Parse-Application-Id': envAppId };
|
||||||
const envProdServer = process.env.REACT_APP_SERVERURL || 'https://app.opensignlabs.com/api/app';
|
const envProdServer = 'https://app.opensignlabs.com/api/app';
|
||||||
const newsletter = await axios.post(
|
const newsletter = await axios.post(
|
||||||
`${envProdServer}/classes/Newsletter`,
|
`${envProdServer}/classes/Newsletter`,
|
||||||
{ Name: name, Email: email, Domain: domain },
|
{ Name: name, Email: email, Domain: domain },
|
||||||
|
|||||||
@@ -14,9 +14,7 @@ async function deductcount(docsCount, extUserId) {
|
|||||||
}
|
}
|
||||||
async function sendMail(document, publicUrl) {
|
async function sendMail(document, publicUrl) {
|
||||||
//sessionToken
|
//sessionToken
|
||||||
const baseUrl = new URL(publicUrl); //process.env.PUBLIC_URL
|
const baseUrl = new URL(publicUrl);
|
||||||
|
|
||||||
// console.log("pdfDetails", pdfDetails);
|
|
||||||
const timeToCompleteDays = document?.TimeToCompleteDays || 15;
|
const timeToCompleteDays = document?.TimeToCompleteDays || 15;
|
||||||
const ExpireDate = new Date(document.createdAt);
|
const ExpireDate = new Date(document.createdAt);
|
||||||
ExpireDate.setDate(ExpireDate.getDate() + timeToCompleteDays);
|
ExpireDate.setDate(ExpireDate.getDate() + timeToCompleteDays);
|
||||||
@@ -71,7 +69,7 @@ async function sendMail(document, publicUrl) {
|
|||||||
receiver_phone: existSigner?.Phone || '',
|
receiver_phone: existSigner?.Phone || '',
|
||||||
expiry_date: localExpireDate,
|
expiry_date: localExpireDate,
|
||||||
company_name: orgName,
|
company_name: orgName,
|
||||||
signing_url: `<a href=${signPdf} target=_blank>Sign here</a>`,
|
signing_url: signPdf,
|
||||||
};
|
};
|
||||||
replaceVar = replaceMailVaribles(mailSubject, htmlReqBody, variables);
|
replaceVar = replaceMailVaribles(mailSubject, htmlReqBody, variables);
|
||||||
}
|
}
|
||||||
@@ -82,7 +80,7 @@ async function sendMail(document, publicUrl) {
|
|||||||
title: document.Name,
|
title: document.Name,
|
||||||
organization: orgName,
|
organization: orgName,
|
||||||
localExpireDate: localExpireDate,
|
localExpireDate: localExpireDate,
|
||||||
sigingUrl: signPdf,
|
signingUrl: signPdf,
|
||||||
};
|
};
|
||||||
let params = {
|
let params = {
|
||||||
extUserId: document.ExtUserPtr.objectId,
|
extUserId: document.ExtUserPtr.objectId,
|
||||||
@@ -168,9 +166,9 @@ async function batchQuery(userId, Documents, Ip, parseConfig, type, publicUrl) {
|
|||||||
})),
|
})),
|
||||||
ACL: Acl,
|
ACL: Acl,
|
||||||
SentToOthers: true,
|
SentToOthers: true,
|
||||||
RemindOnceInEvery: x.RemindOnceInEvery || 5,
|
RemindOnceInEvery: x.RemindOnceInEvery ? parseInt(x.RemindOnceInEvery) : 5,
|
||||||
AutomaticReminders: x.AutomaticReminders || false,
|
AutomaticReminders: x.AutomaticReminders || false,
|
||||||
TimeToCompleteDays: x.TimeToCompleteDays || 15,
|
TimeToCompleteDays: x.TimeToCompleteDays ? parseInt(x.TimeToCompleteDays) : 15,
|
||||||
OriginIp: Ip,
|
OriginIp: Ip,
|
||||||
DocSentAt: { __type: 'Date', iso: isoDate },
|
DocSentAt: { __type: 'Date', iso: isoDate },
|
||||||
IsEnableOTP: x?.IsEnableOTP || false,
|
IsEnableOTP: x?.IsEnableOTP || false,
|
||||||
@@ -231,6 +229,7 @@ export default async function createBatchDocs(request) {
|
|||||||
const sessionToken = request.headers?.sessiontoken;
|
const sessionToken = request.headers?.sessiontoken;
|
||||||
const type = request.headers?.type || 'quicksend';
|
const type = request.headers?.type || 'quicksend';
|
||||||
const Documents = JSON.parse(strDocuments);
|
const Documents = JSON.parse(strDocuments);
|
||||||
|
|
||||||
const Ip = request?.headers?.['x-real-ip'] || '';
|
const Ip = request?.headers?.['x-real-ip'] || '';
|
||||||
// Access the host from the headers
|
// Access the host from the headers
|
||||||
const publicUrl = request.headers.public_url;
|
const publicUrl = request.headers.public_url;
|
||||||
|
|||||||
@@ -2,19 +2,26 @@ import { cloudServerUrl } from '../../Utils.js';
|
|||||||
import reportJson from './reportsJson.js';
|
import reportJson from './reportsJson.js';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
|
// Escape regex special characters. Copied from filterDocs.js
|
||||||
|
function escapeRegExp(str) {
|
||||||
|
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||||
|
}
|
||||||
|
|
||||||
export default async function getReport(request) {
|
export default async function getReport(request) {
|
||||||
const reportId = request.params.reportId;
|
const reportId = request.params.reportId;
|
||||||
const limit = request.params.limit;
|
const limit = request.params.limit;
|
||||||
const skip = request.params.skip;
|
const skip = request.params.skip;
|
||||||
|
const searchTerm = request.params.searchTerm || '';
|
||||||
|
|
||||||
const serverUrl = cloudServerUrl; //process.env.SERVER_URL;
|
const serverUrl = cloudServerUrl; //process.env.SERVER_URL;
|
||||||
const appId = process.env.APP_ID;
|
const appId = process.env.APP_ID;
|
||||||
const masterKey = process.env.MASTER_KEY;
|
const masterKey = process.env.MASTER_KEY;
|
||||||
|
const sessionToken = request.headers['sessiontoken'] || request.headers['x-parse-session-token'];
|
||||||
try {
|
try {
|
||||||
const userRes = await axios.get(serverUrl + '/users/me', {
|
const userRes = await axios.get(serverUrl + '/users/me', {
|
||||||
headers: {
|
headers: {
|
||||||
'X-Parse-Application-Id': appId,
|
'X-Parse-Application-Id': appId,
|
||||||
'X-Parse-Session-Token': request.headers['sessiontoken'],
|
'X-Parse-Session-Token': sessionToken,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const userId = userRes.data && userRes.data.objectId;
|
const userId = userRes.data && userRes.data.objectId;
|
||||||
@@ -25,7 +32,7 @@ export default async function getReport(request) {
|
|||||||
const { params, keys } = json;
|
const { params, keys } = json;
|
||||||
const orderBy = '-updatedAt';
|
const orderBy = '-updatedAt';
|
||||||
const strKeys = keys.join();
|
const strKeys = keys.join();
|
||||||
let strParams = JSON.stringify(params);
|
let paramsObj = { ...params };
|
||||||
if (reportId == '6TeaPr321t') {
|
if (reportId == '6TeaPr321t') {
|
||||||
const extUserQuery = new Parse.Query('contracts_Users');
|
const extUserQuery = new Parse.Query('contracts_Users');
|
||||||
extUserQuery.equalTo('Email', userRes.data.email);
|
extUserQuery.equalTo('Email', userRes.data.email);
|
||||||
@@ -36,8 +43,8 @@ export default async function getReport(request) {
|
|||||||
if (_extUser?.TeamIds && _extUser.TeamIds?.length > 0) {
|
if (_extUser?.TeamIds && _extUser.TeamIds?.length > 0) {
|
||||||
let teamArr = [];
|
let teamArr = [];
|
||||||
_extUser?.TeamIds?.forEach(x => (teamArr = [...teamArr, ...x.Ancestors]));
|
_extUser?.TeamIds?.forEach(x => (teamArr = [...teamArr, ...x.Ancestors]));
|
||||||
strParams = JSON.stringify({
|
paramsObj = {
|
||||||
...params,
|
...paramsObj,
|
||||||
$or: [
|
$or: [
|
||||||
{ SharedWith: { $in: teamArr } },
|
{ SharedWith: { $in: teamArr } },
|
||||||
{
|
{
|
||||||
@@ -55,15 +62,23 @@ export default async function getReport(request) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
};
|
||||||
} else {
|
} else {
|
||||||
strParams = JSON.stringify({
|
paramsObj = {
|
||||||
...params,
|
...paramsObj,
|
||||||
CreatedBy: { __type: 'Pointer', className: '_User', objectId: userId },
|
CreatedBy: { __type: 'Pointer', className: '_User', objectId: userId },
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (searchTerm) {
|
||||||
|
const escaped = escapeRegExp(searchTerm);
|
||||||
|
paramsObj = {
|
||||||
|
...paramsObj,
|
||||||
|
Name: { $regex: `.*${escaped}.*`, $options: 'i' },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const strParams = JSON.stringify(paramsObj);
|
||||||
const headers = {
|
const headers = {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'X-Parse-Application-Id': appId,
|
'X-Parse-Application-Id': appId,
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ async function sendNotifyMail(doc, signUser, mailProvider, publicUrl) {
|
|||||||
const creatorEmail = doc.ExtUserPtr.Email;
|
const creatorEmail = doc.ExtUserPtr.Email;
|
||||||
const signerName = signUser.Name;
|
const signerName = signUser.Name;
|
||||||
const signerEmail = signUser.Email;
|
const signerEmail = signUser.Email;
|
||||||
const viewDocUrl = `${publicUrl}/recipientSignPdf/${doc.objectId}`; // ` ${process.env.PUBLIC_URL}/recipientSignPdf/${doc.objectId}`;
|
const viewDocUrl = `${publicUrl}/recipientSignPdf/${doc.objectId}`;
|
||||||
const subject = `Document "${pdfName}" has been signed by ${signerName}`;
|
const subject = `Document "${pdfName}" has been signed by ${signerName}`;
|
||||||
const body =
|
const body =
|
||||||
"<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/></head><body><div style='background-color:#f5f5f5;padding:20px'><div style='background-color:white'>" +
|
"<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/></head><body><div style='background-color:#f5f5f5;padding:20px'><div style='background-color:white'>" +
|
||||||
|
|||||||
@@ -14,11 +14,14 @@ export default async function recreateDocument(request) {
|
|||||||
if (!doc) {
|
if (!doc) {
|
||||||
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Document not found');
|
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Document not found');
|
||||||
}
|
}
|
||||||
|
if (doc?.get('IsSignyourself')) {
|
||||||
|
throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'Signyourself Document not allowed');
|
||||||
|
}
|
||||||
const _docRes = doc?.toJSON();
|
const _docRes = doc?.toJSON();
|
||||||
const { objectId, SignedUrl, AuditTrail, ACL, DeclineBy, DeclineReason, ...docRes } = _docRes;
|
const { objectId, SignedUrl, AuditTrail, ACL, DeclineBy, DeclineReason, ...docRes } = _docRes;
|
||||||
const createDoc = new Parse.Object('contracts_Document');
|
const createDoc = new Parse.Object('contracts_Document');
|
||||||
Object.entries(docRes).forEach(([key, value]) => {
|
Object.entries(docRes).forEach(([key, value]) => {
|
||||||
if (key === 'IsDeclined') {
|
if (key === 'IsDeclined' || key === 'IsCompleted') {
|
||||||
createDoc.set(key, false);
|
createDoc.set(key, false);
|
||||||
} else {
|
} else {
|
||||||
createDoc.set(key, value);
|
createDoc.set(key, value);
|
||||||
|
|||||||
@@ -123,6 +123,8 @@ export default function reportJson(id, userId) {
|
|||||||
'TimeToCompleteDays',
|
'TimeToCompleteDays',
|
||||||
'IsSignyourself',
|
'IsSignyourself',
|
||||||
'IsCompleted',
|
'IsCompleted',
|
||||||
|
'ExpiryDate',
|
||||||
|
'IsSignyourself',
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
// declined documents report
|
// declined documents report
|
||||||
|
|||||||
@@ -53,10 +53,16 @@ const makeEmail = async (
|
|||||||
const isSecure =
|
const isSecure =
|
||||||
new URL(url)?.protocol === 'https:' && new URL(url)?.hostname !== 'localhost';
|
new URL(url)?.protocol === 'https:' && new URL(url)?.hostname !== 'localhost';
|
||||||
if (isSecure) {
|
if (isSecure) {
|
||||||
https.get(url, async function (response) {
|
https
|
||||||
response.pipe(Pdf);
|
.get(url, async function (response) {
|
||||||
response.on('end', () => resolve('success'));
|
response.pipe(Pdf);
|
||||||
});
|
Pdf.on('finish', () => resolve('success'));
|
||||||
|
Pdf.on('error', () => resolve('error'));
|
||||||
|
})
|
||||||
|
.on('error', e => {
|
||||||
|
console.error(`error: ${e.message}`);
|
||||||
|
resolve('error');
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
const httpsAgent = new https.Agent({ rejectUnauthorized: false }); // Disable SSL validation
|
const httpsAgent = new https.Agent({ rejectUnauthorized: false }); // Disable SSL validation
|
||||||
axios
|
axios
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ app.use(express.urlencoded({ limit: '50mb', extended: true }));
|
|||||||
app.use(function (req, res, next) {
|
app.use(function (req, res, next) {
|
||||||
req.headers['x-real-ip'] = getUserIP(req);
|
req.headers['x-real-ip'] = getUserIP(req);
|
||||||
const publicUrl = 'https://' + req?.get('host');
|
const publicUrl = 'https://' + req?.get('host');
|
||||||
req.headers['public_url'] = publicUrl; // process.env.PUBLIC_URL
|
req.headers['public_url'] = publicUrl;
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
function getUserIP(request) {
|
function getUserIP(request) {
|
||||||
|
|||||||
Generated
+2783
-3834
File diff suppressed because it is too large
Load Diff
@@ -18,10 +18,10 @@
|
|||||||
"watch": "nodemon index.js"
|
"watch": "nodemon index.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "^3.812.0",
|
"@aws-sdk/client-s3": "^3.824.0",
|
||||||
"@aws-sdk/s3-request-presigner": "^3.812.0",
|
"@aws-sdk/s3-request-presigner": "^3.824.0",
|
||||||
"@parse/fs-files-adapter": "^3.0.0",
|
"@parse/fs-files-adapter": "^3.0.0",
|
||||||
"@parse/s3-files-adapter": "^4.1.0",
|
"@parse/s3-files-adapter": "^4.1.1",
|
||||||
"@pdf-lib/fontkit": "^1.1.1",
|
"@pdf-lib/fontkit": "^1.1.1",
|
||||||
"@signpdf/placeholder-pdf-lib": "^3.2.6",
|
"@signpdf/placeholder-pdf-lib": "^3.2.6",
|
||||||
"@signpdf/signer-p12": "^3.2.4",
|
"@signpdf/signer-p12": "^3.2.4",
|
||||||
@@ -34,19 +34,19 @@
|
|||||||
"express": "^5.1.0",
|
"express": "^5.1.0",
|
||||||
"form-data": "^4.0.2",
|
"form-data": "^4.0.2",
|
||||||
"generate-api-key": "^1.0.2",
|
"generate-api-key": "^1.0.2",
|
||||||
"googleapis": "^148.0.0",
|
"googleapis": "^149.0.0",
|
||||||
"mailgun.js": "^12.0.1",
|
"mailgun.js": "^12.0.2",
|
||||||
"mongodb": "^6.16.0",
|
"mongodb": "^6.17.0",
|
||||||
"multer": "^2.0.0",
|
"multer": "^2.0.1",
|
||||||
"multer-s3": "^3.0.1",
|
"multer-s3": "^3.0.1",
|
||||||
"node-forge": "^1.3.1",
|
"node-forge": "^1.3.1",
|
||||||
"nodemailer": "^7.0.3",
|
"nodemailer": "^7.0.3",
|
||||||
"parse": "^6.1.1",
|
"parse": "^6.1.1",
|
||||||
"parse-dbtool": "^1.2.0",
|
"parse-dbtool": "^1.2.0",
|
||||||
"parse-server": "^8.2.0",
|
"parse-server": "^8.2.1",
|
||||||
"parse-server-api-mail-adapter": "^4.1.0",
|
"parse-server-api-mail-adapter": "^4.1.0",
|
||||||
"pdf-lib": "^1.17.1",
|
"pdf-lib": "^1.17.1",
|
||||||
"posthog-node": "^4.17.1",
|
"posthog-node": "^4.18.0",
|
||||||
"qrcode": "^1.5.4",
|
"qrcode": "^1.5.4",
|
||||||
"rate-limiter-flexible": "^7.1.1",
|
"rate-limiter-flexible": "^7.1.1",
|
||||||
"speakeasy": "^2.0.0",
|
"speakeasy": "^2.0.0",
|
||||||
@@ -54,8 +54,8 @@
|
|||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/eslint-parser": "^7.27.1",
|
"@babel/eslint-parser": "^7.27.5",
|
||||||
"eslint": "^9.27.0",
|
"eslint": "^9.28.0",
|
||||||
"jasmine": "^5.7.1",
|
"jasmine": "^5.7.1",
|
||||||
"mongodb-runner": "^5.8.3",
|
"mongodb-runner": "^5.8.3",
|
||||||
"nodemon": "^3.1.10",
|
"nodemon": "^3.1.10",
|
||||||
|
|||||||
Reference in New Issue
Block a user