styling pdf document
This commit is contained in:
@@ -68,7 +68,10 @@
|
||||
downloadPrrBySymptomTableButton: document.querySelector("#downloadPrrBySymptomTable"),
|
||||
valueName: name
|
||||
},
|
||||
pdfButton: document.querySelector("#PDF")
|
||||
pdf: {
|
||||
pdfButton: document.querySelector("#PDF"),
|
||||
valueName: 'Drugs'
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
class PageInitializer {
|
||||
|
||||
static initializePage({ symptom, vaccine, pdfButton }) {
|
||||
static initializePage({ symptom, vaccine, pdf }) {
|
||||
const prrByVaccineTableView = PageInitializer.#configureSymptom(symptom);
|
||||
const prrBySymptomTableView = PageInitializer.#configureVaccine(vaccine);
|
||||
PageInitializer.#configurePDFButton(
|
||||
{
|
||||
pdfButton,
|
||||
pdf,
|
||||
symptom: {
|
||||
selectElement: symptom.symptomSelectElement,
|
||||
table: prrByVaccineTableView.getTable()
|
||||
@@ -47,11 +47,11 @@ class PageInitializer {
|
||||
return prrBySymptomTableView;
|
||||
}
|
||||
|
||||
static #configurePDFButton({ pdfButton, symptom, vaccine }) {
|
||||
static #configurePDFButton({ pdf: { pdfButton, valueName }, symptom, vaccine }) {
|
||||
pdfButton.addEventListener(
|
||||
'click',
|
||||
() => PdfCreator
|
||||
.createPdf({ symptom, vaccine })
|
||||
.createPdf({ symptom, vaccine, valueName })
|
||||
.open());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class PdfCreator {
|
||||
|
||||
static createPdf({ symptom, vaccine }) {
|
||||
static createPdf({ symptom, vaccine, valueName }) {
|
||||
const documentDefinition = {
|
||||
content: [
|
||||
{
|
||||
@@ -10,23 +10,23 @@ class PdfCreator {
|
||||
margin: [0, 0, 0, 20],
|
||||
bold: true
|
||||
},
|
||||
...PdfCreator.#getWorstDrugsSection(symptom),
|
||||
...PdfCreator.#getWorstDrugsSection(symptom, valueName),
|
||||
...PdfCreator.#getStrongestSymptoms(vaccine)
|
||||
]
|
||||
}
|
||||
return pdfMake.createPdf(documentDefinition);
|
||||
}
|
||||
|
||||
static #getWorstDrugsSection({ selectElement, table }) {
|
||||
static #getWorstDrugsSection({ selectElement, table }, valueName) {
|
||||
return [
|
||||
PdfCreator.#getHeading(`Worst Drugs for ${PdfCreator.#getSelection(selectElement)}`),
|
||||
PdfCreator.#getHeading(`Worst ${valueName} for "${PdfCreator.#getSelection(selectElement)}"`),
|
||||
PdfCreator.#getTable(table)
|
||||
];
|
||||
}
|
||||
|
||||
static #getStrongestSymptoms({ selectElement, table }) {
|
||||
return [
|
||||
PdfCreator.#getHeading(`Strongest Symptoms for ${PdfCreator.#getSelection(selectElement)}`),
|
||||
PdfCreator.#getHeading(`Strongest Symptoms for "${PdfCreator.#getSelection(selectElement)}"`),
|
||||
PdfCreator.#getTable(table)
|
||||
];
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user