adding downloadPrrBySymptomTableButton
This commit is contained in:
@@ -48,7 +48,8 @@
|
|||||||
},
|
},
|
||||||
vaccine: {
|
vaccine: {
|
||||||
vaccineSelectElement: $('#vaccineSelect'),
|
vaccineSelectElement: $('#vaccineSelect'),
|
||||||
prrBySymptomTableElement: $('#prrBySymptomTable')
|
prrBySymptomTableElement: $('#prrBySymptomTable'),
|
||||||
|
downloadPrrBySymptomTableButton: document.querySelector("#downloadPrrBySymptomTable")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -17811,6 +17812,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
</table>
|
</table>
|
||||||
|
<button id="downloadPrrBySymptomTable">Download</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ class PageInitializer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static #configureVaccine({ vaccineSelectElement, prrBySymptomTableElement }) {
|
static #configureVaccine({ vaccineSelectElement, prrBySymptomTableElement, downloadPrrBySymptomTableButton }) {
|
||||||
const prrBySymptomTableView = new PrrBySymptomTableView(prrBySymptomTableElement);
|
const prrBySymptomTableView = new PrrBySymptomTableView(prrBySymptomTableElement, downloadPrrBySymptomTableButton);
|
||||||
PageInitializer.#initializeSelectElement(
|
PageInitializer.#initializeSelectElement(
|
||||||
{
|
{
|
||||||
selectElement: vaccineSelectElement,
|
selectElement: vaccineSelectElement,
|
||||||
|
|||||||
@@ -1,15 +1,53 @@
|
|||||||
class PrrBySymptomTableView {
|
class PrrBySymptomTableView {
|
||||||
|
|
||||||
#prrBySymptomTable;
|
#prrBySymptomTable;
|
||||||
|
#downloadPrrBySymptomTableButton;
|
||||||
|
#prrBySymptom;
|
||||||
|
#vaccine;
|
||||||
|
|
||||||
constructor(prrBySymptomTableElement) {
|
constructor(prrBySymptomTableElement, downloadPrrBySymptomTableButton) {
|
||||||
this.#prrBySymptomTable = new PrrBySymptomTable(prrBySymptomTableElement);
|
this.#prrBySymptomTable = new PrrBySymptomTable(prrBySymptomTableElement);
|
||||||
this.#prrBySymptomTable.initialize();
|
this.#prrBySymptomTable.initialize();
|
||||||
|
this.#initializeButton(downloadPrrBySymptomTableButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
displayPrrBySymptomTable4Vaccine(vaccine) {
|
displayPrrBySymptomTable4Vaccine(vaccine) {
|
||||||
|
UIUtils.disableButton(this.#downloadPrrBySymptomTableButton);
|
||||||
PrrByVaccineProvider
|
PrrByVaccineProvider
|
||||||
.getPrrBySymptom(vaccine)
|
.getPrrBySymptom(vaccine)
|
||||||
.then(prrBySymptom => this.#prrBySymptomTable.display(prrBySymptom));
|
.then(prrBySymptom => {
|
||||||
|
this.#prrBySymptom = prrBySymptom;
|
||||||
|
this.#vaccine = vaccine;
|
||||||
|
this.#prrBySymptomTable.display(prrBySymptom);
|
||||||
|
UIUtils.enableButton(this.#downloadPrrBySymptomTableButton);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
#initializeButton(downloadPrrBySymptomTableButton) {
|
||||||
|
this.#downloadPrrBySymptomTableButton = downloadPrrBySymptomTableButton;
|
||||||
|
UIUtils.disableButton(downloadPrrBySymptomTableButton);
|
||||||
|
downloadPrrBySymptomTableButton.addEventListener(
|
||||||
|
'click',
|
||||||
|
() => this.#downloadPrrBySymptom())
|
||||||
|
}
|
||||||
|
|
||||||
|
#downloadPrrBySymptom() {
|
||||||
|
UIUtils.downloadUrlAsFilename(
|
||||||
|
window.URL.createObjectURL(
|
||||||
|
new Blob(
|
||||||
|
[
|
||||||
|
PrrByKey2CsvConverter.convertPrrByKey2Csv(
|
||||||
|
{
|
||||||
|
heading: '# Vaccine: ' + this.#vaccine,
|
||||||
|
columns: {
|
||||||
|
keyColumn: 'Symptom',
|
||||||
|
prrColumn: 'Proportional Reporting Ratio > 1'
|
||||||
|
},
|
||||||
|
prrByKey: this.#prrBySymptom
|
||||||
|
})
|
||||||
|
],
|
||||||
|
{ type: 'text/csv' })),
|
||||||
|
this.#vaccine
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user