Skip to content

Commit

Permalink
fix: resolved text widget data embedding issue after sending the docu…
Browse files Browse the repository at this point in the history
…ment
  • Loading branch information
raktima-opensignlabs committed Nov 20, 2024
1 parent 7050df8 commit 5cbbb00
Showing 1 changed file with 34 additions and 21 deletions.
55 changes: 34 additions & 21 deletions apps/OpenSign/src/pages/PlaceHolderSign.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,22 +580,33 @@ function PlaceHolderSign() {
}
setSignerPos(updatesignerPos);
} else {
let updatesignerPos;
//if condition when widget type is prefill label text widget
if (dragTypeValue === textWidget) {
const prefileTextWidget = {
signerPtr: {},
signerObjId: "",
blockColor: "#f58f8c",
placeHolder: [placeHolder],
Role: "prefill",
Id: key
};
signerPos.push(prefileTextWidget);
setSignerPos(signerPos);
//check text widgets data (prefill) already exist then and want to add text widget on new page
//create new page entry with old data and update placeholder
if (filterSignerPos) {
const addPrefillData =
filterSignerPos && filterSignerPos?.placeHolder;
addPrefillData.push(placeHolder);
const updatePrefillPos = signerPos.map((x) =>
x.Role === "prefill" ? { ...x, placeHolder: addPrefillData } : x
);
setSignerPos(updatePrefillPos);
} //else condition if user do not have any text widget data
else {
const prefillTextWidget = {
signerPtr: {},
signerObjId: "",
blockColor: "#f58f8c",
placeHolder: [placeHolder],
Role: "prefill",
Id: key
};
signerPos.push(prefillTextWidget);
}
} else {
//else condition to add placeholder widgets on multiple page first time
updatesignerPos = signerPos.map((x) =>
const updatesignerPos = signerPos.map((x) =>
x.Id === uniqueId && x?.placeHolder
? { ...x, placeHolder: [...x.placeHolder, placeHolder] }
: x.Id === uniqueId
Expand Down Expand Up @@ -770,15 +781,17 @@ function PlaceHolderSign() {
signerupdate.push(newUpdatePos[0]);
setSignerPos(signerupdate);
} else {
const updatedData = signerPos.map((item) => {
if (item.Id === Id) {
// Create a copy of the item object and delete the placeHolder field
const updatedItem = { ...item };
delete updatedItem.placeHolder;
return updatedItem;
}
return item;
});
const updatedData = signerPos
.filter((item) => !(item.Id === Id && item.Role === "prefill")) // Remove prefill object
.map((item) => {
if (item.Id === Id && item.Role !== "prefill") {
// Create a copy of the item object and delete the placeHolder field
const updatedItem = { ...item };
delete updatedItem.placeHolder;
return updatedItem;
}
return item;
});
setSignerPos(updatedData);
}
}
Expand Down

0 comments on commit 5cbbb00

Please sign in to comment.