Skip to content

Commit d3b5643

Browse files
resolve color issue on drag placeholder
1 parent 527c5be commit d3b5643

File tree

3 files changed

+44
-38
lines changed

3 files changed

+44
-38
lines changed

microfrontends/SignDocuments/src/Component/TemplatePlaceholder.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import EditTemplate from "./component/EditTemplate";
3232
import ModalUi from "../premitives/ModalUi";
3333
import AddRoleModal from "./component/AddRoleModal";
3434
import PlaceholderCopy from "./component/PlaceholderCopy";
35+
import ModalComponent from "./component/modalComponent";
3536

3637
const TemplatePlaceholder = () => {
3738
const navigate = useNavigate();
@@ -169,6 +170,7 @@ const TemplatePlaceholder = () => {
169170

170171
useEffect(() => {
171172
fetchTemplate();
173+
// eslint-disable-next-line
172174
}, []);
173175

174176
useEffect(() => {
@@ -427,7 +429,7 @@ const TemplatePlaceholder = () => {
427429
// .indexOf(signerObjId);
428430

429431
const colorIndex = signerPos.map((e) => e.Id).indexOf(uniqueId);
430-
432+
const blockColor = signersdata.find((x) => x.Id === uniqueId)?.blockColor;
431433
const getPlaceHolder = filterSignerPos[0].placeHolder;
432434
const updatePlace = getPlaceHolder.filter(
433435
(data) => data.pageNumber !== pageNumber
@@ -448,7 +450,7 @@ const TemplatePlaceholder = () => {
448450
let placeHolderPos;
449451
if (contractName) {
450452
placeHolderPos = {
451-
blockColor: color[isSelectListId],
453+
blockColor: blockColor ? blockColor : color[isSelectListId],
452454
signerObjId: signerObjId,
453455
placeHolder: updatePlace,
454456
signerPtr: {
@@ -461,7 +463,7 @@ const TemplatePlaceholder = () => {
461463
};
462464
} else {
463465
placeHolderPos = {
464-
blockColor: color[isSelectListId],
466+
blockColor: blockColor ? blockColor : color[isSelectListId],
465467
signerObjId: "",
466468
placeHolder: updatePlace,
467469
signerPtr: {},
@@ -515,6 +517,7 @@ const TemplatePlaceholder = () => {
515517
setSignerPos(newArray);
516518
}
517519
} else {
520+
const blockColor = signersdata.find((x) => x.Id === uniqueId)?.blockColor;
518521
let placeHolderPos;
519522
if (contractName) {
520523
placeHolderPos = {
@@ -524,7 +527,7 @@ const TemplatePlaceholder = () => {
524527
objectId: signerObjId
525528
},
526529
signerObjId: signerObjId,
527-
blockColor: color[isSelectListId],
530+
blockColor: blockColor ? blockColor : color[isSelectListId],
528531
placeHolder: xyPosArr,
529532
Role: roleName,
530533
Id: uniqueId
@@ -533,7 +536,7 @@ const TemplatePlaceholder = () => {
533536
placeHolderPos = {
534537
signerPtr: {},
535538
signerObjId: "",
536-
blockColor: color[isSelectListId],
539+
blockColor: blockColor ? blockColor : color[isSelectListId],
537540
placeHolder: xyPosArr,
538541
Role: roleName,
539542
Id: uniqueId
@@ -981,7 +984,6 @@ const TemplatePlaceholder = () => {
981984
setIsModalRole(false);
982985
};
983986

984-
985987
return (
986988
<div>
987989
<Title title={"Template"} />
@@ -1084,6 +1086,12 @@ const TemplatePlaceholder = () => {
10841086
)}
10851087
</div>
10861088
</ModalUi>
1089+
{isCreateDoc && <Loader isLoading={isLoading} />}
1090+
<ModalComponent
1091+
isShow={isShowEmail}
1092+
type={"signersAlert"}
1093+
setIsShowEmail={setIsShowEmail}
1094+
/>
10871095
<PlaceholderCopy
10881096
isPageCopy={isPageCopy}
10891097
setIsPageCopy={setIsPageCopy}

microfrontends/SignDocuments/src/Component/component/EditTemplate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useEffect } from "react";
1+
import React, { useState } from "react";
22
import "../../css/AddUser.css";
33
// import SelectFolder from "../../premitives/SelectFolder";
44

microfrontends/SignDocuments/src/Component/component/PlaceholderCopy.js

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,19 @@ function PlaceholderCopy(props) {
6666
let newPlaceholderPosition = [];
6767
let newPageNumber = 1;
6868
const signerPosition = props.xyPostion;
69-
const signerId = props.signerObjId ? props.signerObjId : props.Id
69+
const signerId = props.signerObjId ? props.signerObjId : props.Id;
7070
//handle placeholder array and copy for multiple signers placeholder at requested location
7171
if (signerId) {
7272
//get current signers data
7373
let filterSignerPosition;
74-
if(props?.signerObjId){
75-
filterSignerPosition = signerPosition.filter(
74+
if (props?.signerObjId) {
75+
filterSignerPosition = signerPosition.filter(
7676
(data) => data.signerObjId === signerId
7777
);
78-
}else{
79-
filterSignerPosition = signerPosition.filter((item)=> item.Id === signerId)
78+
} else {
79+
filterSignerPosition = signerPosition.filter(
80+
(item) => item.Id === signerId
81+
);
8082
}
8183
//get current pagenumber's all placeholder position data
8284
const placeholderPosition = filterSignerPosition[0].placeHolder.filter(
@@ -92,7 +94,7 @@ function PlaceholderCopy(props) {
9294
rest.key = newId;
9395
//get exist placeholder position for particular page
9496
const existPlaceholder = filterSignerPosition[0].placeHolder.filter(
95-
(data) => data.pageNumber == newPageNumber
97+
(data) => data.pageNumber === newPageNumber
9698
);
9799
const existPlaceholderPosition =
98100
existPlaceholder[0] && existPlaceholder[0].pos;
@@ -110,31 +112,27 @@ function PlaceholderCopy(props) {
110112
newPageNumber++;
111113
}
112114
let updatedSignerPlaceholder;
113-
if(props?.signerObjId){
114-
updatedSignerPlaceholder = signerPosition.map(
115-
(signersData, ind) => {
116-
if (signersData.signerObjId === props.signerObjId) {
117-
return {
118-
...signersData,
119-
placeHolder: newPlaceholderPosition
120-
};
121-
}
122-
return signersData;
123-
}
124-
);
125-
}else{
126-
updatedSignerPlaceholder = signerPosition.map(
127-
(signersData, ind) => {
128-
if (signersData.Id === props.Id) {
129-
return {
130-
...signersData,
131-
placeHolder: newPlaceholderPosition
132-
};
133-
}
134-
return signersData;
115+
if (props?.signerObjId) {
116+
updatedSignerPlaceholder = signerPosition.map((signersData, ind) => {
117+
if (signersData.signerObjId === props.signerObjId) {
118+
return {
119+
...signersData,
120+
placeHolder: newPlaceholderPosition
121+
};
135122
}
136-
);
137-
}
123+
return signersData;
124+
});
125+
} else {
126+
updatedSignerPlaceholder = signerPosition.map((signersData, ind) => {
127+
if (signersData.Id === props.Id) {
128+
return {
129+
...signersData,
130+
placeHolder: newPlaceholderPosition
131+
};
132+
}
133+
return signersData;
134+
});
135+
}
138136
// const updatedSignerPlaceholder = signerPosition.map(
139137
// (signersData, ind) => {
140138
// if (signersData.signerObjId === props.signerObjId) {
@@ -166,7 +164,7 @@ function PlaceholderCopy(props) {
166164
for (let i = 0; i < props.allPages; i++) {
167165
//get exist placeholder position for particular page
168166
const existPlaceholder = xyPostion.filter(
169-
(data) => data.pageNumber == newPageNumber
167+
(data) => data.pageNumber === newPageNumber
170168
);
171169
const existPlaceholderPosition =
172170
existPlaceholder[0] && existPlaceholder[0].pos;

0 commit comments

Comments
 (0)