update signDocuments microfrontend and change zindex of layout in opensign

This commit is contained in:
prafullnavkar-nxg
2023-10-27 21:59:14 +05:30
parent 8f2e05a2bb
commit 8eec662f5c
13 changed files with 1147 additions and 1048 deletions
@@ -191,7 +191,7 @@ function EmailComponent({
className="btn btn-primary btn-sm"
>
<i
class="fa fa-print"
className="fa fa-print"
style={{
fontSize: "15px",
marginRight: "3px",
@@ -332,7 +332,7 @@ function EmailComponent({
marginTop: "10px",
color: "white",
}}
class="fa fa-plus"
className="fa fa-plus"
aria-hidden="true"
></i>
</span>
@@ -1,6 +1,7 @@
import React, { useState } from "react";
import * as Select from "@radix-ui/react-select";
import classnames from "classnames";
function FieldsComponent({
pdfUrl,
sign,
@@ -19,19 +20,24 @@ function FieldsComponent({
isDragSignatureSS,
isSignYourself,
addPositionOfSignature,
signerPos,
signersdata,
isSelectListId,
setSignerObjId,
setIsSelectId,
setContractName,
isSigners,
dataTut,
dataTut2,
setIsShowEmail,
isMailSend,
selectedEmail,
setSelectedEmail,
}) {
const signStyle = pdfUrl ? "disableSign" : "signatureBtn";
const isMobile = window.innerWidth < 712;
const [isShowSort, setIsShowSort] = useState(false);
const [selectedEmail, setSelectedEmail] = useState("");
const SelectItem = React.forwardRef(
({ children, className, ...props }, forwardedRef) => {
return (
@@ -46,266 +52,176 @@ function FieldsComponent({
);
}
);
console.log("sign",isSignYourself)
const color = [
"#93a3db",
"#e6c3db",
"#c0e3bc",
"#bce3db",
"#b8ccdb",
"#ceb8db",
"#ffccff",
"#99ffcc",
"#cc99ff",
"#ffcc99",
"#66ccff",
"#ffffcc",
];
return (
<>
<div className="signerComponent">
<div
style={{
background: themeColor(),
padding: "5px",
}}
>
<span className="signedStyle">Fields</span>
</div>
<div className="signLayoutContainer1">
{pdfUrl ? (
<>
<button className={signStyle} disabled={true}>
<span
style={{
fontWeight: "400",
fontSize: "15px",
padding: "3px 20px 0px 20px",
color: "#bfbfbf",
}}
>
Signature
</span>
<img
alt="sign img"
style={{
width: "30px",
height: "28px",
background: "#d3edeb",
}}
src={sign}
/>
</button>
<button className={signStyle} disabled={true}>
<span
style={{
fontWeight: "400",
fontSize: "15px",
padding: "3px 0px 0px 35px",
color: "#bfbfbf",
}}
>
Stamp
</span>
<img
alt="stamp img"
style={{
width: "25px",
height: "28px",
background: "#d3edeb",
}}
src={stamp}
/>
</button>
</>
) : (
<>
{isMobile && isSignYourself ? (
!isMailSend && (
<div
data-tut={dataTut}
id="navbar"
className="stickyfooter"
style={{ width: window.innerWidth + "px" }}
>
{isSigners && (
<div
data-tut={dataTut}
style={{
background: isSelectListId
? color[isSelectListId % color.length]
: color[0],
padding: "10px 20px",
display: "flex",
alignItems: "center",
justifyContent: "center",
}}
>
<span style={{ fontSize: "18px", fontWeight: "500" }}>
Signer :
</span>
<Select.Root
onValueChange={(obj) => {
const [selectedKey, selectedData] = obj.split("|");
const parseData = JSON.parse(selectedData);
setSignerObjId(parseData.objectId);
setIsSelectId(selectedKey);
setContractName(parseData.className);
setSelectedEmail(true);
}}
>
<Select.Trigger
className="SelectTrigger"
style={{
background: isSelectListId
? color[isSelectListId % color.length]
: color[0],
}}
aria-label="Food"
>
<Select.Value placeholder="Select signer.." />
<Select.Icon className="SelectIcon">
<i
style={{
marginTop: "5px",
marginLeft: "5px",
color: "#3b15d1",
fontSize: "20px",
}}
className="fa fa-angle-down"
aria-hidden="true"
></i>
</Select.Icon>
</Select.Trigger>
<Select.Portal>
<Select.Content
className="SelectContent"
style={{ zIndex: "5000" }}
>
<Select.ScrollUpButton className="SelectScrollButton">
<i
style={{
marginTop: "5px",
marginLeft: "5px",
color: "#3b15d1",
fontSize: "20px",
}}
className="fa fa-angle-down"
aria-hidden="true"
></i>
</Select.ScrollUpButton>
<Select.Viewport className="SelectViewport">
<Select.Group>
{signersdata.Signers.map((obj, ind) => {
return (
<SelectItem
selected
key={ind}
value={`${ind}|${JSON.stringify(obj)}`}
// value={(obj)}
>
{" "}
{obj.Email}
</SelectItem>
);
})}
{/* <SelectItem value="orange">Orange</SelectItem>
<SelectItem value="apple">Apple</SelectItem>
<SelectItem value="grape"></SelectItem> */}
</Select.Group>
</Select.Viewport>
<Select.ScrollDownButton className="SelectScrollButton">
<i
style={{
marginTop: "5px",
marginLeft: "5px",
color: "#3b15d1",
fontSize: "20px",
}}
className="fa fa-angle-down"
aria-hidden="true"
></i>
</Select.ScrollDownButton>
</Select.Content>
</Select.Portal>
</Select.Root>
</div>
)}
<div
data-tut={dataTut2}
className="signLayoutContainer2"
style={{ backgroundColor: themeColor() }}
>
<div
onClick={() => {
if (isSigners) {
if (selectedEmail) {
addPositionOfSignature("onclick", false);
} else {
setIsShowEmail(true);
}
} else {
addPositionOfSignature("onclick", false);
}
}}
ref={(element) => {
dragSignature(element);
dragSignatureSS(element);
if (element) {
signRef.current = element;
// const height = signRef && signRef.current.offsetHeight;
// const width = signRef && signRef.current.offsetWidth;
}
}}
className={signStyle}
onMouseMove={handleDivClick}
onMouseDown={handleMouseLeave}
style={{
opacity: isDragSign ? 0.5 : 1,
boxShadow:
"0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.18)",
display: "flex",
flexDirection: "column",
alignItems: "center",
userSelect: "none",
opacity: isDragSignatureSS ? 0.5 : 1,
backgroundImage: `url(${sign})`,
backgroundSize: "70% 70%",
backgroundRepeat: "no-repeat",
backgroundPosition: "center center",
paddingBottom: "2.2rem",
}}
>
<span
style={{
fontWeight: "400",
fontSize: "15px",
padding: "3px 20px 0px 20px",
color: "black",
}}
>
Signature
</span>
<img
alt="sign img"
style={{
width: "30px",
height: "28px",
background: themeColor(),
}}
src={sign}
/>
</div>
<div
ref={(element) => {
dragStamp(element);
dragRef.current = element;
if (isDragStamp) {
// setIsStamp(true);
}
}}
className={!pdfUrl ? signStyle : "disableSign"}
disabled={pdfUrl && true}
onMouseMove={handleDivClick}
onMouseDown={handleMouseLeave}
style={{
opacity: isDragStamp ? 0.5 : 1,
boxShadow:
"0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.18)",
}}
>
<span
style={{
fontWeight: "400",
fontSize: "15px",
padding: "3px 0px 0px 35px",
color: !pdfUrl ? "black" : "#bfbfbf",
}}
>
Stamp
</span>
<img
alt="stamp img"
style={{
width: "25px",
height: "28px",
background: themeColor(),
}}
src={stamp}
/>
</div>
</>
)}
</div>
</div>
{isMobile && isSignYourself && (
<div
id="navbar"
className="stickyfooter"
style={{ width: window.innerWidth + "px" }}
>
{isSigners && (
<div
style={{
background: "#887abf",
padding: "10px 20px",
display: "flex",
alignItems: "center",
justifyContent: "center",
}}
>
<span style={{ fontSize: "18px", fontWeight: "500" }}>
Signer :
</span>
<Select.Root onValueChange={(e) => console.log("value", e)}>
<Select.Trigger
onValueChange={(e) => console.log("value", e)}
className="SelectTrigger"
aria-label="Food"
>
<Select.Value placeholder="Select signer" />
<Select.Icon className="SelectIcon">
<i
style={{
marginTop: "5px",
marginLeft: "5px",
color: "#3b15d1",
fontSize: "20px",
}}
class="fa fa-angle-down"
aria-hidden="true"
></i>
</Select.Icon>
</Select.Trigger>
<Select.Portal>
<Select.Content
className="SelectContent"
style={{ zIndex: "5000" }}
>
<Select.ScrollUpButton className="SelectScrollButton">
<i
style={{
marginTop: "5px",
marginLeft: "5px",
color: "#3b15d1",
fontSize: "20px",
}}
class="fa fa-angle-down"
aria-hidden="true"
></i>
</Select.ScrollUpButton>
<Select.Viewport className="SelectViewport">
<Select.Group>
{signersdata.Signers.map((obj, ind) => {
return (
<SelectItem key={ind} value={selectedEmail}>
{" "}
{obj.Email}
</SelectItem>
);
})}
</Select.Group>
</Select.Viewport>
<Select.ScrollDownButton className="SelectScrollButton">
<i
style={{
marginTop: "5px",
marginLeft: "5px",
color: "#3b15d1",
fontSize: "20px",
}}
class="fa fa-angle-down"
aria-hidden="true"
></i>
</Select.ScrollDownButton>
</Select.Content>
</Select.Portal>
</Select.Root>
</div>
)}
<div
className="signLayoutContainer2"
style={{ backgroundColor: themeColor() }}
>
<div
onClick={() => addPositionOfSignature("onclick", false)}
ref={(element) => {
dragSignatureSS(element);
if (element) {
signRef.current = element;
// const height = signRef && signRef.current.offsetHeight;
// const width = signRef && signRef.current.offsetWidth;
}
}}
style={{
display: "flex",
flexDirection: "column",
alignItems: "center",
userSelect: "none",
opacity: isDragSignatureSS ? 0.5 : 1,
backgroundImage: `url(${sign})`,
backgroundSize: "70% 70%",
backgroundRepeat: "no-repeat",
backgroundPosition: "center center",
paddingBottom: "2.2rem",
}}
>
{/* <img
{/* <img
alt="sign img"
style={{
width: "30px",
@@ -314,49 +230,193 @@ console.log("sign",isSignYourself)
}}
src={sign}
/> */}
<span
<span
style={{
color: "white",
fontSize: "12px",
position: "relative",
top: "2.6rem",
}}
>
Signature
</span>
</div>
<div
onClick={() => addPositionOfSignature("onclick", true)}
ref={(element) => {
dragStampSS(element);
dragRef.current = element;
}}
onMouseMove={handleDivClick}
onMouseDown={handleMouseLeave}
style={{
color: "white",
fontSize: "12px",
position: "relative",
top: "2.6rem",
display: "flex",
flexDirection: "column",
alignItems: "center",
userSelect: "none",
backgroundImage: `url(${stamp})`,
backgroundSize: "32px 33px",
backgroundRepeat: "no-repeat",
backgroundPosition: "center center",
paddingBottom: "2.2rem",
}}
>
Signature
</span>
</div>
<div
onClick={() => addPositionOfSignature("onclick", true)}
ref={(element) => {
dragStampSS(element);
dragRef.current = element;
}}
onMouseMove={handleDivClick}
onMouseDown={handleMouseLeave}
style={{
display: "flex",
flexDirection: "column",
alignItems: "center",
userSelect: "none",
backgroundImage: `url(${stamp})`,
backgroundSize: "32px 33px",
backgroundRepeat: "no-repeat",
backgroundPosition: "center center",
paddingBottom: "2.2rem",
}}
>
<span
style={{
color: "white",
fontSize: "12px",
position: "relative",
top: "2.6rem",
}}
>
Stamp
</span>
<span
style={{
color: "white",
fontSize: "12px",
position: "relative",
top: "2.6rem",
}}
>
Stamp
</span>
</div>
</div>
</div>
)
) : (
<div data-tut={dataTut} className="signerComponent">
<div
style={{
background: themeColor(),
padding: "5px",
}}
>
<span className="signedStyle">Fields</span>
</div>
<div className="signLayoutContainer1">
{pdfUrl ? (
<>
<button className={signStyle} disabled={true}>
<span
style={{
fontWeight: "400",
fontSize: "15px",
padding: "3px 20px 0px 20px",
color: "#bfbfbf",
}}
>
Signature
</span>
<img
alt="sign img"
style={{
width: "30px",
height: "28px",
background: "#d3edeb",
}}
src={sign}
/>
</button>
<button className={signStyle} disabled={true}>
<span
style={{
fontWeight: "400",
fontSize: "15px",
padding: "3px 0px 0px 35px",
color: "#bfbfbf",
}}
>
Stamp
</span>
<img
alt="stamp img"
style={{
width: "25px",
height: "28px",
background: "#d3edeb",
}}
src={stamp}
/>
</button>
</>
) : (
<>
<div
ref={(element) => {
dragSignature(element);
if (element) {
signRef.current = element;
// const height = signRef && signRef.current.offsetHeight;
// const width = signRef && signRef.current.offsetWidth;
}
}}
className={signStyle}
onMouseMove={handleDivClick}
onMouseDown={handleMouseLeave}
style={{
opacity: isDragSign ? 0.5 : 1,
boxShadow:
"0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.18)",
}}
>
<span
style={{
fontWeight: "400",
fontSize: "15px",
padding: "3px 20px 0px 20px",
color: "black",
}}
>
Signature
</span>
<img
alt="sign img"
style={{
width: "30px",
height: "28px",
background: themeColor(),
}}
src={sign}
/>
</div>
<div
ref={(element) => {
dragStamp(element);
dragRef.current = element;
if (isDragStamp) {
// setIsStamp(true);
}
}}
className={!pdfUrl ? signStyle : "disableSign"}
disabled={pdfUrl && true}
onMouseMove={handleDivClick}
onMouseDown={handleMouseLeave}
style={{
opacity: isDragStamp ? 0.5 : 1,
boxShadow:
"0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.18)",
}}
>
<span
style={{
fontWeight: "400",
fontSize: "15px",
padding: "3px 0px 0px 35px",
color: !pdfUrl ? "black" : "#bfbfbf",
}}
>
Stamp
</span>
<img
alt="stamp img"
style={{
width: "25px",
height: "28px",
background: themeColor(),
}}
src={stamp}
/>
</div>
</>
)}
</div>
</div>
)}
</>
@@ -32,6 +32,7 @@ function Header({
isShowHeader,
decline,
currentSigner,
dataTut4,
}) {
const isMobile = window.innerWidth < 712;
const navigate = useNavigate();
@@ -74,403 +75,7 @@ function Header({
style={{ paddingBottom: "5px", paddingTop: "5px" }}
className="mobileHead"
>
<div className="signatureHeader headerBtn">
<PrevNext
pageNumber={pageNumber}
allPages={allPages}
changePage={changePage}
/>
{recipient ? (
pdfUrl || isAlreadySign.mssg ? (
<div style={{ display: "flex", flexDirection: "row" }}>
{pdfDetails[0] && pdfDetails.length > 0 && (
// <Certificate
// pdfData={completePdfData}
// />
<PDFDownloadLink
document={<Certificate pdfData={pdfDetails} />}
fileName={`completion certificate-${
pdfDetails[0] && pdfDetails[0].Name
}.pdf`}
>
{({ blob, url, loading, error }) =>
loading ? (
"Loading document..."
) : (
<button
type="button"
className="defaultBtn certificateBtn"
style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
}}
>
<i
class="fa fa-certificate"
style={{
color: "white",
fontSize: "15px",
marginRight: "3px",
}}
aria-hidden="true"
></i>
Certificate
</button>
)
}
</PDFDownloadLink>
)}
<button
onClick={handleToPrint}
style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
}}
className="defaultBtn printBtn"
>
<i
class="fa fa-print"
style={{
fontSize: "15px",
marginRight: "3px",
color: "white",
}}
aria-hidden="true"
></i>
Print
</button>
<button
type="button"
style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
}}
className="defaultBtn downloadBtn"
onClick={() => handleDownloadPdf()}
>
<i
className="fa fa-download"
style={{
color: "white",
fontSize: "15px",
marginRight: "3px",
}}
aria-hidden="true"
></i>
Download
</button>
</div>
) : (
<div style={{ display: "flex", flexDirection: "row" }}>
<button
style={{
background: "#de4337",
}}
className="finishBtn hoverCss"
onClick={() => {
handleDeclinePdfAlert();
}}
>
Decline
</button>
<button
data-tut="reactourThird"
style={{
background: !pdfUrl ? "#188ae2" : "#d3edeb",
}}
className="finishBtn sendHover"
onClick={() => {
if (!pdfUrl) {
embedImages();
}
}}
>
Finish
</button>
</div>
)
) : pdfUrl || (documentStatus && documentStatus.isCompleted) ? (
<div style={{ display: "flex", flexDirection: "row" }}>
<PDFDownloadLink
document={<Certificate pdfData={pdfDetails} />}
fileName={`completion certificate-${
pdfDetails[0] && pdfDetails[0].Name
}.pdf`}
>
{({ blob, url, loading, error }) =>
loading ? (
"Loading document..."
) : (
<button
type="button"
style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
}}
className="defaultBtn certificateBtn"
>
<i
class="fa fa-certificate"
style={{
color: "white",
fontSize: "15px",
marginRight: "3px",
}}
aria-hidden="true"
></i>
Certificate
</button>
)
}
</PDFDownloadLink>
<button
onClick={handleToPrint}
type="button"
style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
}}
className="defaultBtn printBtn"
>
<i
class="fa fa-print"
style={{
fontSize: "15px",
marginRight: "3px",
color: "white",
}}
aria-hidden="true"
></i>
Print
</button>
<button
type="button"
className="defaultBtn downloadBtn"
style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
marginLeft: "10px",
}}
onClick={() => handleDownloadPdf()}
>
<i
className="fa fa-download"
style={{
color: "white",
fontSize: "15px",
marginRight: "3px",
}}
aria-hidden="true"
></i>
Download
</button>
</div>
) : isPlaceholder ? (
<>
{!isMailSend &&
signersdata.Signers &&
signersdata.Signers.length !== signerPos.length && (
<div>
{signerPos.length === 0 ? (
<span style={{ fontSize: "13px", color: "#f5405e" }}>
Add all {signersdata.Signers.length - signerPos.length}{" "}
recipients signature
</span>
) : (
<span style={{ fontSize: "13px", color: "#f5405e" }}>
Add {signersdata.Signers.length - signerPos.length} more
recipients signature
</span>
)}
</div>
)}
<div>
<button
onClick={() => {
navigate(-1);
}}
type="button"
className="defaultBtn backBtn"
>
Back
</button>
<button
data-tut="reactourFour"
style={{
background: !isMailSend ? "#188ae2" : "#d3edeb",
}}
onClick={() => {
alertSendEmail();
}}
className="finishBtn sendHover"
>
Send
</button>
</div>
</>
) : isPdfRequestFiles ? (
isSigned ? (
<div style={{ display: "flex", flexDirection: "row" }}>
{isCompleted.isCertificate && (
<PDFDownloadLink
document={<Certificate pdfData={pdfDetails} />}
fileName={`completion certificate-${
pdfDetails[0] && pdfDetails[0].Name
}.pdf`}
>
{({ blob, url, loading, error }) =>
loading ? (
"Loading document..."
) : (
<button
type="button"
className="defaultBtn certificateBtn"
style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
}}
>
<i
class="fa fa-certificate"
style={{
color: "white",
fontSize: "15px",
marginRight: "3px",
}}
aria-hidden="true"
></i>
Certificate
</button>
)
}
</PDFDownloadLink>
)}
<button
onClick={handleToPrint}
type="button"
className="defaultBtn printBtn"
style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
}}
>
<i
class="fa fa-print"
style={{
fontSize: "15px",
marginRight: "3px",
color: "white",
}}
aria-hidden="true"
></i>
Print
</button>
<button
type="button"
className="defaultBtn downloadBtn"
style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
}}
onClick={() => handleDownloadPdf()}
>
<i
className="fa fa-download"
style={{
color: "white",
fontSize: "15px",
marginRight: "3px",
}}
aria-hidden="true"
></i>
Download
</button>
</div>
) : (
<div>
<button
onClick={() => {
navigate(-1);
}}
type="button"
className="defaultBtn backBtn"
>
Back
</button>
{currentSigner && (
<>
<button
style={{
background: "#de4337",
}}
className="finishBtn hoverCss"
onClick={() => {
handleDeclinePdfAlert();
}}
>
Decline
</button>
<button
style={{
background: "#188ae2",
}}
type="button"
className="finishBtn sendHover"
onClick={() => {
embedImages();
}}
>
Finish
</button>
</>
)}
</div>
)
) : (
<div>
<button
onClick={() => {
navigate(-1);
}}
type="button"
className="defaultBtn backBtn"
>
Back
</button>
<button
style={{
background: "#188ae2",
}}
type="button"
className="finishBtn sendHover"
onClick={() => {
if (!pdfUrl) {
embedImages();
}
}}
>
Finish
</button>
</div>
)}
</div>
{isMobile && isShowHeader && (
{isMobile && isShowHeader ? (
<div
id="navbar"
className="stickyHead"
@@ -530,7 +135,7 @@ function Header({
fontSize: "16px",
}}
>
<i class="fa fa-ellipsis-v" aria-hidden="true"></i>
<i className="fa fa-ellipsis-v" aria-hidden="true"></i>
</div>
</DropdownMenu.Trigger>
@@ -549,7 +154,11 @@ function Header({
flexDirection: "row",
}}
>
<i class="fa fa-arrow-down" aria-hidden="true" style={{marginRight:"2px"}}></i>
<i
className="fa fa-arrow-down"
aria-hidden="true"
style={{ marginRight: "2px" }}
></i>
Download
</div>
</DropdownMenu.Item>
@@ -560,32 +169,31 @@ function Header({
pdfDetails[0] && pdfDetails[0].Name
}.pdf`}
>
{({ blob, url, loading, error }) =>
<>
{console.log("error",error)}
{loading ? (
"Loading document..."
) : (
<div
style={{
display: "flex",
flexDirection: "row",
}}
>
<i
class="fa fa-certificate"
{({ blob, url, loading, error }) => (
<>
{console.log("error", error)}
{loading ? (
"Loading document..."
) : (
<div
style={{
fontSize: "15px",
marginRight: "3px",
display: "flex",
flexDirection: "row",
}}
aria-hidden="true"
></i>
Certificate
</div>
)}
</>
}
>
<i
className="fa fa-certificate"
style={{
fontSize: "15px",
marginRight: "3px",
}}
aria-hidden="true"
></i>
Certificate
</div>
)}
</>
)}
</PDFDownloadLink>
</DropdownMenu.Item>
</DropdownMenu.Content>
@@ -614,44 +222,445 @@ function Header({
Decline
</div>
)}
{isPlaceholder ?(
{isPlaceholder ? (
<div
onClick={() => {
alertSendEmail();
}}
style={{
color: themeColor(),
border: "none",
fontWeight: "650",
fontSize: "16px",
}}
>
Send
</div>
):(
onClick={() => {
if (!isMailSend) {
alertSendEmail();
}
}}
style={{
color: isMailSend ? "gray" : themeColor(),
border: "none",
fontWeight: "650",
fontSize: "16px",
}}
data-tut={dataTut4}
>
Send
</div>
) : (
<div
onClick={() => {
if (!pdfUrl) {
embedImages();
}
}}
style={{
color: themeColor(),
border: "none",
fontWeight: "650",
fontSize: "16px",
}}
>
Finish
</div>
onClick={() => {
if (!pdfUrl) {
embedImages();
}
}}
style={{
color: themeColor(),
border: "none",
fontWeight: "650",
fontSize: "16px",
}}
>
Finish
</div>
)}
</>
)}
</div>
)}
</div>
</div>
) : (
<div className="signatureHeader headerBtn">
<PrevNext
pageNumber={pageNumber}
allPages={allPages}
changePage={changePage}
/>
{recipient ? (
pdfUrl || isAlreadySign.mssg ? (
<div style={{ display: "flex", flexDirection: "row" }}>
{pdfDetails[0] && pdfDetails.length > 0 && (
// <Certificate
// pdfData={completePdfData}
// />
<PDFDownloadLink
document={<Certificate pdfData={pdfDetails} />}
fileName={`completion certificate-${
pdfDetails[0] && pdfDetails[0].Name
}.pdf`}
>
{({ blob, url, loading, error }) =>
loading ? (
"Loading document..."
) : (
<button
type="button"
className="defaultBtn certificateBtn"
style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
}}
>
<i
className="fa fa-certificate"
style={{
color: "white",
fontSize: "15px",
marginRight: "3px",
}}
aria-hidden="true"
></i>
Certificate
</button>
)
}
</PDFDownloadLink>
)}
<button
onClick={handleToPrint}
style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
}}
className="defaultBtn printBtn"
>
<i
className="fa fa-print"
style={{
fontSize: "15px",
marginRight: "3px",
color: "white",
}}
aria-hidden="true"
></i>
Print
</button>
<button
type="button"
style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
}}
className="defaultBtn downloadBtn"
onClick={() => handleDownloadPdf()}
>
<i
className="fa fa-download"
style={{
color: "white",
fontSize: "15px",
marginRight: "3px",
}}
aria-hidden="true"
></i>
Download
</button>
</div>
) : (
<div style={{ display: "flex", flexDirection: "row" }}>
<button
style={{
background: "#de4337",
}}
className="finishBtn hoverCss"
onClick={() => {
handleDeclinePdfAlert();
}}
>
Decline
</button>
<button
data-tut="reactourThird"
style={{
background: !pdfUrl ? "#188ae2" : "#d3edeb",
}}
className="finishBtn sendHover"
onClick={() => {
if (!pdfUrl) {
embedImages();
}
}}
>
Finish
</button>
</div>
)
) : pdfUrl || (documentStatus && documentStatus.isCompleted) ? (
<div style={{ display: "flex", flexDirection: "row" }}>
<PDFDownloadLink
document={<Certificate pdfData={pdfDetails} />}
fileName={`completion certificate-${
pdfDetails[0] && pdfDetails[0].Name
}.pdf`}
>
{({ blob, url, loading, error }) =>
loading ? (
"Loading document..."
) : (
<button
type="button"
style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
}}
className="defaultBtn certificateBtn"
>
<i
className="fa fa-certificate"
style={{
color: "white",
fontSize: "15px",
marginRight: "3px",
}}
aria-hidden="true"
></i>
Certificate
</button>
)
}
</PDFDownloadLink>
<button
onClick={handleToPrint}
type="button"
style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
}}
className="defaultBtn printBtn"
>
<i
className="fa fa-print"
style={{
fontSize: "15px",
marginRight: "3px",
color: "white",
}}
aria-hidden="true"
></i>
Print
</button>
<button
type="button"
className="defaultBtn downloadBtn"
style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
marginLeft: "10px",
}}
onClick={() => handleDownloadPdf()}
>
<i
className="fa fa-download"
style={{
color: "white",
fontSize: "15px",
marginRight: "3px",
}}
aria-hidden="true"
></i>
Download
</button>
</div>
) : isPlaceholder ? (
<>
{!isMailSend &&
signersdata.Signers &&
signersdata.Signers.length !== signerPos.length && (
<div>
{signerPos.length === 0 ? (
<span style={{ fontSize: "13px", color: "#f5405e" }}>
Add all {signersdata.Signers.length - signerPos.length}{" "}
recipients signature
</span>
) : (
<span style={{ fontSize: "13px", color: "#f5405e" }}>
Add {signersdata.Signers.length - signerPos.length} more
recipients signature
</span>
)}
</div>
)}
<div>
<button
onClick={() => {
navigate(-1);
}}
type="button"
className="defaultBtn backBtn"
>
Back
</button>
<button
disabled={isMailSend && true}
data-tut="reactourFour"
style={{
background: isMailSend ? "rgb(203, 203, 203)" : "#188ae2",
color: isMailSend && "rgb(77, 75, 75)",
}}
onClick={() => {
alertSendEmail();
}}
className={isMailSend ? "sendMail" : "sendMail sendHover"}
>
Send
</button>
</div>
</>
) : isPdfRequestFiles ? (
isSigned ? (
<div style={{ display: "flex", flexDirection: "row" }}>
{isCompleted.isCertificate && (
<PDFDownloadLink
document={<Certificate pdfData={pdfDetails} />}
fileName={`completion certificate-${
pdfDetails[0] && pdfDetails[0].Name
}.pdf`}
>
{({ blob, url, loading, error }) =>
loading ? (
"Loading document..."
) : (
<button
type="button"
className="defaultBtn certificateBtn"
style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
}}
>
<i
className="fa fa-certificate"
style={{
color: "white",
fontSize: "15px",
marginRight: "3px",
}}
aria-hidden="true"
></i>
Certificate
</button>
)
}
</PDFDownloadLink>
)}
<button
onClick={handleToPrint}
type="button"
className="defaultBtn printBtn"
style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
}}
>
<i
className="fa fa-print"
style={{
fontSize: "15px",
marginRight: "3px",
color: "white",
}}
aria-hidden="true"
></i>
Print
</button>
<button
type="button"
className="defaultBtn downloadBtn"
style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
}}
onClick={() => handleDownloadPdf()}
>
<i
className="fa fa-download"
style={{
color: "white",
fontSize: "15px",
marginRight: "3px",
}}
aria-hidden="true"
></i>
Download
</button>
</div>
) : (
<div>
<button
onClick={() => {
navigate(-1);
}}
type="button"
className="defaultBtn backBtn"
>
Back
</button>
{currentSigner && (
<>
<button
style={{
background: "#de4337",
}}
className="finishBtn hoverCss"
onClick={() => {
handleDeclinePdfAlert();
}}
>
Decline
</button>
<button
style={{
background: "#188ae2",
}}
type="button"
className="finishBtn sendHover"
onClick={() => {
embedImages();
}}
>
Finish
</button>
</>
)}
</div>
)
) : (
<div>
<button
onClick={() => {
navigate(-1);
}}
type="button"
className="defaultBtn backBtn"
>
Back
</button>
<button
style={{
background: "#188ae2",
}}
type="button"
className="finishBtn sendHover"
onClick={() => {
if (!pdfUrl) {
embedImages();
}
}}
>
Finish
</button>
</div>
)}
</div>
)}
</div>
);
@@ -2,25 +2,42 @@ import React from "react";
import Modal from "react-bootstrap/Modal";
import ModalHeader from "react-bootstrap/esm/ModalHeader";
function ModalComponent({ isShow, type }) {
function ModalComponent({ isShow, type,setIsShowEmail }) {
return (
<Modal show={isShow}>
<ModalHeader className="bg-danger" style={{ color: "white" }}>
{type === "pdfFail" ? (
<span>Failed to load pdf!</span>
) : type === "signersAlert" ? (
<span>Select signers</span>
) : (
<span>Document Expired!</span>
)}
</ModalHeader>
<Modal.Body>
{type === "pdfFail" ? (
<p>Something went wrong failed to load pdf file!</p>
{type === "pdfFail" ? (
<p>Something went wrong failed to load pdf file!</p>
) : type === "signersAlert" ? (
<p>Please select signer for add placeholder!</p>
) : (
<p>This Document is no longer available.</p>
)}
</Modal.Body>
<Modal.Footer>
<button
onClick={() => {
setIsShowEmail(false)
}}
style={{
color: "black",
}}
type="button"
className="finishBtn"
>
Ok
</button>
</Modal.Footer>
</Modal>
);
}
@@ -38,11 +38,12 @@ function RenderPdf({
signerObjectId,
signedSigners,
setPdfLoadFail,
setIsDragging,
placeholder,
}) {
const isMobile = window.innerWidth < 712;
//function for render placeholder block over pdf document
const checkSignedSignes = (data) => {
// console.log("data",data)
const checkSign = signedSigners.filter(
@@ -903,8 +904,12 @@ function RenderPdf({
}}
disableDragging={true}
default={{
x: pos.xPosition,
y: pos.yPosition,
x: pos.scale
? pos.xPosition * pos.scale
: pos.xPosition,
y: pos.scale
? pos.yPosition * pos.scale
: pos.yPosition,
}}
onClick={() => {
setIsSignPad(true);