mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-29 19:29:44 +02:00
fix: exiting user can't receive bulk emails, input widgets's size reduced in request-sign process
This commit is contained in:
@@ -113,9 +113,15 @@ const BulkSendUi = (props) => {
|
||||
let Placeholders = [...props.item.Placeholders];
|
||||
// Initialize an empty array to store updated documents
|
||||
let Documents = [];
|
||||
|
||||
// Loop through each form
|
||||
forms.forEach((form) => {
|
||||
//checking if user enter email which already exist as a signer then add user in a signers array
|
||||
let existSigner = [];
|
||||
form.fields.map((data) => {
|
||||
if (data.signer) {
|
||||
existSigner.push(data.signer);
|
||||
}
|
||||
});
|
||||
// Map through the copied Placeholders array to update email values
|
||||
const updatedPlaceholders = Placeholders.map((placeholder) => {
|
||||
// Find the field in the current form that matches the placeholder Id
|
||||
@@ -123,23 +129,44 @@ const BulkSendUi = (props) => {
|
||||
(element) => parseInt(element.fieldId) === placeholder.Id
|
||||
);
|
||||
// If a matching field is found, update the email value in the placeholder
|
||||
const signer = field?.signer?.objectId ? field.signer : {};
|
||||
const signer = field?.signer?.objectId ? field.signer : "";
|
||||
if (field) {
|
||||
return {
|
||||
...placeholder,
|
||||
email: field.email,
|
||||
signerObjId: field?.signer?.objectId || "",
|
||||
signerPtr: signer
|
||||
};
|
||||
if (signer) {
|
||||
return {
|
||||
...placeholder,
|
||||
signerObjId: field?.signer?.objectId || "",
|
||||
signerPtr: signer
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
...placeholder,
|
||||
email: field.email,
|
||||
signerObjId: field?.signer?.objectId || "",
|
||||
signerPtr: signer
|
||||
};
|
||||
}
|
||||
}
|
||||
// If no matching field is found, keep the placeholder as is
|
||||
return placeholder;
|
||||
});
|
||||
|
||||
// Push a new document object with updated Placeholders into the Documents array
|
||||
Documents.push({ ...props.item, Placeholders: updatedPlaceholders });
|
||||
if (existSigner?.length > 0) {
|
||||
Documents.push({
|
||||
...props.item,
|
||||
Placeholders: updatedPlaceholders,
|
||||
Signers: props.item.Signers
|
||||
? [...props.item.Signers, ...existSigner]
|
||||
: [...existSigner]
|
||||
});
|
||||
} else {
|
||||
Documents.push({
|
||||
...props.item,
|
||||
Placeholders: updatedPlaceholders
|
||||
});
|
||||
}
|
||||
});
|
||||
// console.log("Documents ", Documents);
|
||||
//console.log("Documents ", Documents);
|
||||
await batchQuery(Documents);
|
||||
};
|
||||
|
||||
|
||||
@@ -424,7 +424,7 @@ function PlaceholderType(props) {
|
||||
<div
|
||||
style={{
|
||||
color: "black",
|
||||
fontSize: calculateFontSize()
|
||||
fontSize: "12px"
|
||||
}}
|
||||
>
|
||||
<span>{type}</span>
|
||||
@@ -523,7 +523,7 @@ function PlaceholderType(props) {
|
||||
<div
|
||||
style={{
|
||||
color: "black",
|
||||
fontSize: calculateFontSize()
|
||||
fontSize: "12px"
|
||||
}}
|
||||
>
|
||||
<span>{type}</span>
|
||||
@@ -563,7 +563,7 @@ function PlaceholderType(props) {
|
||||
<div
|
||||
style={{
|
||||
color: "black",
|
||||
fontSize: calculateFontSize()
|
||||
fontSize: "12px"
|
||||
}}
|
||||
>
|
||||
<span>{type}</span>
|
||||
@@ -603,7 +603,7 @@ function PlaceholderType(props) {
|
||||
<div
|
||||
style={{
|
||||
color: "black",
|
||||
fontSize: calculateFontSize()
|
||||
fontSize: "12px"
|
||||
}}
|
||||
>
|
||||
<span>{type}</span>
|
||||
@@ -721,7 +721,7 @@ function PlaceholderType(props) {
|
||||
<div
|
||||
style={{
|
||||
color: "black",
|
||||
fontSize: calculateFontSize()
|
||||
fontSize: "12px"
|
||||
}}
|
||||
>
|
||||
<span>{type}</span>
|
||||
|
||||
@@ -355,7 +355,10 @@ function WidgetComponent({
|
||||
<span>Fields</span>
|
||||
</div>
|
||||
|
||||
<div className="p-[15px] flex flex-col pt-4 2xl:m-5">
|
||||
<div
|
||||
className="p-[15px] flex flex-col pt-4 2xl:m-5"
|
||||
data-tut="addWidgets"
|
||||
>
|
||||
<WidgetList
|
||||
updateWidgets={updateWidgets}
|
||||
handleDivClick={handleDivClick}
|
||||
|
||||
@@ -942,7 +942,23 @@ export const onChangeHeightOfTextArea = (
|
||||
setXyPostion(updatePlaceholder);
|
||||
}
|
||||
};
|
||||
//calculate width and height
|
||||
export const calculateInitialWidthHeight = (widgetData) => {
|
||||
const intialText = widgetData;
|
||||
const span = document.createElement("span");
|
||||
span.textContent = intialText;
|
||||
span.style.font = `14px`; // here put your text size and font family
|
||||
span.style.display = "hidden";
|
||||
document.body.appendChild(span);
|
||||
const width = span.offsetWidth;
|
||||
const height = span.offsetHeight;
|
||||
|
||||
document.body.removeChild(span);
|
||||
return {
|
||||
getWidth: width,
|
||||
getHeight: height
|
||||
};
|
||||
};
|
||||
export const addInitialData = (signerPos, setXyPostion, value, userId) => {
|
||||
function widgetDataValue(type) {
|
||||
switch (type) {
|
||||
@@ -991,9 +1007,13 @@ export const addInitialData = (signerPos, setXyPostion, value, userId) => {
|
||||
options: {
|
||||
...item.options,
|
||||
defaultValue: widgetData
|
||||
},
|
||||
Width: calculateInitialWidthHeight(item.type, widgetData).getWidth,
|
||||
Height: calculateInitialWidthHeight(item.type, widgetData).getHeight
|
||||
}
|
||||
// Width:
|
||||
// calculateInitialWidthHeight(item.type, widgetData).getWidth ||
|
||||
// item?.Width,
|
||||
// Height:
|
||||
// calculateInitialWidthHeight(item.type, widgetData).getHeight ||
|
||||
// item?.Height
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
@@ -1004,24 +1024,6 @@ export const addInitialData = (signerPos, setXyPostion, value, userId) => {
|
||||
});
|
||||
};
|
||||
|
||||
//calculate width and height
|
||||
export const calculateInitialWidthHeight = (widgetData) => {
|
||||
const intialText = widgetData;
|
||||
const span = document.createElement("span");
|
||||
span.textContent = intialText;
|
||||
span.style.font = `14px`; // here put your text size and font family
|
||||
span.style.display = "hidden";
|
||||
document.body.appendChild(span);
|
||||
const width = span.offsetWidth;
|
||||
const height = span.offsetHeight;
|
||||
|
||||
document.body.removeChild(span);
|
||||
return {
|
||||
getWidth: width,
|
||||
getHeight: height
|
||||
};
|
||||
};
|
||||
|
||||
//function for embed document id
|
||||
export const embedDocId = async (pdfDoc, documentId, allPages) => {
|
||||
for (let i = 0; i < allPages; i++) {
|
||||
|
||||
@@ -1750,7 +1750,10 @@ function PdfRequestFiles() {
|
||||
<div className={`max-h-screen`}>
|
||||
{signedSigners.length > 0 && (
|
||||
<>
|
||||
<div className="mx-2 pr-2 pt-2 pb-1 text-[15px] text-base-content font-semibold border-b-[1px] border-base-300">
|
||||
<div
|
||||
data-tut="reactourSecond"
|
||||
className="mx-2 pr-2 pt-2 pb-1 text-[15px] text-base-content font-semibold border-b-[1px] border-base-300"
|
||||
>
|
||||
<span> Signed by</span>
|
||||
</div>
|
||||
<div className="mt-[2px]">
|
||||
|
||||
Reference in New Issue
Block a user