Skip to content

Commit 6943128

Browse files
authored
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
2 parents 6fb714d + 2606b58 commit 6943128

File tree

7 files changed

+79
-42
lines changed

7 files changed

+79
-42
lines changed

apps/OpenSign/src/components/BulkSendUi.js

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,33 +113,60 @@ const BulkSendUi = (props) => {
113113
let Placeholders = [...props.item.Placeholders];
114114
// Initialize an empty array to store updated documents
115115
let Documents = [];
116-
117116
// Loop through each form
118117
forms.forEach((form) => {
118+
//checking if user enter email which already exist as a signer then add user in a signers array
119+
let existSigner = [];
120+
form.fields.map((data) => {
121+
if (data.signer) {
122+
existSigner.push(data.signer);
123+
}
124+
});
119125
// Map through the copied Placeholders array to update email values
120126
const updatedPlaceholders = Placeholders.map((placeholder) => {
121127
// Find the field in the current form that matches the placeholder Id
122128
const field = form.fields.find(
123129
(element) => parseInt(element.fieldId) === placeholder.Id
124130
);
125131
// If a matching field is found, update the email value in the placeholder
126-
const signer = field?.signer?.objectId ? field.signer : {};
132+
const signer = field?.signer?.objectId ? field.signer : "";
127133
if (field) {
128-
return {
129-
...placeholder,
130-
email: field.email,
131-
signerObjId: field?.signer?.objectId || "",
132-
signerPtr: signer
133-
};
134+
if (signer) {
135+
return {
136+
...placeholder,
137+
signerObjId: field?.signer?.objectId || "",
138+
signerPtr: signer
139+
};
140+
} else {
141+
return {
142+
...placeholder,
143+
email: field.email,
144+
signerObjId: field?.signer?.objectId || "",
145+
signerPtr: signer
146+
};
147+
}
134148
}
135149
// If no matching field is found, keep the placeholder as is
136150
return placeholder;
137151
});
138152

139153
// Push a new document object with updated Placeholders into the Documents array
140-
Documents.push({ ...props.item, Placeholders: updatedPlaceholders });
154+
if (existSigner?.length > 0) {
155+
Documents.push({
156+
...props.item,
157+
Placeholders: updatedPlaceholders,
158+
Signers: props.item.Signers
159+
? [...props.item.Signers, ...existSigner]
160+
: [...existSigner]
161+
});
162+
} else {
163+
Documents.push({
164+
...props.item,
165+
Placeholders: updatedPlaceholders
166+
});
167+
}
141168
});
142-
// console.log("Documents ", Documents);
169+
//console.log("Documents ", Documents);
143170
await batchQuery(Documents);
144171
};
145172

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ function PlaceholderType(props) {
424424
<div
425425
style={{
426426
color: "black",
427-
fontSize: calculateFontSize()
427+
fontSize: "12px"
428428
}}
429429
>
430430
<span>{type}</span>
@@ -454,7 +454,7 @@ function PlaceholderType(props) {
454454
{props?.pos?.options?.name}
455455
</option>
456456

457-
{props.pos?.options?.values.map((data, ind) => {
457+
{props.pos?.options?.values?.map((data, ind) => {
458458
return (
459459
<option key={ind} value={data}>
460460
{data}
@@ -523,7 +523,7 @@ function PlaceholderType(props) {
523523
<div
524524
style={{
525525
color: "black",
526-
fontSize: calculateFontSize()
526+
fontSize: "12px"
527527
}}
528528
>
529529
<span>{type}</span>
@@ -563,7 +563,7 @@ function PlaceholderType(props) {
563563
<div
564564
style={{
565565
color: "black",
566-
fontSize: calculateFontSize()
566+
fontSize: "12px"
567567
}}
568568
>
569569
<span>{type}</span>
@@ -603,7 +603,7 @@ function PlaceholderType(props) {
603603
<div
604604
style={{
605605
color: "black",
606-
fontSize: calculateFontSize()
606+
fontSize: "12px"
607607
}}
608608
>
609609
<span>{type}</span>
@@ -721,7 +721,7 @@ function PlaceholderType(props) {
721721
<div
722722
style={{
723723
color: "black",
724-
fontSize: calculateFontSize()
724+
fontSize: "12px"
725725
}}
726726
>
727727
<span>{type}</span>

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,10 @@ function WidgetComponent({
355355
<span>Fields</span>
356356
</div>
357357

358-
<div className="p-[15px] flex flex-col pt-4 2xl:m-5">
358+
<div
359+
className="p-[15px] flex flex-col pt-4 2xl:m-5"
360+
data-tut="addWidgets"
361+
>
359362
<WidgetList
360363
updateWidgets={updateWidgets}
361364
handleDivClick={handleDivClick}

apps/OpenSign/src/constant/Utils.js

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,23 @@ export const onChangeHeightOfTextArea = (
942942
setXyPostion(updatePlaceholder);
943943
}
944944
};
945+
//calculate width and height
946+
export const calculateInitialWidthHeight = (widgetData) => {
947+
const intialText = widgetData;
948+
const span = document.createElement("span");
949+
span.textContent = intialText;
950+
span.style.font = `14px`; // here put your text size and font family
951+
span.style.display = "hidden";
952+
document.body.appendChild(span);
953+
const width = span.offsetWidth;
954+
const height = span.offsetHeight;
945955

956+
document.body.removeChild(span);
957+
return {
958+
getWidth: width,
959+
getHeight: height
960+
};
961+
};
946962
export const addInitialData = (signerPos, setXyPostion, value, userId) => {
947963
function widgetDataValue(type) {
948964
switch (type) {
@@ -991,9 +1007,13 @@ export const addInitialData = (signerPos, setXyPostion, value, userId) => {
9911007
options: {
9921008
...item.options,
9931009
defaultValue: widgetData
994-
},
995-
Width: calculateInitialWidthHeight(item.type, widgetData).getWidth,
996-
Height: calculateInitialWidthHeight(item.type, widgetData).getHeight
1010+
}
1011+
// Width:
1012+
// calculateInitialWidthHeight(item.type, widgetData).getWidth ||
1013+
// item?.Width,
1014+
// Height:
1015+
// calculateInitialWidthHeight(item.type, widgetData).getHeight ||
1016+
// item?.Height
9971017
};
9981018
} else {
9991019
return {
@@ -1004,24 +1024,6 @@ export const addInitialData = (signerPos, setXyPostion, value, userId) => {
10041024
});
10051025
};
10061026

1007-
//calculate width and height
1008-
export const calculateInitialWidthHeight = (widgetData) => {
1009-
const intialText = widgetData;
1010-
const span = document.createElement("span");
1011-
span.textContent = intialText;
1012-
span.style.font = `14px`; // here put your text size and font family
1013-
span.style.display = "hidden";
1014-
document.body.appendChild(span);
1015-
const width = span.offsetWidth;
1016-
const height = span.offsetHeight;
1017-
1018-
document.body.removeChild(span);
1019-
return {
1020-
getWidth: width,
1021-
getHeight: height
1022-
};
1023-
};
1024-
10251027
//function for embed document id
10261028
export const embedDocId = async (pdfDoc, documentId, allPages) => {
10271029
for (let i = 0; i < allPages; i++) {

apps/OpenSign/src/pages/PdfRequestFiles.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1750,7 +1750,10 @@ function PdfRequestFiles() {
17501750
<div className={`max-h-screen`}>
17511751
{signedSigners.length > 0 && (
17521752
<>
1753-
<div className="mx-2 pr-2 pt-2 pb-1 text-[15px] text-base-content font-semibold border-b-[1px] border-base-300">
1753+
<div
1754+
data-tut="reactourSecond"
1755+
className="mx-2 pr-2 pt-2 pb-1 text-[15px] text-base-content font-semibold border-b-[1px] border-base-300"
1756+
>
17541757
<span> Signed by</span>
17551758
</div>
17561759
<div className="mt-[2px]">

apps/OpenSign/src/pages/PlaceHolderSign.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,7 @@ function PlaceHolderSign() {
12921292
selector: '[data-tut="addRecipient"]',
12931293
content: () => (
12941294
<TourContentWithBtn
1295-
message={`Clicking "Add recipients" button will allow you to add more signer.`}
1295+
message={`Clicking "Add recipients" button will allow you to add more signers.`}
12961296
isChecked={handleDontShow}
12971297
/>
12981298
),
@@ -1928,6 +1928,7 @@ function PlaceHolderSign() {
19281928
handleClose={() => {
19291929
setIsSend(false);
19301930
setSignerPos([]);
1931+
navigate("/report/1MwEuxLEkF");
19311932
}}
19321933
>
19331934
<div className="h-[100%] p-[20px]">
@@ -1969,6 +1970,7 @@ function PlaceHolderSign() {
19691970
onClick={() => {
19701971
setIsSend(false);
19711972
setSignerPos([]);
1973+
navigate("/report/1MwEuxLEkF");
19721974
}}
19731975
type="button"
19741976
className="op-btn op-btn-ghost"

apps/OpenSign/src/pages/TemplatePlaceholder.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ const TemplatePlaceholder = () => {
838838
selector: '[data-tut="headerArea"]',
839839
content: () => (
840840
<TourContentWithBtn
841-
message={`Clicking ‘Save’ will store the current template. After saving, you’ll be prompted to create a new document from this template if you wish.`}
841+
message={`Clicking ‘Next’ will store the current template. After saving, you’ll be prompted to create a new document from this template if you wish.`}
842842
isChecked={handleDontShow}
843843
/>
844844
),
@@ -1477,7 +1477,7 @@ const TemplatePlaceholder = () => {
14771477
/>
14781478
{/* pdf header which contain funish back button */}
14791479
<Header
1480-
completeBtnTitle={"Save"}
1480+
completeBtnTitle={"Next"}
14811481
isPlaceholder={true}
14821482
pageNumber={pageNumber}
14831483
allPages={allPages}

0 commit comments

Comments
 (0)