Skip to content

Commit 1cc4cf9

Browse files
fix: resize placeholder design and adding resize option for recipients, added signers's name on placeholder
1 parent c1621f6 commit 1cc4cf9

File tree

8 files changed

+883
-873
lines changed

8 files changed

+883
-873
lines changed

microfrontends/SignDocuments/src/Component/PdfRequestFiles.js

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,87 @@ function PdfRequestFiles() {
524524
alert("something went wrong");
525525
});
526526
};
527+
528+
//function for resize image and update width and height
529+
const handleImageResize = (ref, key, signerId, position) => {
530+
const filterSignerPos = signerPos.filter(
531+
(data) => data.signerObjId === signerId
532+
);
533+
if (filterSignerPos.length > 0) {
534+
const getPlaceHolder = filterSignerPos[0].placeHolder;
535+
const getPageNumer = getPlaceHolder.filter(
536+
(data) => data.pageNumber === pageNumber
537+
);
538+
if (getPageNumer.length > 0) {
539+
const getXYdata = getPageNumer[0].pos.filter(
540+
(data, ind) => data.key === key && data.Width && data.Height
541+
);
542+
if (getXYdata.length > 0) {
543+
const getXYdata = getPageNumer[0].pos;
544+
const getPosData = getXYdata;
545+
const addSignPos = getPosData.map((url, ind) => {
546+
if (url.key === key) {
547+
return {
548+
...url,
549+
Width: ref.offsetWidth,
550+
Height: ref.offsetHeight,
551+
xPosition: position.x
552+
};
553+
}
554+
return url;
555+
});
556+
557+
const newUpdateSignPos = getPlaceHolder.map((obj, ind) => {
558+
if (obj.pageNumber === pageNumber) {
559+
return { ...obj, pos: addSignPos };
560+
}
561+
return obj;
562+
});
563+
564+
const newUpdateSigner = signerPos.map((obj, ind) => {
565+
if (obj.signerObjId === signerId) {
566+
return { ...obj, placeHolder: newUpdateSignPos };
567+
}
568+
return obj;
569+
});
570+
571+
setSignerPos(newUpdateSigner);
572+
} else {
573+
const getXYdata = getPageNumer[0].pos;
574+
575+
const getPosData = getXYdata;
576+
577+
const addSignPos = getPosData.map((url, ind) => {
578+
if (url.key === key) {
579+
return {
580+
...url,
581+
Width: ref.offsetWidth,
582+
Height: ref.offsetHeight
583+
};
584+
}
585+
return url;
586+
});
587+
588+
const newUpdateSignPos = getPlaceHolder.map((obj, ind) => {
589+
if (obj.pageNumber === pageNumber) {
590+
return { ...obj, pos: addSignPos };
591+
}
592+
return obj;
593+
});
594+
595+
const newUpdateSigner = signerPos.map((obj, ind) => {
596+
if (obj.signerObjId === signerId) {
597+
return { ...obj, placeHolder: newUpdateSignPos };
598+
}
599+
return obj;
600+
});
601+
602+
setSignerPos(newUpdateSigner);
603+
}
604+
}
605+
}
606+
};
607+
527608
//function for get pdf page details
528609
const pageDetails = async (pdf) => {
529610
const load = {
@@ -956,6 +1037,7 @@ function PdfRequestFiles() {
9561037
setCurrentSigner={setCurrentSigner}
9571038
setPdfLoadFail={setPdfLoadFail}
9581039
pdfLoadFail={pdfLoadFail}
1040+
setSignerPos={setSignerPos}
9591041
/>
9601042
</div>
9611043
<div>

microfrontends/SignDocuments/src/Component/SignYourselfPdf.js

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -692,60 +692,6 @@ function SignYourSelf() {
692692
setSignBtnPosition([xySignature]);
693693
};
694694

695-
//function for resize image and update width and height
696-
const handleImageResize = (ref, key, direction, position) => {
697-
const updateFilter = xyPostion[index].pos.filter(
698-
(data, ind) => data.key === key && data.Width && data.Height
699-
);
700-
701-
if (updateFilter.length > 0) {
702-
const getXYdata = xyPostion[index].pos;
703-
const getPosData = getXYdata;
704-
const addSign = getPosData.map((url, ind) => {
705-
if (url.key === key) {
706-
return {
707-
...url,
708-
Width: ref.offsetWidth,
709-
Height: ref.offsetHeight,
710-
xPosition: position.x
711-
};
712-
}
713-
return url;
714-
});
715-
716-
const newUpdateUrl = xyPostion.map((obj, ind) => {
717-
if (ind === index) {
718-
return { ...obj, pos: addSign };
719-
}
720-
return obj;
721-
});
722-
723-
setXyPostion(newUpdateUrl);
724-
} else {
725-
const getXYdata = xyPostion[index].pos;
726-
727-
const getPosData = getXYdata;
728-
729-
const addSign = getPosData.map((url, ind) => {
730-
if (url.key === key) {
731-
return {
732-
...url,
733-
Width: ref.offsetWidth,
734-
Height: ref.offsetHeight
735-
};
736-
}
737-
return url;
738-
});
739-
740-
const newUpdateUrl = xyPostion.map((obj, ind) => {
741-
if (ind === index) {
742-
return { ...obj, pos: addSign };
743-
}
744-
return obj;
745-
});
746-
setXyPostion(newUpdateUrl);
747-
}
748-
};
749695
const handleAllDelete = () => {
750696
setXyPostion([]);
751697
};
@@ -1002,7 +948,6 @@ function SignYourSelf() {
1002948
nodeRef={nodeRef}
1003949
handleTabDrag={handleTabDrag}
1004950
handleStop={handleStop}
1005-
handleImageResize={handleImageResize}
1006951
isDragging={isDragging}
1007952
setIsSignPad={setIsSignPad}
1008953
setIsStamp={setIsStamp}
@@ -1017,6 +962,8 @@ function SignYourSelf() {
1017962
pageDetails={pageDetails}
1018963
setPdfLoadFail={setPdfLoadFail}
1019964
pdfLoadFail={pdfLoadFail}
965+
setXyPostion={setXyPostion}
966+
index={index}
1020967
/>
1021968
</div>
1022969
</div>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from "react";
2+
3+
function BorderResize() {
4+
return (
5+
<div
6+
className="borderResize"
7+
style={{
8+
right: "-1px",
9+
bottom: "-1px",
10+
borderRight: "3px solid #188ae2",
11+
borderBottom: "3px solid #188ae2"
12+
}}
13+
></div>
14+
);
15+
}
16+
17+
export default BorderResize;

0 commit comments

Comments
 (0)