-
Notifications
You must be signed in to change notification settings - Fork 729
/
CurrentQueue.twig
102 lines (98 loc) · 5.54 KB
/
CurrentQueue.twig
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<div id="current_queue">
<table class="table table-striped" style="width:100%;">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Status</th>
<th scope="col">Time</th>
<th scope="col">Total Time Paused</th>
<th scope="col">Queue</th>
<th scope="col">Remove</th>
</tr>
</thead>
<tbody>
{% for entry in viewer.getCurrentQueue() %}
<tr class="row_color_{{viewer.getIndexFromCode(entry['queue_code'])}} queue_current_{{viewer.cleanForId(entry['queue_code'])}} current_queue_row" style="display:none;">
<th scope="row" class="row_number">{{entry['row_number'] }}</th>
<td>
{{ entry['name'] }}
<a class="post-user-info" onclick="unhideId(this,'{{ entry['user_id'] }}')" onkeypress="unhideId(this,'{{ entry['user_id'] }}')" title="Show user id" aria-label="Show user id" tabindex="0">
<i class="fas fa-eye"></i>
</a>
</td>
{% if entry['current_state'] == 'waiting' %}
<td>
<form method="post" action="{{base_url}}/{{entry['queue_code'] | url_encode }}/startHelp" {% if entry['paused'] %}onsubmit="return confirm('Are you sure you want to start helping this student? This student is currently paused.');"{% endif %}>
<input type="hidden" name="csrf_token" value="{{ csrf_token }}"/>
<input type="hidden" name="user_id" value="{{entry['user_id']}}"/>
{% if entry['paused'] %}
<button type="submit" class="btn btn-primary help_btn" title="Student paused" data-ready="false">
<i class="fas fa-pause"></i>
Help
</button>
{% elseif viewer.firstTimeInQueueThisWeek(entry['last_time_in_queue']) %}
<button type="submit" class="btn btn-primary help_btn" title="First time in this queue this week" data-ready="true">
<i class="fas fa-star"></i>
Help
</button>
{% elseif viewer.firstTimeInQueueToday(entry['last_time_in_queue']) %}
<button type="submit" class="btn btn-primary help_btn" title="First time in this queue today" data-ready="true">
<i class="fas fa-star-half"></i>
Help
</button>
{% else %}
<button type="submit" class="btn btn-primary help_btn" data-ready="true">
Help
</button>
{% endif %}
</form>
</td>
{% elseif entry['current_state'] == 'being_helped' %}
<td>
{% if entry['help_started_by'] == viewer.getUserId() %}
<form method="post" action="{{base_url}}/{{entry['queue_code'] | url_encode }}/finishHelp">
{% else %}
<form method="post" action="{{base_url}}/{{entry['queue_code'] | url_encode }}/finishHelp" onsubmit="return confirm('{{entry['help_started_by']}} was the one who originally clicked to say they were helping this student, are you sure you want to finish helping {{entry['name']}}?');">
{% endif %}
<input type="hidden" name="csrf_token" value="{{ csrf_token }}"/>
<input type="hidden" name="user_id" value="{{entry['user_id']}}"/>
{% if entry['help_started_by'] == viewer.getUserId() %}
<button type="submit" class="btn btn-success finish_helping_btn" title="Being helped by {{entry['help_started_by']}}">Finish Helping</button>
{% else %}
<button type="submit" class="btn btn-primary finish_helping_btn" title="Being helped by {{entry['help_started_by']}}">Finish Helping</button>
{% endif %}
</form>
</td>
{% endif %}
{% if entry['current_state'] == 'being_helped' %}
<td class="help_timer" help_time="{{ viewer.timeToISO(entry['time_help_start']) }}"></td>
{% else %}
<td>{{ viewer.timeToHM(entry['time_in']) }}</td>
{% endif %}
{% if entry['time_paused_start'] == NULL or entry['current_state'] == 'being_helped' %}
<td>---</td>
{% else %}
<td class="help_timer" help_time="{{ viewer.timeToISO(entry['time_paused_start']) }}"></td>
{% endif %}
<td>{{ entry['queue_code'] }}</td>
<td>
<form method="post" action="{{base_url}}/{{entry['queue_code'] | url_encode }}/remove" onsubmit="return confirm('Are you sure you want to remove {{ entry['name'] }} from the queue?');">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}"/>
<input type="hidden" name="user_id" value="{{entry['user_id']}}"/>
<button type="submit" class="btn btn-default remove_from_queue_btn">Remove</button>
</form>
</td>
</tr>
{% if entry['contact_info'] != '' %}
<tr class="contact_info row_color_{{viewer.getIndexFromCode(entry['queue_code'])}} queue_current_{{viewer.cleanForId(entry['queue_code'])}} current_queue_row" style="display:none;border-top:0px">
<td colspan="7" style="border-top:0px; word-wrap:anywhere;">{{entry['contact_info']}}</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
<div id="queue_empty_msg" style="display:none; text-align:center">
Your queue is currently empty. Make sure you have the correct filter settings set.
</div>
</div>