Skip to content

Commit d42e11c

Browse files
fix: blocking screen by warning for expired and decline document
1 parent fe37f3e commit d42e11c

File tree

5 files changed

+808
-794
lines changed

5 files changed

+808
-794
lines changed

microfrontends/SignDocuments/src/Component/PdfRequestFiles.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ function PdfRequestFiles() {
6262
const [isSigned, setIsSigned] = useState(false);
6363
const [isExpired, setIsExpired] = useState(false);
6464
const [alreadySign, setAlreadySign] = useState(false);
65-
65+
const [containerWH, setContainerWH] = useState({});
66+
const divRef = useRef(null);
6667
const rowLevel =
6768
localStorage.getItem("rowlevel") &&
6869
JSON.parse(localStorage.getItem("rowlevel"));
@@ -94,6 +95,14 @@ function PdfRequestFiles() {
9495
getDocumentDetails();
9596
}
9697
}, []);
98+
useEffect(() => {
99+
if (divRef.current) {
100+
setContainerWH({
101+
width: divRef.current.offsetWidth,
102+
height: divRef.current.offsetHeight
103+
});
104+
}
105+
}, [divRef.current]);
97106

98107
//function for get document details for perticular signer with signer'object id
99108
const getDocumentDetails = async () => {
@@ -982,9 +991,10 @@ function PdfRequestFiles() {
982991
</div>
983992
)}
984993

985-
<div className="signatureContainer">
994+
<div className="signatureContainer" ref={divRef}>
986995
{/* this modal is used to show decline alert */}
987996
<CustomModal
997+
containerWH={containerWH}
988998
show={isDecline.isDeclined}
989999
headMsg="Document Declined Alert!"
9901000
bodyMssg={
@@ -1009,6 +1019,7 @@ function PdfRequestFiles() {
10091019
/>
10101020
{/* this modal is used for show expired alert */}
10111021
<CustomModal
1022+
containerWH={containerWH}
10121023
show={isExpired}
10131024
headMsg="Document Expired!"
10141025
bodyMssg="This Document is no longer available."

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,19 @@ function CustomModal({
88
bodyMssg,
99
footerMessage,
1010
declineDoc,
11-
setIsDecline
11+
setIsDecline,
12+
containerWH
1213
}) {
14+
const isMobile = window.innerWidth < 767;
1315
return (
1416
show && (
15-
<div className="parentDiv">
17+
<div
18+
className="parentDiv"
19+
style={{
20+
width: containerWH && containerWH.width,
21+
height: isMobile ? "100%" : containerWH && containerWH.height
22+
}}
23+
>
1624
<div className="childDiv">
1725
<div className="modalHeadDiv bg-danger">{headMsg && headMsg}</div>
1826
<div className="modalBodyDIv">

microfrontends/SignDocuments/src/Component/recipientSignPdf.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@ function EmbedPdfImage() {
6767
status: false,
6868
type: "load"
6969
});
70-
70+
const [containerWH, setContainerWH] = useState({});
7171
const docId = id && id;
7272
const isMobile = window.innerWidth < 767;
7373
const index = xyPostion.findIndex((object) => {
7474
return object.pageNumber === pageNumber;
7575
});
76+
const divRef = useRef(null);
7677

7778
useEffect(() => {
7879
const clientWidth = window.innerWidth;
@@ -82,6 +83,14 @@ function EmbedPdfImage() {
8283
setPdfNewWidth(pdfWidth);
8384
getDocumentDetails();
8485
}, []);
86+
useEffect(() => {
87+
if (divRef.current) {
88+
setContainerWH({
89+
width: divRef.current.offsetWidth,
90+
height: divRef.current.offsetHeight
91+
});
92+
}
93+
}, [divRef.current]);
8594

8695
//function for get document details for perticular signer with signer'object id
8796
const getDocumentDetails = async () => {
@@ -952,9 +961,10 @@ function EmbedPdfImage() {
952961
) : noData ? (
953962
<Nodata />
954963
) : (
955-
<div className="signatureContainer">
964+
<div className="signatureContainer" ref={divRef}>
956965
{/* this modal is used to show decline alert */}
957966
<CustomModal
967+
containerWH={containerWH}
958968
show={isDecline.isDeclined}
959969
headMsg="Document Declined Alert!"
960970
bodyMssg={
@@ -977,6 +987,7 @@ function EmbedPdfImage() {
977987
/>
978988
{/* this modal is used for show expired alert */}
979989
<CustomModal
990+
containerWH={containerWH}
980991
show={isExpired}
981992
headMsg="Document Expired!"
982993
bodyMssg="This Document is no longer available."

microfrontends/SignDocuments/src/css/customModal.css

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
.parentDiv {
2-
width: 100%;
3-
height: 100%;
42
background: gray;
53
position: absolute;
6-
z-index: 100;
4+
z-index: 20;
75
background-color: rgba(0, 0, 0, 0.75);
86
display: flex;
97
flex-direction: column;
10-
/* justify-content: center; */
11-
align-items: center;
8+
align-items: center;
129
}
1310

1411
.childDiv {
@@ -18,7 +15,7 @@
1815
justify-content: center;
1916
align-content: center;
2017
background-color: #fff;
21-
margin:30px 20px;
18+
margin: 30px 20px;
2219
border: 0px 1px 1px 1px solid rgba(0, 0, 0, .2);
2320
border-radius: 0.3rem;
2421
outline: 0;
@@ -47,7 +44,8 @@
4744

4845
font-size: 15px !important;
4946
}
50-
.modalFooterDiv{
47+
48+
.modalFooterDiv {
5149
margin: 10px;
5250
display: flex;
5351
justify-content: flex-end;

0 commit comments

Comments
 (0)