Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rainer Sokoll
Dgca Issuance Web
Commits
30b9d92d
Unverified
Commit
30b9d92d
authored
Oct 27, 2021
by
Gordon Grund
Committed by
GitHub
Oct 27, 2021
Browse files
adjust country-code in pdf to issuer country code (#111)
parent
45daa280
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/components/show-certificate.component.tsx
View file @
30b9d92d
...
...
@@ -54,8 +54,9 @@ const ShowCertificate = (props: any) => {
const
[
qrCodeForPDF
,
setQrCodeForPDF
]
=
React
.
useState
<
any
>
();
const
[
eudgcForPDF
,
setEudgcForPDF
]
=
React
.
useState
<
EUDCC1
>
();
const
[
valueSetsForPDF
,
setValueSetsForPDF
]
=
React
.
useState
<
IValueSetList
>
();
const
[
issuerCountryCodeForPDF
,
setIssuerCountryCodeForPDF
]
=
React
.
useState
(
''
);
const
pdf
=
usePdfGenerator
(
qrCodeForPDF
,
eudgcForPDF
,
valueSetsForPDF
,
(
isInit
)
=>
setPdfIsInit
(
isInit
),
(
isReady
)
=>
setPdfIsReady
(
isReady
));
const
pdf
=
usePdfGenerator
(
qrCodeForPDF
,
eudgcForPDF
,
valueSetsForPDF
,
issuerCountryCodeForPDF
,
(
isInit
)
=>
setPdfIsInit
(
isInit
),
(
isReady
)
=>
setPdfIsReady
(
isReady
));
// set patient data on mount and set hash from uuid
React
.
useEffect
(()
=>
{
...
...
@@ -78,6 +79,7 @@ const ShowCertificate = (props: any) => {
//console.log("qrcode: " + certResult.qrCode);
setQrCodeValue
(
certResult
.
qrCode
);
setTAN
(
certResult
.
tan
);
setIssuerCountryCodeForPDF
(
certResult
.
issuerCountryCode
);
})
.
catch
(
error
=>
{
handleError
(
error
);
...
...
src/misc/edgcQRGenerator.tsx
View file @
30b9d92d
...
...
@@ -34,7 +34,8 @@ const api = axios.create({
export
interface
CertResult
{
qrCode
:
string
,
dgci
:
string
,
tan
:
string
tan
:
string
,
issuerCountryCode
:
string
}
enum
CertType
{
...
...
@@ -114,7 +115,8 @@ const generateQRCode = (edgcPayload: EUDCC1): Promise<CertResult> => {
return
{
qrCode
:
qrCode
,
dgci
:
certMetaData
.
dgci
,
tan
:
tan
tan
:
tan
,
issuerCountryCode
:
certMetaData
.
countryCode
}
});
});
...
...
src/misc/usePdfGenerator.tsx
View file @
30b9d92d
...
...
@@ -93,6 +93,7 @@ const usePdfGenerator = (
qrCodeCanvasElementProp
:
any
,
eudccProp
:
EUDCC1
|
undefined
,
valueSetListProp
:
IValueSetList
|
undefined
,
issuerCountryCodeProp
:
string
,
onIsInit
:
(
isInit
:
boolean
)
=>
void
,
onIsReady
:
(
isReady
:
boolean
)
=>
void
)
=>
{
...
...
@@ -154,6 +155,7 @@ const usePdfGenerator = (
const
[
pdf
,
setPdf
]
=
React
.
useState
<
jsPDF
>
();
const
[
eudcc
,
setEudcc
]
=
React
.
useState
<
EUDCC1
>
();
const
[
issuerCountryCode
,
setIssuerCountryCode
]
=
React
.
useState
(
''
);
const
[
vaccinationSet
,
setVaccinationSet
]
=
React
.
useState
<
VaccinationEntry
>
();
const
[
testSet
,
setTestSet
]
=
React
.
useState
<
TestEntry
>
();
const
[
recoverySet
,
setRecoverySet
]
=
React
.
useState
<
RecoveryEntry
>
();
...
...
@@ -251,6 +253,12 @@ const usePdfGenerator = (
}
},
[
qrCodeCanvasElementProp
])
React
.
useEffect
(()
=>
{
if
(
issuerCountryCodeProp
)
{
setIssuerCountryCode
(
issuerCountryCodeProp
);
}
},
[
issuerCountryCodeProp
])
// set fourth page for vaccination
React
.
useEffect
(()
=>
{
if
(
vaccinationSet
&&
isInit
)
{
...
...
@@ -336,7 +344,7 @@ const usePdfGenerator = (
}
const
prepareFirstPage
=
()
=>
{
if
(
pdf
&&
french
&&
eudcc
&&
co
)
{
if
(
pdf
&&
french
&&
eudcc
&&
issuerCountryCode
)
{
for
(
let
page
=
1
;
page
<
3
;
page
++
)
{
let
x
=
0
;
let
y
=
0
;
...
...
@@ -398,7 +406,7 @@ const usePdfGenerator = (
// pdf.text(pdfParams.issuer_country_code, x, y, { align: 'center' });
// }
pdf
.
text
(
co
,
x
,
y
,
{
align
:
'
center
'
});
pdf
.
text
(
issuerCountryCode
,
x
,
y
,
{
align
:
'
center
'
});
setTextColorBlack
();
pdf
.
setFont
(
'
arial
'
,
'
normal
'
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment