refactoring
This commit is contained in:
@@ -10,8 +10,8 @@ class PageInitializer {
|
||||
PageInitializer.#initializeSelectElement(
|
||||
{
|
||||
selectElement: symptomSelectElement,
|
||||
onValueSelected: symptom => prrByVaccineTableView.displayPrrByVaccineTable4Symptom(symptom),
|
||||
minimumInputLength: 4
|
||||
onValueSelected: (id, text) => prrByVaccineTableView.displayPrrByVaccineTable4Symptom(id, text),
|
||||
minimumInputLength: 0
|
||||
});
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class PageInitializer {
|
||||
PageInitializer.#initializeSelectElement(
|
||||
{
|
||||
selectElement: vaccineSelectElement,
|
||||
onValueSelected: vaccine => prrBySymptomTableView.displayPrrBySymptomTable4Vaccine(vaccine),
|
||||
onValueSelected: (id, text) => prrBySymptomTableView.displayPrrBySymptomTable4Vaccine(id ,text),
|
||||
minimumInputLength: 0
|
||||
});
|
||||
}
|
||||
@@ -30,8 +30,9 @@ class PageInitializer {
|
||||
selectElement.on(
|
||||
'select2:select',
|
||||
function (event) {
|
||||
const value = event.params.data.id;
|
||||
onValueSelected(value);
|
||||
const id = event.params.data.id;
|
||||
const text = event.params.data.text;
|
||||
onValueSelected(id, text);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ class PrrByKeyTableView {
|
||||
|
||||
#prrByKeyTable;
|
||||
#downloadPrrByKeyTableButton;
|
||||
#value;
|
||||
#text;
|
||||
#valueName;
|
||||
#prrByKeyProvider;
|
||||
|
||||
@@ -14,11 +14,11 @@ class PrrByKeyTableView {
|
||||
this.#prrByKeyProvider = prrByKeyProvider;
|
||||
}
|
||||
|
||||
displayPrrByKeyTable4Value(value) {
|
||||
displayPrrByKeyTable4Value(id, text) {
|
||||
UIUtils.disableButton(this.#downloadPrrByKeyTableButton);
|
||||
this.#prrByKeyProvider(value)
|
||||
this.#prrByKeyProvider(id)
|
||||
.then(prrByKey => {
|
||||
this.#value = value;
|
||||
this.#text = text;
|
||||
this.#prrByKeyTable.display(prrByKey);
|
||||
UIUtils.enableButton(this.#downloadPrrByKeyTableButton);
|
||||
});
|
||||
@@ -36,9 +36,8 @@ class PrrByKeyTableView {
|
||||
UIUtils.downloadUrlAsFilename(
|
||||
window.URL.createObjectURL(
|
||||
new Blob(
|
||||
[this.#prrByKeyTable.getDisplayedTableAsCsv(`# ${this.#valueName}: ${this.#value}`)],
|
||||
[this.#prrByKeyTable.getDisplayedTableAsCsv(`# ${this.#valueName}: ${this.#text}`)],
|
||||
{ type: 'text/csv' })),
|
||||
this.#value
|
||||
);
|
||||
this.#text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ class PrrBySymptomTableView {
|
||||
PrrByVaccineProvider.getPrrBySymptom);
|
||||
}
|
||||
|
||||
displayPrrBySymptomTable4Vaccine(vaccine) {
|
||||
this.#delegate.displayPrrByKeyTable4Value(vaccine);
|
||||
displayPrrBySymptomTable4Vaccine(id, text) {
|
||||
this.#delegate.displayPrrByKeyTable4Value(id, text);
|
||||
}
|
||||
|
||||
#createPrrBySymptomTable(tableElement) {
|
||||
|
||||
@@ -10,8 +10,8 @@ class PrrByVaccineTableView {
|
||||
PrrByVaccineProvider.getPrrByVaccine);
|
||||
}
|
||||
|
||||
displayPrrByVaccineTable4Symptom(symptom) {
|
||||
this.#delegate.displayPrrByKeyTable4Value(symptom);
|
||||
displayPrrByVaccineTable4Symptom(id, text) {
|
||||
this.#delegate.displayPrrByKeyTable4Value(id, text);
|
||||
}
|
||||
|
||||
#createPrrByVaccineTable(tableElement) {
|
||||
|
||||
Reference in New Issue
Block a user