1{% extends "admin/base.html" %}
2{% block title %}Event{% endblock %}
3
4{% block content %}
5<style>
6.hide {
7 color: transparent;
8 text-shadow: 0 0 10px #000;
9}
10.hide:hover {
11 color: black;
12 text-shadow: 0 0 0px #000;
13
14}
15</style>
16 <div class="row">
17 <div class="col">
18 <h3>Event</h3>
19 <form action="events.php" method="POST">
20 <input type="hidden" name="id" value="{{ event.id }}">
21 <div class="form-group">
22 <label for="name">Eventnamn</label>
23 <input class="form-control" type="text" name="name" id="name" placeholder="Ange eventnamn" required autocomplete="off" value="{{ event.name }}">
24 </div>
25 <div>
26 <label for="start_date">Starttid</label>
27 <input class="form-control" type="datetime-local" name="start_date" id="start_date" required value="{{ event.start_date|replace({' ' : 'T'}) }}">
28 </div>
29 <div>
30 <label for="end_date">Sluttid</label>
31 <input class="form-control" type="datetime-local" name="end_date" id="end_date" required value="{{ event.end_date|replace({' ': 'T'}) }}">
32 </div>
33 <div>
34 <label for="display_date">Visningstid</label>
35 <input class="form-control" type="datetime-local" name="display_date" id="display_date" required value="{{ event.display_date|replace({' ': 'T'}) }}">
36 </div>
37 <div>
38 <input class="form-check-input" type="checkbox" name="show_class" id="show_class" {{ event.show_class ? 'checked="1"': '' }} value="1">
39 <label class="form-check-lable" for="show_class">Visa klass</label>
40 </div>
41 <div class="pt-3">
42 <input class="btn btn-warning" type="submit" name="action" value="Uppdatera">
43 <input class="btn btn-danger" type="submit" name="action" value="Radera">
44 {% if users %}
45 <input class="btn btn-dark" type="submit" name="action" value="Tilldela mål">
46 {% endif %}
47 </div>
48 </form>
49 </div>
50 <div class="col">
51 {% if error %}
52 <div class="alert alert-danger">
53 {{ error }}
54 </div>
55 {% endif %}
56 <h4>Importera användare. OBS: debug</h4>
57 <form action="events.php" method="POST">
58 <div class="form-group">
59 <label for="">Kommaseparerade klasser. Lämna fältet tomt om du vill inkludera alla elever.</label>
60 <input class="form-control" name="whitelist" type="text" placeholder="Ange klasser" autocomplete="off">
61 </div>
62 <div class="form-group">
63 <label for="">Kommaseparerade användarnamn.</label>
64 <input class="form-control" name="whitelistStudents" type="text" placeholder="Ange elever" autocomplete="off">
65 </div>
66 <input type="hidden" name="id" value="{{ event.id }}">
67 <input class="btn btn-dark" type="submit" name="action" value="Lägg till användare">
68 </form>
69 </div>
70 </div>
71 <h4 class="mt-4">Deltagare ({{ users|length }})</h4>
72 {% if not users %}
73 <p>
74 Det finns inga användare registrerade på eventet.
75 </p>
76 {% else %}
77 <table class="table table-striped">
78 <thead>
79 <tr>
80 <th>Id</th>
81 <th>Namn</th>
82 <th>Klass</th>
83 <th>Hemlis</th>
84 <th>Mål</th>
85 <th>Vid liv</th>
86 <th>?</th>
87 </tr>
88 </thead>
89 <tbody>
90 {% for user in users %}
91 <tr id="user-{{ user.id }}">
92 <td>{{ user.id }}</td>
93 <td>{{ user.name }}</td>
94 <td>{{ user.class }}</td>
95 <td class="hide">{{ user.secret }}</td>
96 {% if user.target != 0 %}
97 <td><a class="hide" href="#user-{{ user.target }}">{{ userMap[user.target] }}<a></td>
98 {% else %}
99 <td><p class="badge badge-danger">Odefinerat</p></td>
100 {% endif %}
101 <td>{{ user.alive == '1' ? 'Ja' : 'Nej' }}</td>
102 <td>
103 <form action="events.php" method="post">
104 <input type="hidden" name="userId" value="{{ user.id }}">
105 <input type="hidden" name="eventId" value="{{ event.id }}">
106 <input class="btn btn-danger" type="submit" name="action" value="Ta bort">
107 </form>
108 <a class="btn btn-info" href="player.php?userId={{ user.id }}&eventId={{ event.id }}">Visa</a>
109 </td>
110 </tr>
111 {% endfor %}
112 </tbody>
113 </table>
114 {% endif %}
115{% endblock %}