Commit 05a7bc54 authored by trfloria's avatar trfloria
Browse files

dynamic dropdown lists callbacks implemented

parent 9e606867
......@@ -33,18 +33,14 @@ const subjects = {
'Chemie',
'Maschinenelemente',
],
[],
['Dynamics', 'Thermodynamik 1'],
['Fluiddynamik1', 'Thermodynamik 2'],
[],
[],
[],
],
};
const filterNamesDropdown = {
semester: { 1: '1. Semester', 2: '2. Semester', 3: '3. Semester' },
};
export default class studydocList {
constructor(vnode) {
this.vnode = vnode;
......@@ -68,6 +64,21 @@ export default class studydocList {
this.doc = doc;
}
static courseData() {
let data = [];
if (this.filter.department.itet || !this.filter.department.mavt) {
for (let i = 0; i < subjects.itet[this.semester].length; i++) {
data.push({ id: i+1, name: subjects.itet[this.semester][i] });
}
}
if (this.filter.department.mavt || !this.filter.department.itet) {
for (let i = 0; i < subjects.mavt[this.semester].length; i++) {
data.push({ id: i+1, name: subjects.mavt[this.semester][i] });
}
}
return data;
}
static changeFilter(filterKey, filterValue, checked) {
this.filter[filterKey][filterValue] = checked;
const query = {};
......@@ -148,6 +159,12 @@ export default class studydocList {
this.semester = event.target.value;
},
}),
m(Dropdown, {
data: this.courseData(),
onchange: event => {
this.course = event.target.value;
},
}),
]),
m(Button, {
label: 'Add new',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment