Added passport id to PDF
This commit is contained in:
@@ -33,6 +33,7 @@ interface Props {
|
||||
summaryPNG: string;
|
||||
summaryScore: string;
|
||||
groupScoreSummary: any[];
|
||||
passportId: string;
|
||||
}
|
||||
|
||||
const customStyles = StyleSheet.create({
|
||||
@@ -81,6 +82,7 @@ const GroupTestReport = ({
|
||||
summaryPNG,
|
||||
summaryScore,
|
||||
groupScoreSummary,
|
||||
passportId,
|
||||
}: Props) => {
|
||||
const defaultTextStyle = [styles.textFont, { fontSize: 8 }];
|
||||
return (
|
||||
@@ -114,6 +116,7 @@ const GroupTestReport = ({
|
||||
<Text style={defaultTextStyle}>ID: {id}</Text>
|
||||
<Text style={defaultTextStyle}>Email: {email}</Text>
|
||||
<Text style={defaultTextStyle}>Gender: {gender}</Text>
|
||||
<Text style={defaultTextStyle}>Passport ID: {passportId}</Text>
|
||||
<Text style={defaultTextStyle}>
|
||||
Total Number of Students: {numberOfStudents}
|
||||
</Text>
|
||||
|
||||
@@ -27,6 +27,7 @@ interface Props {
|
||||
title: string;
|
||||
summaryPNG: string;
|
||||
summaryScore: string;
|
||||
passportId: string;
|
||||
}
|
||||
|
||||
const TestReport = ({
|
||||
@@ -43,6 +44,7 @@ const TestReport = ({
|
||||
renderDetails,
|
||||
summaryPNG,
|
||||
summaryScore,
|
||||
passportId,
|
||||
}: Props) => {
|
||||
const defaultTextStyle = [styles.textFont, { fontSize: 8 }];
|
||||
const defaultSkillsTextStyle = [styles.textFont, { fontSize: 8 }];
|
||||
@@ -83,6 +85,7 @@ const TestReport = ({
|
||||
<Text style={defaultTextStyle}>ID: {id}</Text>
|
||||
<Text style={defaultTextStyle}>Email: {email}</Text>
|
||||
<Text style={defaultTextStyle}>Gender: {gender}</Text>
|
||||
<Text style={defaultTextStyle}>Passport ID: {passportId}</Text>
|
||||
</View>
|
||||
<View style={{ height: "120px" }}>
|
||||
<Text
|
||||
|
||||
@@ -17,7 +17,7 @@ import ReactPDF from "@react-pdf/renderer";
|
||||
import GroupTestReport from "@/exams/pdf/group.test.report";
|
||||
import { ref, uploadBytes, getDownloadURL } from "firebase/storage";
|
||||
import { Stat } from "@/interfaces/user";
|
||||
import { User } from "@/interfaces/user";
|
||||
import { User, DemographicInformation } from "@/interfaces/user";
|
||||
import { Module } from "@/interfaces";
|
||||
import { ModuleScore, StudentData } from "@/interfaces/module.scores";
|
||||
import { SkillExamDetails } from "@/exams/pdf/details/skill.exam";
|
||||
@@ -346,7 +346,7 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
||||
};
|
||||
|
||||
const groupScoreSummary = getGroupScoreSummary();
|
||||
|
||||
const demographicInformation = user.demographicInformation as DemographicInformation;
|
||||
const pdfStream = await ReactPDF.renderToStream(
|
||||
<GroupTestReport
|
||||
title={title}
|
||||
@@ -354,7 +354,7 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
||||
name={user.name}
|
||||
email={user.email}
|
||||
id={user.id}
|
||||
gender={user.demographicInformation?.gender}
|
||||
gender={demographicInformation?.gender}
|
||||
summary={performanceSummary}
|
||||
renderDetails={details}
|
||||
logo={"public/logo_title.png"}
|
||||
@@ -366,6 +366,7 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
||||
summaryPNG={overallPNG}
|
||||
summaryScore={`${(overallResult * 100).toFixed(0)}%`}
|
||||
groupScoreSummary={groupScoreSummary}
|
||||
passportId={demographicInformation?.passport_id || ''}
|
||||
/>
|
||||
);
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import { sessionOptions } from "@/lib/session";
|
||||
import ReactPDF from "@react-pdf/renderer";
|
||||
import TestReport from "@/exams/pdf/test.report";
|
||||
import { ref, uploadBytes, getDownloadURL } from "firebase/storage";
|
||||
import { User } from "@/interfaces/user";
|
||||
import { DemographicInformation, User } from "@/interfaces/user";
|
||||
import { Module } from "@/interfaces";
|
||||
import { ModuleScore } from "@/interfaces/module.scores";
|
||||
import { SkillExamDetails } from "@/exams/pdf/details/skill.exam";
|
||||
@@ -304,6 +304,7 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
||||
|
||||
const { title, details } = getCustomData();
|
||||
|
||||
const demographicInformation = user.demographicInformation as DemographicInformation;
|
||||
const pdfStream = await ReactPDF.renderToStream(
|
||||
<TestReport
|
||||
title={title}
|
||||
@@ -311,7 +312,7 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
||||
name={user.name}
|
||||
email={user.email}
|
||||
id={user.id}
|
||||
gender={user.demographicInformation?.gender}
|
||||
gender={demographicInformation?.gender}
|
||||
summary={performanceSummary}
|
||||
testDetails={testDetails}
|
||||
renderDetails={details}
|
||||
@@ -319,6 +320,7 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
||||
qrcode={qrcode}
|
||||
summaryPNG={overallPNG}
|
||||
summaryScore={`${(overallResult * 100).toFixed(0)}%`}
|
||||
passportId={demographicInformation?.passport_id || ""}
|
||||
/>
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user