refactoring
This commit is contained in:
@@ -64,7 +64,7 @@
|
|||||||
pdf: {
|
pdf: {
|
||||||
pdfButton: document.querySelector("#PDF"),
|
pdfButton: document.querySelector("#PDF"),
|
||||||
heading: document.querySelector("#heading").textContent,
|
heading: document.querySelector("#heading").textContent,
|
||||||
valueName: document.querySelector("#subheading").textContent
|
subheading: document.querySelector("#subheading").textContent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -47,11 +47,11 @@ class PageInitializer {
|
|||||||
return prrBySymptomTableView;
|
return prrBySymptomTableView;
|
||||||
}
|
}
|
||||||
|
|
||||||
static #configurePDFButton({ pdf: { pdfButton, heading, valueName }, symptom, vaccine }) {
|
static #configurePDFButton({ pdf: { pdfButton, heading, subheading }, symptom, vaccine }) {
|
||||||
pdfButton.addEventListener(
|
pdfButton.addEventListener(
|
||||||
'click',
|
'click',
|
||||||
() => PdfCreator
|
() => PdfCreator
|
||||||
.createPdf({ symptom, vaccine, heading, valueName })
|
.createPdf({ symptom, vaccine, heading, subheading })
|
||||||
.download(heading));
|
.download(heading));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ class PdfCreator {
|
|||||||
return pdfMake.createPdf(PdfCreator.#createDocumentDefinition(pdf));
|
return pdfMake.createPdf(PdfCreator.#createDocumentDefinition(pdf));
|
||||||
}
|
}
|
||||||
|
|
||||||
static #createDocumentDefinition({ symptom, vaccine, heading, valueName }) {
|
static #createDocumentDefinition({ symptom, vaccine, heading, subheading }) {
|
||||||
return {
|
return {
|
||||||
content: [
|
content: [
|
||||||
PdfCreator.#getPageHeading(heading),
|
PdfCreator.#getPageHeading(heading),
|
||||||
{ text: 'By Craig Paardekooper', alignment: 'center', margin: [0, 0, 0, 20] },
|
{ text: 'By Craig Paardekooper', alignment: 'center', margin: [0, 0, 0, 20] },
|
||||||
...PdfCreator.#getAssociatedDrugsSection(symptom, valueName),
|
...PdfCreator.#getAssociatedDrugsSection(symptom, subheading),
|
||||||
...PdfCreator.#getStrongestSymptomsSection(vaccine),
|
...PdfCreator.#getStrongestSymptomsSection(vaccine),
|
||||||
PdfCreator.#link2Origin(heading)
|
PdfCreator.#link2Origin(heading)
|
||||||
]
|
]
|
||||||
@@ -26,9 +26,9 @@ class PdfCreator {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static #getAssociatedDrugsSection({ selectElement, table }, valueName) {
|
static #getAssociatedDrugsSection({ selectElement, table }, subheading) {
|
||||||
return [
|
return [
|
||||||
PdfCreator.#getHeading(`${valueName} for "${PdfCreator.#getSelection(selectElement)}"`),
|
PdfCreator.#getHeading(`${subheading} for "${PdfCreator.#getSelection(selectElement)}"`),
|
||||||
PdfCreator.#getTable(table, true)
|
PdfCreator.#getTable(table, true)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
pdf: {
|
pdf: {
|
||||||
pdfButton: document.querySelector("#PDF"),
|
pdfButton: document.querySelector("#PDF"),
|
||||||
heading: document.querySelector("#heading").textContent,
|
heading: document.querySelector("#heading").textContent,
|
||||||
valueName: document.querySelector("#subheading").textContent
|
subheading: document.querySelector("#subheading").textContent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user