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