refactoring

This commit is contained in:
Frank Knoll
2024-07-16 12:33:19 +02:00
parent 4312a81eda
commit bd4c2e04d6

View File

@@ -3,13 +3,7 @@ class PdfCreator {
static createPdf({ symptom, vaccine, heading, valueName }) {
const documentDefinition = {
content: [
{
text: heading,
fontSize: 18,
alignment: 'center',
margin: [0, 0, 0, 20],
bold: true
},
PdfCreator.#getPageHeading(heading),
...PdfCreator.#getWorstDrugsSection(symptom, valueName),
...PdfCreator.#getStrongestSymptoms(vaccine)
]
@@ -17,6 +11,16 @@ class PdfCreator {
return pdfMake.createPdf(documentDefinition);
}
static #getPageHeading(heading) {
return {
text: heading,
fontSize: 18,
alignment: 'center',
margin: [0, 0, 0, 20],
bold: true
};
}
static #getWorstDrugsSection({ selectElement, table }, valueName) {
return [
PdfCreator.#getHeading(`Worst ${valueName} for "${PdfCreator.#getSelection(selectElement)}"`),