aboutsummaryrefslogtreecommitdiffstats
path: root/templates/poll_vote_table.html.j2
blob: 072d17ab0eb3df6fa03281d69142422b179fc19a (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
<table class="vote-table">
  <tr>
    <th></th>
    {% for choice in choices %}
    <th>
      {{ choice.start_datetime.strftime("%a %d.%m") }}
      <span>
        {% if now.year != choice.start_datetime.year %}.{{choice.start_datetime.year}}{% endif %}
      </span>
      <span>
        {{ choice.start_datetime.strftime("%H:%M") }} &ndash; {{ choice.end_datetime.strftime("%H:%M") }}
      </span>
      <span>
        <i>{{ choice.votes | length }} votes</i>
      </span>
    </th>
    {% endfor %}
  </tr>
  {% for voter_name in voter_names %}
  <tr>
    <td>{{ voter_name }}</td>
    {% for choice in choices %}
    {% if selections[(voter_name, choice.id)] == 1 %}
    <td>
      <input type="checkbox" checked disabled>
    </td>
    {% elif selections[(voter_name, choice.id)] == 0 %}
    <td>
      <input type="checkbox" disabled>
    </td>
    {% else %}
    <td>
      ??
    </td>
    {% endif %}
    {% endfor %}
  </tr>
  {% endfor %}

  <!-- Add a row for the current user -->
  <tr>
    <td>
      <label for="voter_name" hidden>Your name</label>
      <input type="text" name="voter_name" placeholder="Your name" required>
    </td>
    {% for choice in choices %}
    <td>
      <input type="checkbox" name="choice_{{ choice.id }}">
    </td>
    {% endfor %}
  </tr>
  <!-- End of the row for the current user -->
</table>

<input class="green" type="submit" value="Submit">