continuing

This commit is contained in:
frankknoll
2023-11-07 12:21:15 +01:00
parent a16478d225
commit 3d5f049965
9 changed files with 459 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
class PageInitializer {
static initializePage({ symptom, vaccine }) {
PageInitializer.#configureSymptom(symptom);
PageInitializer.#configureVaccine(vaccine);
}
static #configureSymptom({ symptomSelectElement, prrByVaccineTableElement, downloadPrrByVaccineTableButton }) {
const prrByVaccineTableView = new PrrByVaccineTableView(prrByVaccineTableElement, downloadPrrByVaccineTableButton);
PageInitializer.#initializeSelectElement(
{
selectElement: symptomSelectElement,
onValueSelected: symptom => prrByVaccineTableView.displayPrrByVaccineTable4Symptom(symptom),
minimumInputLength: 4
});
}
static #configureVaccine({ vaccineSelectElement, prrBySymptomTableElement, downloadPrrBySymptomTableButton }) {
const prrBySymptomTableView = new PrrBySymptomTableView(prrBySymptomTableElement, downloadPrrBySymptomTableButton);
PageInitializer.#initializeSelectElement(
{
selectElement: vaccineSelectElement,
onValueSelected: vaccine => prrBySymptomTableView.displayPrrBySymptomTable4Vaccine(vaccine),
minimumInputLength: 0
});
}
static #initializeSelectElement({ selectElement, onValueSelected, minimumInputLength }) {
selectElement.select2({ minimumInputLength: minimumInputLength });
selectElement.on(
'select2:select',
function (event) {
const value = event.params.data.id;
onValueSelected(value);
});
}
}