adding downloadPrrBySymptomTableButton
This commit is contained in:
@@ -48,7 +48,8 @@
|
||||
},
|
||||
vaccine: {
|
||||
vaccineSelectElement: $('#vaccineSelect'),
|
||||
prrBySymptomTableElement: $('#prrBySymptomTable')
|
||||
prrBySymptomTableElement: $('#prrBySymptomTable'),
|
||||
downloadPrrBySymptomTableButton: document.querySelector("#downloadPrrBySymptomTable")
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -17811,6 +17812,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<button id="downloadPrrBySymptomTable">Download</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -15,8 +15,8 @@ class PageInitializer {
|
||||
});
|
||||
}
|
||||
|
||||
static #configureVaccine({ vaccineSelectElement, prrBySymptomTableElement }) {
|
||||
const prrBySymptomTableView = new PrrBySymptomTableView(prrBySymptomTableElement);
|
||||
static #configureVaccine({ vaccineSelectElement, prrBySymptomTableElement, downloadPrrBySymptomTableButton }) {
|
||||
const prrBySymptomTableView = new PrrBySymptomTableView(prrBySymptomTableElement, downloadPrrBySymptomTableButton);
|
||||
PageInitializer.#initializeSelectElement(
|
||||
{
|
||||
selectElement: vaccineSelectElement,
|
||||
|
||||
@@ -1,15 +1,53 @@
|
||||
class PrrBySymptomTableView {
|
||||
|
||||
#prrBySymptomTable;
|
||||
#downloadPrrBySymptomTableButton;
|
||||
#prrBySymptom;
|
||||
#vaccine;
|
||||
|
||||
constructor(prrBySymptomTableElement) {
|
||||
constructor(prrBySymptomTableElement, downloadPrrBySymptomTableButton) {
|
||||
this.#prrBySymptomTable = new PrrBySymptomTable(prrBySymptomTableElement);
|
||||
this.#prrBySymptomTable.initialize();
|
||||
this.#initializeButton(downloadPrrBySymptomTableButton);
|
||||
}
|
||||
|
||||
displayPrrBySymptomTable4Vaccine(vaccine) {
|
||||
UIUtils.disableButton(this.#downloadPrrBySymptomTableButton);
|
||||
PrrByVaccineProvider
|
||||
.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