handlich vaccines in UI

This commit is contained in:
frankknoll
2023-10-13 20:57:18 +02:00
parent f28ee6e400
commit 7b78a6f449
7 changed files with 259 additions and 17 deletions

View File

@@ -1,22 +1,37 @@
class PageInitializer {
static initializePage({ symptomSelectElement, prrByVaccineTableElement }) {
static initializePage({ symptom, vaccine }) {
PageInitializer.#configureSymptom(symptom);
PageInitializer.#configureVaccine(vaccine);
}
static #configureSymptom({ symptomSelectElement, prrByVaccineTableElement }) {
const prrByVaccineTableView = new PrrByVaccineTableView(prrByVaccineTableElement);
PageInitializer.#initializeSymptomSelectElement(
PageInitializer.#initializeSelectElement(
{
symptomSelectElement: symptomSelectElement,
onSymptomSelected: symptom => prrByVaccineTableView.displayPrrByVaccineTable4Symptom(symptom)
selectElement: symptomSelectElement,
onValueSelected: symptom => prrByVaccineTableView.displayPrrByVaccineTable4Symptom(symptom),
minimumInputLength: 4
});
}
static #initializeSymptomSelectElement({ symptomSelectElement, onSymptomSelected }) {
symptomSelectElement.select2({ minimumInputLength: 4 });
symptomSelectElement.on(
static #configureVaccine({ vaccineSelectElement, prrBySymptomTableElement }) {
const prrBySymptomTableView = new PrrBySymptomTableView(prrBySymptomTableElement);
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 symptom = event.params.data.id;
onSymptomSelected(symptom);
const value = event.params.data.id;
onValueSelected(value);
});
symptomSelectElement.select2('open');
}
}