Unverified Commit d09e0ca6 authored by fOppenheimer's avatar fOppenheimer Committed by GitHub
Browse files

Feat/pdf (#66)

* initial pdf with qrcode as image

* button for generate PDF

* stand before merge

* try to set the font type

* finished second page

* finished first page

* initial third page for recovery

* third page finished

* forth page for vaccination

* forth page for test

* print dotted line
parent 03223fe4
......@@ -469,6 +469,11 @@ hr {
color: $dark;
}
}
.hidden {
display: none;
}
.eu-logo{
margin-left: 1rem;
margin: 13px 0px 13px 16px;
......
......@@ -38,6 +38,7 @@
"patientdata-exclude": "Include patient data in QR-Code",
"patient-data-correction": "Correct patient data",
"process-finish": "Finish process",
"generate-pdf": "Generate PDF",
"qr-code": "QR Code",
"your-certificate": "Your Certificate",
"personal-data": "Personal Details",
......
This diff is collapsed.
......@@ -34,6 +34,7 @@ import { EUDGC } from '../generated-files/dgc-combined-schema';
import genEDGCQR, { CertResult } from '../misc/edgcQRGenerator';
import ShowCertificateData from '../misc/ShowCertificateData';
import usePdfGenerator from './pdf-generater.component';
// import { usePostPatient } from '../api';
......@@ -48,6 +49,9 @@ const ShowCertificate = (props: any) => {
const [tan, setTAN] = React.useState('');
const [qrCodeForPDF, setQrCodeForPDF] = React.useState<any>();
const pdfGenerator = usePdfGenerator(qrCodeForPDF, eudgc);
// set patient data on mount and set hash from uuid
React.useEffect(() => {
if (isInit) {
......@@ -116,6 +120,10 @@ const ShowCertificate = (props: any) => {
}
}
const handleGeneratePdf = () => {
setQrCodeForPDF(document.getElementById('qr-code-pdf'));
}
return (
!(isInit && eudgc && qrCodeValue) ? <Spinner /> :
<>
......@@ -141,6 +149,10 @@ const ShowCertificate = (props: any) => {
{/* <Card.Text className='input-label' >{qrCodeValue}</Card.Text> */}
</> : <></>}
</Container>
<Container id='qr-code-container' className='hidden'>
{qrCodeValue ? <> <QRCode id='qr-code-pdf' size={256} renderAs='canvas' value={qrCodeValue} />
</> : <></>}
</Container>
<Card.Text className='input-label jcc-xs-sm m-3 text-center' >TAN: {tan}</Card.Text>
</Col>
</Row>
......@@ -159,6 +171,15 @@ const ShowCertificate = (props: any) => {
{t('translation:patient-data-correction')}
</Button>
</Col>
<Col xs='6' md='4' className='pl-0 pr-2'>
<Button
className='my-1 my-md-0'
block
onClick={handleGeneratePdf}
>
{t('translation:generate-pdf')}
</Button>
</Col>
<Col xs='6' md='3' className='pr-0 pl-2'>
<Button
className=''
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment