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