admin_group.hbs 1.81 KB
Newer Older
1
<h1>Gruppe: {{group.name}} ({{group.id}})</h1>
2

3
4
5
6
7
8
9
<p>
   Id: {{group.id}}<br>
   Name: {{group.name}}<br>
   Gruppencode: {{group.code}}<br>
   Marker: {{group.tag}}
</p>
<p>Gruppen-Administrator: <a href="/admin/user/{{group_admin_id}}">{{group_admin_firstname}} {{group_admin_lastname}} ({{group_admin_id}})</a></p>
10
11
12
13

<h2>Mitglieder</h2>
<table>
   <tr>
14
      <th>Id</th>
15
16
17
18
19
20
21
      <th>Name</th>
      <th>Logincode</th>
      <th>Jahrgangstufe</th>
   </tr>

   {{#each member}}
      <tr>
22
         <td><a href="/admin/user/{{id}}">{{id}}:</a></td>
23
24
25
26
27
28
         <td><a href="/admin/user/{{id}}">{{firstname}} {{lastname}}</a></td>
         <td>{{logincode}}</td>
         <td>{{grade}}</td>
      </tr>
   {{/each}}
</table>
29

30
31
32
33


<h2>Gruppe löschen</h2>
<form id="delete" action="" method="post">
34
  <input type="hidden" name="csrf_token" value="{{csrf_token}}">
35
  <input type="submit" value="Gruppe Löschen!">
36
</form>
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
<div id="deleted" style="color:black;"></div>
<script>
  document.getElementById("delete").onsubmit = function(event) {
    var xhr = new XMLHttpRequest();
    xhr.open("POST", window.location.href, true);
    xhr.onreadystatechange = function() {
      if (this.readyState === XMLHttpRequest.DONE) {
        if (this.status === 200) {
          result = JSON.parse(this.responseText);
          if (result.status == "ok") {
            document.getElementsByTagName("body")[0].style.color = "gray";
            document.getElementById("delete").style.display = "None";
            document.getElementById("deleted").innerText = "Gruppe gelöscht.";
          } else {
            alert("Kann Gruppe nicht löschen: " + result.reason);
          }
        }
        else {
          alert("Request error " + this.status + ": " + this.statusText);
        }
      }
    }
    xhr.send("csrf_token={{csrf_token}}");
    return false;
  };
</script>