refactoring

This commit is contained in:
Frank Knoll
2024-07-14 01:41:55 +02:00
parent d8e63b2a7c
commit b143949798
2 changed files with 23 additions and 4 deletions

View File

@@ -35,26 +35,29 @@
<script src="./js/PrrByKeyTableView.js"></script>
<script src="./js/PrrByVaccineTableView.js"></script>
<script src="./js/PrrBySymptomTableView.js"></script>
<script src="./js/SearchParam.js"></script>
<script src="./js/Select2.js"></script>
<script>
document.addEventListener(
"DOMContentLoaded",
event => {
const name = 'Drug';
const symptomSearchParam = new SearchParam('symptom');
const vaccineSearchParam = new SearchParam('vaccine');
PageInitializer.initializePage(
{
symptom: {
symptomSelectElement: $('#symptomSelect'),
selectSymptom: UIUtils.getSearchParamOfCurrentUrl('symptom'),
onSymptomSelected: symptom => UIUtils.setSearchParamOfCurrentUrl('symptom', symptom),
selectSymptom: symptomSearchParam.get(),
onSymptomSelected: symptom => symptomSearchParam.set(symptom),
prrByVaccineTableElement: $('#prrByVaccineTable'),
downloadPrrByVaccineTableButton: document.querySelector("#downloadPrrByVaccineTable"),
keyColumnName: name
},
vaccine: {
vaccineSelectElement: $('#vaccineSelect'),
selectVaccine: UIUtils.getSearchParamOfCurrentUrl('vaccine'),
onVaccineSelected: vaccine => UIUtils.setSearchParamOfCurrentUrl('vaccine', vaccine),
selectVaccine: vaccineSearchParam.get(),
onVaccineSelected: vaccine => vaccineSearchParam.set(vaccine),
prrBySymptomTableElement: $('#prrBySymptomTable'),
downloadPrrBySymptomTableButton: document.querySelector("#downloadPrrBySymptomTable"),
valueName: name

View File

@@ -0,0 +1,16 @@
class SearchParam {
#name;
constructor(name) {
this.#name = name;
}
get() {
return UIUtils.getSearchParamOfCurrentUrl(this.#name);
}
set(value) {
UIUtils.setSearchParamOfCurrentUrl(this.#name, value);
}
}