diff --git a/apps/OpenSign/src/components/pdf/PdfHeader.js b/apps/OpenSign/src/components/pdf/PdfHeader.js index 075945526..419983798 100644 --- a/apps/OpenSign/src/components/pdf/PdfHeader.js +++ b/apps/OpenSign/src/components/pdf/PdfHeader.js @@ -40,7 +40,7 @@ function Header({ signerPos && signerPos?.filter((data) => data.Role !== "prefill"); const isMobile = window.innerWidth < 767; const navigate = useNavigate(); - const [isCertificate, setIsCertificate] = useState(false); + const [isDownloading, setIsDownloading] = useState(""); const isGuestSigner = localStorage.getItem("isGuestSigner"); //for go to previous page function previousPage() { @@ -131,7 +131,9 @@ function Header({ > handleDownloadPdf(pdfDetails, pdfUrl)} + onClick={() => + handleDownloadPdf(pdfDetails, pdfUrl, setIsDownloading) + } >
handleDownloadCertificate( pdfDetails, - setIsCertificate + setIsDownloading ) } > @@ -194,7 +196,9 @@ function Header({ )} handleToPrint(e, pdfUrl)} + onClick={(e) => + handleToPrint(e, pdfUrl, setIsDownloading) + } >
- handleDownloadPdf(pdfDetails, pdfUrl) + handleDownloadPdf( + pdfDetails, + pdfUrl, + setIsDownloading + ) } > - handleDownloadCertificate(pdfDetails, setIsCertificate) + handleDownloadCertificate(pdfDetails, setIsDownloading) } className="flex flex-row items-center shadow rounded-[3px] py-[3px] px-[11px] text-white font-[500] text-[13px] mr-[5px] bg-[#08bc66]" > @@ -379,7 +387,7 @@ function Header({ )} )}
)} + {isDownloading === "pdf" && ( +
+
+
+ )} setIsCertificate(false)} + isOpen={isDownloading === "certificate"} + title={ + isDownloading === "certificate" + ? "Generating certificate" + : "PDF Download" + } + handleClose={() => setIsDownloading("")} >
+ {isDownloading === "certificate"}{" "}

Your completion certificate is being generated. Please wait momentarily. diff --git a/apps/OpenSign/src/constant/Utils.js b/apps/OpenSign/src/constant/Utils.js index 7cb9be16b..147d360d2 100644 --- a/apps/OpenSign/src/constant/Utils.js +++ b/apps/OpenSign/src/constant/Utils.js @@ -2034,8 +2034,13 @@ export const handleSendOTP = async (email) => { } }; //handle download signed pdf -export const handleDownloadPdf = async (pdfDetails, pdfUrl) => { +export const handleDownloadPdf = async ( + pdfDetails, + pdfUrl, + setIsDownloading +) => { const pdfName = pdfDetails[0] && pdfDetails[0].Name; + setIsDownloading("pdf"); try { // const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl }); const axiosRes = await axios.post( @@ -2051,8 +2056,10 @@ export const handleDownloadPdf = async (pdfDetails, pdfUrl) => { ); const url = axiosRes.data.result; saveAs(url, `${sanitizeFileName(pdfName)}_signed_by_OpenSign™.pdf`); + setIsDownloading(""); } catch (err) { console.log("err in getsignedurl", err); + setIsDownloading(""); alert("something went wrong, please try again later."); } }; @@ -2062,9 +2069,9 @@ export const sanitizeFileName = (pdfName) => { return pdfName.replace(/ /g, "_"); }; //function for print digital sign pdf -export const handleToPrint = async (event, pdfUrl) => { +export const handleToPrint = async (event, pdfUrl, setIsDownloading) => { event.preventDefault(); - + setIsDownloading("pdf"); try { // const url = await Parse.Cloud.run("getsignedurl", { url: pdfUrl }); const axiosRes = await axios.post( @@ -2094,10 +2101,13 @@ export const handleToPrint = async (event, pdfUrl) => { const blob = new Blob([byteArray], { type: "application/pdf" }); const blobUrl = URL.createObjectURL(blob); window.open(blobUrl, "_blank"); + setIsDownloading(""); } else { printModule({ printable: pdf, type: "pdf", base64: true }); + setIsDownloading(""); } } catch (err) { + setIsDownloading(""); console.log("err in getsignedurl", err); alert("something went wrong, please try again later."); } @@ -2106,7 +2116,7 @@ export const handleToPrint = async (event, pdfUrl) => { //handle download signed pdf export const handleDownloadCertificate = async ( pdfDetails, - setIsCertificate + setIsDownloading ) => { if (pdfDetails?.length > 0 && pdfDetails[0]?.CertificateUrl) { try { @@ -2117,7 +2127,7 @@ export const handleDownloadCertificate = async ( console.log("err in download in certificate", err); } } else { - setIsCertificate(true); + setIsDownloading("certificate"); try { const data = { docId: pdfDetails[0]?.objectId @@ -2139,9 +2149,9 @@ export const handleDownloadCertificate = async ( await fetch(doc?.CertificateUrl); const certificateUrl = doc?.CertificateUrl; saveAs(certificateUrl, `Certificate_signed_by_OpenSign™.pdf`); - setIsCertificate(false); + setIsDownloading(""); } else { - setIsCertificate(true); + setIsDownloading("certificate"); } } } catch (err) { @@ -2150,7 +2160,7 @@ export const handleDownloadCertificate = async ( } } }; - export async function findContact(value) { +export async function findContact(value) { try { const currentUser = Parse.User.current(); const contactbook = new Parse.Query("contracts_Contactbook"); diff --git a/apps/OpenSign/src/json/ReportJson.js b/apps/OpenSign/src/json/ReportJson.js index 705ce8fb9..e0cceda69 100644 --- a/apps/OpenSign/src/json/ReportJson.js +++ b/apps/OpenSign/src/json/ReportJson.js @@ -3,7 +3,7 @@ export default function reportJson(id) { const head = ["Sr.No", "Title", "Note", "Folder", "File", "Owner", "Signers"]; const contactbook = ["Sr.No", "Title", "Email", "Phone"]; const dashboardReportHead = ["Title", "File", "Owner", "Signers"]; - const templateReport = ["Sr.No", "Title", "File", "Owner", "Signers"]; + const templateReport = ["Sr.No", "Title", "File", "Owner", "Roles"]; switch (id) { // draft documents report case "ByHuevtCFY": diff --git a/apps/OpenSign/src/pages/PdfRequestFiles.js b/apps/OpenSign/src/pages/PdfRequestFiles.js index eeaf852a8..505b4b493 100644 --- a/apps/OpenSign/src/pages/PdfRequestFiles.js +++ b/apps/OpenSign/src/pages/PdfRequestFiles.js @@ -95,7 +95,7 @@ function PdfRequestFiles() { const [expiredDate, setExpiredDate] = useState(""); const [signerUserId, setSignerUserId] = useState(); const [isDontShow, setIsDontShow] = useState(false); - const [isCertificate, setIsCertificate] = useState(false); + const [isDownloading, setIsDownloading] = useState(""); const [defaultSignAlert, setDefaultSignAlert] = useState({ isShow: false, alertMessage: "" @@ -787,7 +787,10 @@ function PdfRequestFiles() { (x) => x.Email === jsonSender.email ); const newIndex = index + 1; - const user = pdfDetails?.[0].Signers[newIndex]; + const usermail = { + Email: pdfDetails?.[0]?.Placeholders[newIndex]?.email || "" + }; + const user = usermail || pdfDetails?.[0]?.Signers[newIndex]; if (sendmail !== "false" && sendInOrder) { const requestBody = pdfDetails?.[0]?.RequestBody; const requestSubject = pdfDetails?.[0]?.RequestSubject; @@ -1588,7 +1591,7 @@ function PdfRequestFiles() { onClick={() => handleDownloadCertificate( pdfDetails, - setIsCertificate + setIsDownloading ) } className="flex flex-row items-center shadow rounded-[3px] py-[3px] px-[11px] text-white font-[500] text-[13px] mr-[5px] bg-[#08bc66]" @@ -1602,7 +1605,9 @@ function PdfRequestFiles() { + ) : ( + "-" + )} {props.actions?.length > 0 && @@ -865,19 +884,21 @@ const ReportTable = (props) => { )} {isOption[item.objectId] && act.action === "option" && ( -

+
{act.subaction?.map((subact) => (
handleActionBtn(subact, item) } title={subact.hoverLabel} > - + {subact.btnLabel && ( - + {subact.btnLabel} )} @@ -887,6 +908,48 @@ const ReportTable = (props) => { )} ))} + {isViewShare[item.objectId] && ( +
+
+
setIsViewShare({})} + > + × +
+ + + + + {props.ReportName === "Templates" && ( + + )} + + + + + {item.Placeholders.map((x, i) => ( + + {props.ReportName === "Templates" && ( + + )} + + + ))} + +
RolesSigners
+ {x.Role && x.Role} + + {x.email + ? x.email + : x?.signerPtr?.Email || "-"} +
+
+
+ )} {isDeleteModal[item.objectId] && (