Skip to content

🔥 The free & Open Source DocuSign alternative

feat: implement disable documentId stamp setting for Admin users

RaktimaNXGce86510d8ede
diff --git a/apps/OpenSign/src/routes/UserProfile.js b/apps/OpenSign/src/routes/UserProfile.js
index 5a2120375..756e128a2 100644
--- a/apps/OpenSign/src/routes/UserProfile.js
+++ b/apps/OpenSign/src/routes/UserProfile.js
@@ -1,4 +1,4 @@
-import React, { useState } from "react";
+import React, { useState, useEffect } from "react";
import { Navigate, useNavigate } from "react-router-dom";
import Parse from "parse";
import { SaveFileSize } from "../constant/saveFileSize";
@@ -6,6 +6,7 @@ import dp from "../assets/images/dp.png";
import Title from "../components/Title";
import sanitizeFileName from "../primitives/sanitizeFileName";
import axios from "axios";
+
function UserProfile() {
const navigate = useNavigate();
let UserProfile = JSON.parse(localStorage.getItem("UserInformation"));
@@ -17,9 +18,19 @@ function UserProfile() {
const [Image, setImage] = useState(localStorage.getItem("profileImg"));
const [isLoader, setIsLoader] = useState(false);
const [percentage, setpercentage] = useState(0);
+ const [isDisableDocId, setIsDisableDocId] = useState(false);
Parse.serverURL = parseBaseUrl;
Parse.initialize(parseAppId);
+
+ useEffect(() => {
+ const extClass = localStorage.getItem("Extand_Class");
+ const jsonSender = JSON.parse(extClass);
+ const HeaderDocId = jsonSender[0]?.HeaderDocId;
+ if (HeaderDocId) {
+ setIsDisableDocId(HeaderDocId);
+ }
+ }, []);
const handleSubmit = async (e) => {
e.preventDefault();
setIsLoader(true);
@@ -33,6 +44,7 @@ function UserProfile() {
object.set("name", name);
object.set("ProfilePic", Image);
object.set("phone", phn);
+
object.save().then(
async (response) => {
if (response) {
@@ -66,8 +78,12 @@ function UserProfile() {
const extClass = localStorage.getItem("extended_class");
const extData = JSON.parse(localStorage.getItem("Extand_Class"));
const ExtUserId = extData[0].objectId;
- // console.log("UserId ", ExtUserId);
- const body = { Phone: obj.Phone, Name: obj.Name };
+
+ const body = {
+ Phone: obj.Phone,
+ Name: obj.Name,
+ HeaderDocId: isDisableDocId
+ };
await axios.put(
parseBaseUrl + "classes/" + extClass + "/" + ExtUserId,
body,
@@ -137,6 +153,10 @@ function UserProfile() {
return <Navigate to={_redirect} />;
}
+ const handleDisableDocId = () => {
+ setIsDisableDocId((prevChecked) => !prevChecked);
+ };
+
return (
<React.Fragment>
<Title title={"Profile"} />
@@ -241,6 +261,22 @@ function UserProfile() {
: "Not verified"}
</span>
</li>
+ <li className="flex justify-between items-center border-y-[1px] border-gray-300 py-2 break-all">
+ <span className="font-semibold">Disable DocumentId :</span>{" "}
+ <span>
+ <label className="relative inline-flex items-center cursor-pointer mb-0">
+ <input
+ disabled={editmode ? false : true}
+ checked={isDisableDocId}
+ onChange={handleDisableDocId}
+ type="checkbox"
+ value=""
+ className="sr-only peer"
+ />
+ <div className="w-9 h-5 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600"></div>
+ </label>
+ </span>
+ </li>
</ul>
<div className="flex justify-center pt-2 pb-3 md:pt-3 md:pb-4">
{editmode ? (
diff --git a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js
index 14bcae234..9294e2761 100644
--- a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js
+++ b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js
@@ -362,9 +362,13 @@ function PdfRequestFiles() {
});
const flag = false;
+ const extUserPtr = pdfDetails[0].ExtUserPtr;
+ const HeaderDocId = extUserPtr?.HeaderDocId;
//embed document's object id to all pages in pdf document
- if (!isDocId) {
- await embedDocId(pdfDoc, documentId, allPages);
+ if (!HeaderDocId) {
+ if (!isDocId) {
+ await embedDocId(pdfDoc, documentId, allPages);
+ }
}
//embed multi signature in pdf
const pdfBytes = await multiSignEmbed(
@@ -631,7 +635,7 @@ function PdfRequestFiles() {
justifyContent: "center",
flexDirection: "column",
alignItems: "center",
- zIndex: "20",
+ zIndex: "999",
backgroundColor: "#e6f2f2",
opacity: 0.8
}}
diff --git a/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js b/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js
index 6a9cc86dc..f7950d488 100644
--- a/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js
+++ b/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js
@@ -518,8 +518,13 @@ function SignYourSelf() {
const flag = true;
- await embedDocId(pdfDoc, documentId, allPages);
+ const extUserPtr = pdfDetails[0].ExtUserPtr;
+ const HeaderDocId = extUserPtr?.HeaderDocId;
+ //embed document's object id to all pages in pdf document
+ if (!HeaderDocId) {
+ await embedDocId(pdfDoc, documentId, allPages);
+ }
//embed multi signature in pdf
const pdfBytes = await multiSignEmbed(
xyPostion,
diff --git a/microfrontends/SignDocuments/src/Component/TemplatePlaceholder.js b/microfrontends/SignDocuments/src/Component/TemplatePlaceholder.js
index bb39ba73c..d43454c70 100644
--- a/microfrontends/SignDocuments/src/Component/TemplatePlaceholder.js
+++ b/microfrontends/SignDocuments/src/Component/TemplatePlaceholder.js
@@ -1326,11 +1326,12 @@ const TemplatePlaceholder = () => {
/>
<DropdownWidgetOption
type="radio"
- title="RadioGroup"
+ title="Radio group"
showDropdown={isRadio}
setShowDropdown={setIsRadio}
handleSaveWidgetsOptions={handleSaveWidgetsOptions}
currWidgetsDetails={currWidgetsDetails}
+ setCurrWidgetsDetails={setCurrWidgetsDetails}
/>
<DropdownWidgetOption
type="dropdown"
@@ -1339,6 +1340,7 @@ const TemplatePlaceholder = () => {
setShowDropdown={setShowDropdown}
handleSaveWidgetsOptions={handleSaveWidgetsOptions}
currWidgetsDetails={currWidgetsDetails}
+ setCurrWidgetsDetails={setCurrWidgetsDetails}
/>
<PlaceholderCopy
isPageCopy={isPageCopy}
diff --git a/microfrontends/SignDocuments/src/Component/placeHolderSign.js b/microfrontends/SignDocuments/src/Component/placeHolderSign.js
index bbe120acc..0cefd6172 100644
--- a/microfrontends/SignDocuments/src/Component/placeHolderSign.js
+++ b/microfrontends/SignDocuments/src/Component/placeHolderSign.js
@@ -1486,7 +1486,7 @@ function PlaceHolderSign() {
/>
<DropdownWidgetOption
type="radio"
- title="RadioGroup"
+ title="Radio group"
showDropdown={isRadio}
setShowDropdown={setIsRadio}
handleSaveWidgetsOptions={handleSaveWidgetsOptions}