diff --git a/microfrontends/SignDocuments/src/Component/Certificate/Certificate.js b/microfrontends/SignDocuments/src/Component/Certificate/Certificate.js index 5df07d5f5..37eee4fc3 100644 --- a/microfrontends/SignDocuments/src/Component/Certificate/Certificate.js +++ b/microfrontends/SignDocuments/src/Component/Certificate/Certificate.js @@ -1,7 +1,15 @@ import React, { useEffect, useState } from "react"; import "./certificate.css"; +import opensignLogo from "../../assests/open-sign-logo.png"; -import { Page, Text, View, Document, StyleSheet } from "@react-pdf/renderer"; +import { + Page, + Text, + View, + Document, + StyleSheet, + Image +} from "@react-pdf/renderer"; function Certificate({ pdfData }) { const [isMultiSigners, setIsMultiSigners] = useState(); @@ -49,70 +57,34 @@ function Certificate({ pdfData }) { fontSize: "11px", marginBottom: "10px", color: "gray" + }, + image: { + width: "71px", + height: "17px" } }); const generatedDate = () => { const newDate = new Date(); - const localExpireDate = newDate.toLocaleDateString("en-US", { - day: "numeric", - month: "long", - year: "numeric" - }); - - var currentOffset = newDate.getTimezoneOffset(); - - var ISTOffset = 330; // IST offset UTC +5:30 - - var ISTTime = new Date( - newDate.getTime() + (ISTOffset + currentOffset) * 60000 - ); - - // ISTTime now represents the time in IST coordinates - - var hoursIST = ISTTime.getHours(); - var minutesIST = ISTTime.getMinutes(); + const utcTime = newDate.toUTCString(); return ( - Generated On {localExpireDate} {hoursIST}:{minutesIST} IST + Generated On {utcTime} ); }; const changeCompletedDate = () => { const completedOn = pdfData[0].updatedAt; const newDate = new Date(completedOn); - const localExpireDate = newDate.toLocaleDateString("en-US", { - day: "numeric", - month: "long", - year: "numeric" - }); + const utcTime = newDate.toUTCString(); - var currentOffset = newDate.getTimezoneOffset(); - - var ISTOffset = 330; // IST offset UTC +5:30 - - var ISTTime = new Date( - newDate.getTime() + (ISTOffset + currentOffset) * 60000 - ); - - // ISTTime now represents the time in IST coordinates - - var hoursIST = ISTTime.getHours(); - var minutesIST = ISTTime.getMinutes(); - - return ( - - {localExpireDate} {hoursIST}:{minutesIST} IST - - ); + return {utcTime}; }; const signerName = (data) => { @@ -143,7 +115,19 @@ function Certificate({ pdfData }) { {/** Page defines a single page of content. */} - {generatedDate()} + + + {generatedDate()} + + Organization :   - __ + + {pdfData[0].ExtUserPtr.Company} + Completed on :  {changeCompletedDate()} diff --git a/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js b/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js index d4cb37df9..6591667bc 100644 --- a/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js +++ b/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js @@ -627,8 +627,8 @@ function SignYourSelf() { const bottomY = xyPosData.isDrag ? xyPosData.yBottom * scale - height : xyPosData.firstYPos - ? xyPosData.yBottom * scale - height + xyPosData.firstYPos - : xyPosData.yBottom * scale - height; + ? xyPosData.yBottom * scale - height + xyPosData.firstYPos + : xyPosData.yBottom * scale - height; singleSign = { pdfFile: pdfBase64Url, @@ -664,15 +664,7 @@ function SignYourSelf() { // console.log("json ", json); setPdfUrl(json.result.data); if (json.result.data) { - const docStatus = { - isCompleted: true - }; - - setDocumentStatus(docStatus); - const loadObj = { - isLoad: false - }; - setIsLoading(loadObj); + getDocumentDetails(); } }) .catch((err) => { diff --git a/microfrontends/SignDocuments/src/Component/component/header.js b/microfrontends/SignDocuments/src/Component/component/header.js index 4d971cfb4..d7f4724ed 100644 --- a/microfrontends/SignDocuments/src/Component/component/header.js +++ b/microfrontends/SignDocuments/src/Component/component/header.js @@ -82,13 +82,13 @@ function Header({ //handle download signed pdf const handleDownloadPdf = () => { const pdfName = pdfDetails[0] && pdfDetails[0].Name; - saveAs(pdfUrl, `${sanitizeFileName(pdfName)}_signed_by_OpenSign™.pdf`); + saveAs(pdfUrl, `${sanitizeFileName(pdfName)}_signed_by_OpenSign™.pdf`); }; - + const sanitizeFileName = (pdfName) => { // Replace spaces with underscore - return pdfName.replace(/ /g, '_'); - } + return pdfName.replace(/ /g, "_"); + }; //certificate generate and download component in mobile view const CertificateDropDown = () => { //after generate download certifcate pdf @@ -109,6 +109,7 @@ function Header({ window.URL.revokeObjectURL(url); } }; + return ( e.preventDefault()} @@ -118,7 +119,21 @@ function Header({ {({ blob, url, loading, error }) => ( <> {loading ? ( - "Loading document..." +
+ + Certificate +
) : (
); }; + const CertificateComponent = () => { + return ( + } + fileName={`completion certificate-${ + pdfDetails[0] && pdfDetails[0].Name + }.pdf`} + > + {({ blob, url, loading, error }) => + loading ? ( + + ) : ( + + ) + } + + ); + }; return (
@@ -255,10 +327,12 @@ function Header({ - ) :isSignYourself && ( - - - + ) : ( + isSignYourself && ( + + + + ) )} {pdfDetails[0] && pdfDetails.length > 0 && ( - } - fileName={`completion certificate-${ - pdfDetails[0] && pdfDetails[0].Name - }.pdf`} - > - {({ blob, url, loading, error }) => - loading ? ( - "Loading document..." - ) : ( - - ) - } - + )} - ) - } - - )} + {isCompleted.isCertificate && } - ) - } - +