aboutsummaryrefslogtreecommitdiff
path: root/index.html
blob: ae190b0c2aa835e73e95486a488a0434ee94c6ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Event Calendar</title>
</head>
<body>
<header class="row">
    <h4 class="col"><a href="https://github.com/vkurko/calendar">Event Calendar</a> Demo</h4>
</header>
<main>
    <table id="myTable">
        <thead>
          <tr>
            <th>Select</th>
            <th>Vertiefung</th>
            <th>Name</th>
            <th>Dozent</th>
            <th>Sem.</th>
            <th>SWS</th>
            <th>CP</th>
            <th>Tag1</th>
            <th>Start1</th>
            <th>Ende1</th>
            <th>Raum1</th>
            <th>Tag2</th>
            <th>Start2</th>
            <th>Ende2</th>
            <th>Raum2</th>            
          </tr>
        </thead>
        <tbody id="tableBody"></tbody>
      </table>
</main>

<script type="text/javascript">
    const courses = [{"Vertiefung": "Elektronik", "Name": "Mikroelektronik", "Dozent": "Beckmann", "Semester": "WS", "SWS": "4", "CP": "5", "Tag1": "Montag", "Startzeit1": "14:00", "Ende1": "15:30", "Raum1": "E6.04", "Tag2": "", "Startzeit2": "", "Ende2": "", "Raum2": ""}, {"Vertiefung": "Energie", "Name": "Erneuerbare Energien", "Dozent": "Schw\u00e4gerl", "Semester": "SS", "SWS": "4", "CP": "5", "Tag1": "Montag", "Startzeit1": "14:00", "Ende1": "17:10", "Raum1": "A3.10", "Tag2": "", "Startzeit2": "", "Ende2": "", "Raum2": ""}, {"Vertiefung": "Autom./Robotik", "Name": "Robot Systems Engineering", "Dozent": "Dietrich", "Semester": "SS", "SWS": "4", "CP": "5", "Tag1": "Mittwoch", "Startzeit1": "11:40", "Ende1": "13:10", "Raum1": "H1.22", "Tag2": "Donnerstag", "Startzeit2": "11:40", "Ende2": "13:10", "Raum2": "H1.22"}, {"Vertiefung": "Elektronik", "Name": "Schaltungstechnik", "Dozent": "Kopystynski", "Semester": "SS", "SWS": "4", "CP": "5", "Tag1": "Montag", "Startzeit1": "11:40", "Ende1": "13:10", "Raum1": "A3.19", "Tag2": "Donnerstag", "Startzeit2": "14:00", "Ende2": "15:30", "Raum2": "A2.15"}];

const table = document.getElementById("tableBody");
courses.map(course=>{
   let row = table.insertRow();
   let checkb = row.insertCell();
   checkb.innerHTML = "<input id=\"" + course.Name + "\" type=checkbox onclick=\"onCheckBoxClicked(event)\">";
   for (const [key, value] of Object.entries(course)) {
    box = row.insertCell();
    box.innerHTML = value;
   };
});

function onCheckBoxClicked(e) {
    console.log("clicked", e);
    let listofchecked = [];
    courses.map(course=>{
        const checkb = document.getElementById(course.Name);
        if (checkb.checked) {
            listofchecked.push(course.Name);
        }
    });
    console.log(listofchecked);

}
</script>
</body>
</html>