Skip to content

Commit a144542

Browse files
fix Completion certificate issues (#184)
1 parent 0d8767e commit a144542

File tree

4 files changed

+125
-174
lines changed

4 files changed

+125
-174
lines changed

microfrontends/SignDocuments/src/Component/Certificate/Certificate.js

Lines changed: 34 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
import React, { useEffect, useState } from "react";
22
import "./certificate.css";
3+
import opensignLogo from "../../assests/open-sign-logo.png";
34

4-
import { Page, Text, View, Document, StyleSheet } from "@react-pdf/renderer";
5+
import {
6+
Page,
7+
Text,
8+
View,
9+
Document,
10+
StyleSheet,
11+
Image
12+
} from "@react-pdf/renderer";
513

614
function Certificate({ pdfData }) {
715
const [isMultiSigners, setIsMultiSigners] = useState();
@@ -49,70 +57,34 @@ function Certificate({ pdfData }) {
4957
fontSize: "11px",
5058
marginBottom: "10px",
5159
color: "gray"
60+
},
61+
image: {
62+
width: "71px",
63+
height: "17px"
5264
}
5365
});
5466

5567
const generatedDate = () => {
5668
const newDate = new Date();
57-
const localExpireDate = newDate.toLocaleDateString("en-US", {
58-
day: "numeric",
59-
month: "long",
60-
year: "numeric"
61-
});
62-
63-
var currentOffset = newDate.getTimezoneOffset();
64-
65-
var ISTOffset = 330; // IST offset UTC +5:30
66-
67-
var ISTTime = new Date(
68-
newDate.getTime() + (ISTOffset + currentOffset) * 60000
69-
);
70-
71-
// ISTTime now represents the time in IST coordinates
72-
73-
var hoursIST = ISTTime.getHours();
74-
var minutesIST = ISTTime.getMinutes();
69+
const utcTime = newDate.toUTCString();
7570

7671
return (
7772
<Text
7873
style={{
79-
textAlign: "right",
8074
color: "gray",
81-
fontSize: "10px",
82-
marginBottom: "30px"
75+
fontSize: "10px"
8376
}}
8477
>
85-
Generated On {localExpireDate} {hoursIST}:{minutesIST} IST
78+
Generated On {utcTime}
8679
</Text>
8780
);
8881
};
8982
const changeCompletedDate = () => {
9083
const completedOn = pdfData[0].updatedAt;
9184
const newDate = new Date(completedOn);
92-
const localExpireDate = newDate.toLocaleDateString("en-US", {
93-
day: "numeric",
94-
month: "long",
95-
year: "numeric"
96-
});
97-
98-
var currentOffset = newDate.getTimezoneOffset();
85+
const utcTime = newDate.toUTCString();
9986

100-
var ISTOffset = 330; // IST offset UTC +5:30
101-
102-
var ISTTime = new Date(
103-
newDate.getTime() + (ISTOffset + currentOffset) * 60000
104-
);
105-
106-
// ISTTime now represents the time in IST coordinates
107-
108-
var hoursIST = ISTTime.getHours();
109-
var minutesIST = ISTTime.getMinutes();
110-
111-
return (
112-
<Text style={styles.textStyle2}>
113-
{localExpireDate} {hoursIST}:{minutesIST} IST
114-
</Text>
115-
);
87+
return <Text style={styles.textStyle2}>{utcTime}</Text>;
11688
};
11789

11890
const signerName = (data) => {
@@ -143,7 +115,19 @@ function Certificate({ pdfData }) {
143115
{/** Page defines a single page of content. */}
144116
<Page size="A4" style={styles.page}>
145117
<View style={styles.section1}>
146-
{generatedDate()}
118+
<View
119+
style={{
120+
display: "flex",
121+
flexDirection: "row",
122+
justifyContent: "space-between",
123+
alignItems: "center",
124+
marginBottom: "30px"
125+
}}
126+
>
127+
<Image src={opensignLogo} style={styles.image} />
128+
{generatedDate()}
129+
</View>
130+
147131
<View style={{ justifyContent: "center" }}>
148132
<Text
149133
style={{
@@ -182,7 +166,9 @@ function Certificate({ pdfData }) {
182166
</Text>
183167
<Text style={styles.textStyle}>
184168
Organization : &nbsp;
185-
<Text style={styles.textStyle2}>__</Text>
169+
<Text style={styles.textStyle2}>
170+
{pdfData[0].ExtUserPtr.Company}
171+
</Text>
186172
</Text>
187173
<Text style={styles.textStyle}>
188174
Completed on : &nbsp;{changeCompletedDate()}

microfrontends/SignDocuments/src/Component/SignYourselfPdf.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,8 @@ function SignYourSelf() {
627627
const bottomY = xyPosData.isDrag
628628
? xyPosData.yBottom * scale - height
629629
: xyPosData.firstYPos
630-
? xyPosData.yBottom * scale - height + xyPosData.firstYPos
631-
: xyPosData.yBottom * scale - height;
630+
? xyPosData.yBottom * scale - height + xyPosData.firstYPos
631+
: xyPosData.yBottom * scale - height;
632632

633633
singleSign = {
634634
pdfFile: pdfBase64Url,
@@ -664,15 +664,7 @@ function SignYourSelf() {
664664
// console.log("json ", json);
665665
setPdfUrl(json.result.data);
666666
if (json.result.data) {
667-
const docStatus = {
668-
isCompleted: true
669-
};
670-
671-
setDocumentStatus(docStatus);
672-
const loadObj = {
673-
isLoad: false
674-
};
675-
setIsLoading(loadObj);
667+
getDocumentDetails();
676668
}
677669
})
678670
.catch((err) => {

0 commit comments

Comments
 (0)