starting to make prrByVaccineTable downloadable
This commit is contained in:
@@ -1,15 +1,34 @@
|
||||
class PrrByVaccineTableView {
|
||||
|
||||
#prrByVaccineTable;
|
||||
#prrByVaccine;
|
||||
#symptom;
|
||||
|
||||
constructor(prrByVaccineTableElement) {
|
||||
constructor(prrByVaccineTableElement, downloadPrrByVaccineTableButton) {
|
||||
this.#prrByVaccineTable = new PrrByVaccineTable(prrByVaccineTableElement);
|
||||
this.#prrByVaccineTable.initialize();
|
||||
downloadPrrByVaccineTableButton.addEventListener(
|
||||
'click',
|
||||
() => this.#downloadPrrByVaccine())
|
||||
}
|
||||
|
||||
displayPrrByVaccineTable4Symptom(symptom) {
|
||||
PrrByVaccineProvider
|
||||
.getPrrByVaccine(symptom)
|
||||
.then(prrByVaccine => this.#prrByVaccineTable.display(prrByVaccine));
|
||||
.then(prrByVaccine => {
|
||||
this.#prrByVaccine = prrByVaccine;
|
||||
this.#symptom = symptom;
|
||||
this.#prrByVaccineTable.display(prrByVaccine);
|
||||
});
|
||||
}
|
||||
|
||||
#downloadPrrByVaccine() {
|
||||
UIUtils.downloadUrlAsFilename(
|
||||
window.URL.createObjectURL(
|
||||
new Blob(
|
||||
[Utils.convertDict2CSV(this.#prrByVaccine)],
|
||||
{ type: 'text/csv' })),
|
||||
this.#symptom
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user