Merge pull request #880 from OpenSignLabs/raktima-opensignlabs-patch-10

fix: exiting user can't receive bulk emails, input widgets's size reduced in request-sign process
This commit is contained in:
Amol
2024-06-25 20:15:46 +05:30
committed by GitHub
7 changed files with 79 additions and 42 deletions
+37 -10
View File
@@ -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>
@@ -454,7 +454,7 @@ function PlaceholderType(props) {
{props?.pos?.options?.name}
</option>
{props.pos?.options?.values.map((data, ind) => {
{props.pos?.options?.values?.map((data, ind) => {
return (
<option key={ind} value={data}>
{data}
@@ -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}
+23 -21
View File
@@ -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++) {
+4 -1
View File
@@ -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]">
+3 -1
View File
@@ -1292,7 +1292,7 @@ function PlaceHolderSign() {
selector: '[data-tut="addRecipient"]',
content: () => (
<TourContentWithBtn
message={`Clicking "Add recipients" button will allow you to add more signer.`}
message={`Clicking "Add recipients" button will allow you to add more signers.`}
isChecked={handleDontShow}
/>
),
@@ -1928,6 +1928,7 @@ function PlaceHolderSign() {
handleClose={() => {
setIsSend(false);
setSignerPos([]);
navigate("/report/1MwEuxLEkF");
}}
>
<div className="h-[100%] p-[20px]">
@@ -1969,6 +1970,7 @@ function PlaceHolderSign() {
onClick={() => {
setIsSend(false);
setSignerPos([]);
navigate("/report/1MwEuxLEkF");
}}
type="button"
className="op-btn op-btn-ghost"
@@ -838,7 +838,7 @@ const TemplatePlaceholder = () => {
selector: '[data-tut="headerArea"]',
content: () => (
<TourContentWithBtn
message={`Clicking Save will store the current template. After saving, youll be prompted to create a new document from this template if you wish.`}
message={`Clicking Next will store the current template. After saving, youll be prompted to create a new document from this template if you wish.`}
isChecked={handleDontShow}
/>
),
@@ -1477,7 +1477,7 @@ const TemplatePlaceholder = () => {
/>
{/* pdf header which contain funish back button */}
<Header
completeBtnTitle={"Save"}
completeBtnTitle={"Next"}
isPlaceholder={true}
pageNumber={pageNumber}
allPages={allPages}