-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathsession_check_in.html
More file actions
401 lines (367 loc) · 17.6 KB
/
session_check_in.html
File metadata and controls
401 lines (367 loc) · 17.6 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
{% extends "_admin_base.html" %}
{% load i18n humanize coderdojochi_extras %}
{% block title %}Student Check In - We All Code{% endblock %}
{% block extra_head %}
<style>
col.success { background-color: #dff0d8; }
col.error{ background-color: #f2dede; }
col.warning { background-color: #fcf8e3; }
col.info { background-color: #d9edf7; }
/* to override bootstrap*/
.table > tbody > tr > td { vertical-align: middle; }
/* Custom styles */
.student-name,
.parent-name {
min-width: 150px;
width: 10%;
}
.parent-email {
min-width: 150px;
width: 10%;
}
.parent-phone {
min-width: 100px;
width: 10%;
}
.student-school {
min-width: 200px;
width: 10%;
}
.cancellation-reason {
min-width: 150px;
width: 15%;
max-width: 200px;
}
.order-date {}
.student-gender {
width: 50px;
text-align: center;
}
.order-num,
.student-age,
.num-attended,
.num-missed {
box-sizing: border-box;
width: 50px;
text-align: right;
}
</style>
<!-- Google Charts -->
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {packages: ['corechart', 'bar']});
google.charts.setOnLoadCallback(drawBasic);
function drawBasic() {
var gender_data = google.visualization.arrayToDataTable([
['Gender', 'Students'],
{% for key, value in gender_count %}
['{{ key.title }}', {{ value }}],
{% endfor %}
]);
var gender_options = {
legend: {
position: 'bottom',
},
// pieSliceText: 'label',
// title: 'Genders of Registered Students',
// pieStartAngle: 100,
};
var gender_chart = new google.visualization.PieChart(document.getElementById('gender_chart'));
gender_chart.draw(gender_data, gender_options);
// Age
var age_data = google.visualization.arrayToDataTable([
['Age', 'Students'],
{% for key, value in age_count %}
['{{ key }} y/o', {{ value }}],
{% endfor %}
]);
// var age_options = {
// legend: {
// position: 'bottom',
// },
// pieSliceText: 'label',
// title: 'Genders of Registered Students',
// // pieStartAngle: 100,
// };
// var age_options = {
// title: 'Population of Largest U.S. Cities',
// chartArea: {width: '50%'},
// hAxis: {
// title: 'Total Population',
// minValue: 0
// },
// vAxis: {
// title: 'City'
// }
// };
var age_options = {
// chart: {
// title: 'Genders of Registered Students',
// },
// bars: 'horizontal', // Required for Material Bar Charts.
// hAxis: { format: 'short' },
legend: { position: 'none' },
annotations: {
alwaysOutside: true,
},
};
// var age_chart = new google.visualization.BarChart(document.getElementById('age_chart'));
// age_chart.draw(age_data, age_options);
var age_chart = new google.charts.Bar(document.getElementById('age_chart'));
age_chart.draw(age_data, age_options);
}
</script>
{% endblock %}
{% block topnav %}
<nav class="navbar navbar-default navbar-static-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{% url 'cdc-admin' %}">We All Code Admin</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a class="pull-right" href="{% url 'admin:index' %}">Django Admin</a></li>
</ul>
</div>
</div>
</nav>
{% endblock %}
{% block content %}
{% if active_orders.count %}
<div class="container-fluid">
<div class="row">
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">
<div class="row">
<div class="col-sm-6">Student Age</div>
<div class="col-sm-6 text-right">Average Age: <strong>{{ average_age }}</strong></div>
</div>
</div>
<div class="panel-body">
<div id="age_chart"></div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">Student Gender</div>
<div class="panel-body">
<div id="gender_chart"></div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">
<div class="row">
<div class="col-sm-6">Attendance</div>
<div class="col-sm-6 text-right">{{ checked_in_orders.count }} of {{ active_orders.count }}</div>
</div>
</div>
<div class="panel-body">
<h4 class="title text-center"></h4>
<div class="progress">
<div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="{% widthratio checked_in_orders.count active_orders.count 100 %}" aria-valuemin="0" aria-valuemax="100" style="width: {% widthratio checked_in_orders.count active_orders.count 100 %}%">
{% widthratio checked_in_orders.count active_orders.count 100 %}%
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endif %}
{% if active_orders.count %}
<div class="container-fluid">
<div class="row">
</div>
</div>
{% endif %}
{% if active_orders.count %}
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
{% if active_session %}
<h2 class="title">Attending Students <span class="badge">{{ active_orders.count }}</span></h2>
{% else %}
<h2 class="title">Attended Students <span class="badge">{{ active_orders.count }}</span></h2>
{% endif %}
{% if active_orders.count %}
<table class="table table-striped">
<thead>
<tr>
<th class="order-num"></th>
<th class="student-name">Student</th>
<th class="student-age">Age</th>
<th class="student-gender">Gender</th>
<th class="parent-name">Guardian</th>
<th class="parent-email">Parent Email</th>
<th class="parent-phone">Parent Phone</th>
<th class="student-school">School</th>
<th class="order-date">{% if not active_session %}Checkin Date{% endif %}</th>
<th class="text-right num-attended"><abbr title="Number Attended">#A</abbr></th>
<th class="text-right num-missed"><abbr title="Number Missed">#M</abbr></th>
</tr>
</thead>
<tbody>
{% for order in active_orders %}
<tr class="{% if order.check_in %}success{% endif %}">
<form method="post" action=".">
{% csrf_token %}
<input type="hidden" name="order_id" value="{{ order.id }}">
<td class="vert-align">{{ forloop.counter|stringformat:"02d" }}</td>
<td class="vert-align">
<strong>{{ order.student.first_name }}</strong> {{ order.student.last_name }}
</td>
<td class="text-right vert-align">{{ order.student | student_age:session.start_date }}</td>
<td class="student-gender">{{ order.student.get_clean_gender_short | upper }}</td>
<td>
{% if active_session %}
<input type="text" name="order_alternate_guardian" class="form-control" value="{% if order.alternate_guardian %}{{ order.alternate_guardian }}{% else %}{{ order.guardian.full_name }}{% endif %}">
{% else %}
{% if order.alternate_guardian %}
{{ order.alternate_guardian }}
{% else %}
{{ order.guardian.full_name }}
{% endif %}
{% endif %}
</td>
<td>{{ order.guardian.email }}</td>
<td>{{ order.guardian.phone | phone_number }}</td>
<td>{{ order.student.school_name }}</td>
<td>
{% if active_session %}
{% if not order.check_in %}
<button class="button small">Check In</button>
{% else %}
<button class="button tertiary small">Undo</button>
{% endif %}
{% else %}
{{ order.check_in | date:"M j, g:i A" }}
{% endif %}
</td>
<td class="text-right vert-align">{{ order.num_attended }}</td>
<td class="text-right vert-align {% if order.num_missed >= 3 %}danger{% endif %}">{{ order.num_missed }}</td>
</form>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No students registered.</p>
{% endif %}
</div>
</div>
</div>
{% endif %}
{% if active_session != True %}
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<h2 class="title">No Shows <span class="badge">{{ no_show_orders.count }}</span></h2>
<table class="table table-striped">
<thead>
<tr>
<th class="order-num"></th>
<th class="student-name">Student</th>
<th class="student-age">Age</th>
<th class="student-gender">Gender</th>
<th class="parent-name">Guardian</th>
<th class="parent-email">Parent Email</th>
<th class="parent-phone">Parent Phone</th>
<th class="student-school">School</th>
<th class="order-date">Last Update Date</th>
<th class="cancellation-reason">Reason</th>
<th class="text-right num-attended"><abbr title="Number Attended">#A</abbr></th>
<th class="text-right num-missed"><abbr title="Number Missed">#M</abbr></th>
</tr>
</thead>
<tbody>
{% for order in no_show_orders %}
<tr class="{% if order.check_in %}success{% endif %}">
<td class="vert-align">{{ forloop.counter|stringformat:"02d" }}</td>
<td class="vert-align"><strong>{{ order.student.first_name }}</strong> {{ order.student.last_name }}</td>
<td class="text-right vert-align">{{ order.student | student_age:session.start_date }}</td>
<td class="student-gender">{{ order.student.get_clean_gender_short | upper }}</td>
<td>{% if order.alternate_guardian %}{{ order.alternate_guardian }}{% else %}{{ order.guardian.full_name }}{% endif %}</td>
<td>{{ order.guardian.email }}</td>
<td>{{ order.guardian.phone | phone_number }}</td>
<td>{{ order.student.school_name }}</td>
<td>{{ order.updated_at | date:"M j, g:i A" }}</td>
<td class="cancellation-reason">
{% if order.cancellation_reason %}
{{ order.cancellation_reason|truncatewords:10 }}
{% else %}
<em>No reason given</em>
{% endif %}
</td>
<td class="text-right vert-align">{{ order.num_attended }}</td>
<td class="text-right vert-align {% if order.num_missed >= 3 %}danger{% endif %}">{{ order.num_missed }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
{% if inactive_orders.count %}
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<h2 class="title">Cancelled Tickets <span class="badge">{{ inactive_orders.count }}</span></h2>
<table class="table">
<thead>
<tr>
<th class="order-num"></th>
<th class="student-name">Student</th>
<th class="student-age">Age</th>
<th class="student-gender">Gender</th>
<th class="parent-name">Parent</th>
<th class="parent-email">Parent Email</th>
<th class="parent-phone">Parent Phone</th>
<th class="student-school">School</th>
<th class="order-date">Cancelled Date</th>
<th class="cancellation-reason">Reason</th>
<th class="text-right num-attended"><abbr title="Number Attended">#A</abbr></th>
<th class="text-right num-missed"><abbr title="Number Missed">#M</abbr></th>
</tr>
</thead>
<tbody>
{% for order in inactive_orders %}
<tr>
<td>{{ forloop.counter|stringformat:"02d" }}</td>
<td><strong>{{ order.student.first_name }}</strong> {{ order.student.last_name }}</td>
<td class="text-right">{{ order.student | student_age:session.start_date }}</td>
<td class="student-gender">{{ order.student.get_clean_gender_short | upper }}</td>
<td>{{ order.guardian.full_name }}</td>
<td>{{ order.guardian.email }}</td>
<td>{{ order.guardian.phone | phone_number }}</td>
<td>{{ order.student.school_name }}</td>
<td>{{ order.updated_at | date:"M j, g:i A" }}</td>
<td class="cancellation-reason">
{% if order.cancellation_reason %}
{{ order.cancellation_reason|truncatewords:10 }}
{% else %}
<em>No reason given</em>
{% endif %}
</td>
<td class="text-right">{{ order.num_attended }}</td>
<td class="text-right {% if order.num_missed >= 3 %}danger{% endif %}">{{ order.num_missed }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
</div>
{% endblock %}