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