enabling and disabling downloadPrrByVaccineTableButton
This commit is contained in:
@@ -1,27 +1,36 @@
|
|||||||
class PrrByVaccineTableView {
|
class PrrByVaccineTableView {
|
||||||
|
|
||||||
#prrByVaccineTable;
|
#prrByVaccineTable;
|
||||||
|
#downloadPrrByVaccineTableButton;
|
||||||
#prrByVaccine;
|
#prrByVaccine;
|
||||||
#symptom;
|
#symptom;
|
||||||
|
|
||||||
constructor(prrByVaccineTableElement, downloadPrrByVaccineTableButton) {
|
constructor(prrByVaccineTableElement, downloadPrrByVaccineTableButton) {
|
||||||
this.#prrByVaccineTable = new PrrByVaccineTable(prrByVaccineTableElement);
|
this.#prrByVaccineTable = new PrrByVaccineTable(prrByVaccineTableElement);
|
||||||
this.#prrByVaccineTable.initialize();
|
this.#prrByVaccineTable.initialize();
|
||||||
downloadPrrByVaccineTableButton.addEventListener(
|
this.#initializeButton(downloadPrrByVaccineTableButton);
|
||||||
'click',
|
|
||||||
() => this.#downloadPrrByVaccine())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
displayPrrByVaccineTable4Symptom(symptom) {
|
displayPrrByVaccineTable4Symptom(symptom) {
|
||||||
|
UIUtils.disableButton(this.#downloadPrrByVaccineTableButton);
|
||||||
PrrByVaccineProvider
|
PrrByVaccineProvider
|
||||||
.getPrrByVaccine(symptom)
|
.getPrrByVaccine(symptom)
|
||||||
.then(prrByVaccine => {
|
.then(prrByVaccine => {
|
||||||
this.#prrByVaccine = prrByVaccine;
|
this.#prrByVaccine = prrByVaccine;
|
||||||
this.#symptom = symptom;
|
this.#symptom = symptom;
|
||||||
this.#prrByVaccineTable.display(prrByVaccine);
|
this.#prrByVaccineTable.display(prrByVaccine);
|
||||||
|
UIUtils.enableButton(this.#downloadPrrByVaccineTableButton);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#initializeButton(downloadPrrByVaccineTableButton) {
|
||||||
|
this.#downloadPrrByVaccineTableButton = downloadPrrByVaccineTableButton;
|
||||||
|
UIUtils.disableButton(downloadPrrByVaccineTableButton);
|
||||||
|
downloadPrrByVaccineTableButton.addEventListener(
|
||||||
|
'click',
|
||||||
|
() => this.#downloadPrrByVaccine())
|
||||||
|
}
|
||||||
|
|
||||||
#downloadPrrByVaccine() {
|
#downloadPrrByVaccine() {
|
||||||
UIUtils.downloadUrlAsFilename(
|
UIUtils.downloadUrlAsFilename(
|
||||||
window.URL.createObjectURL(
|
window.URL.createObjectURL(
|
||||||
|
|||||||
@@ -1,5 +1,21 @@
|
|||||||
class UIUtils {
|
class UIUtils {
|
||||||
|
|
||||||
|
static show(element) {
|
||||||
|
element.style.display = "block";
|
||||||
|
}
|
||||||
|
|
||||||
|
static hide(element) {
|
||||||
|
element.style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
static disableButton(button) {
|
||||||
|
button.disabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static enableButton(button) {
|
||||||
|
button.disabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
static instantiateTemplate(templateId) {
|
static instantiateTemplate(templateId) {
|
||||||
return document.getElementById(templateId).content.firstElementChild.cloneNode(true);
|
return document.getElementById(templateId).content.firstElementChild.cloneNode(true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user