summaryrefslogtreecommitdiff
path: root/templates/staff.html
blob: b356cf49793eb4d28934f26a567f5a51ae151d84 (plain) (blame)
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
{{- define "staff" -}}
<!DOCTYPE html>
<html lang="en">
	<head>
		<title>
			Staff Home &ndash; CCA Selection System
		</title>
		<link rel="stylesheet" href="/static/style.css" />
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		<meta name="description" content="YK Pao School CCA Selection System" />
	</head>
	<body>
		<div style="font-size: 150%; color: red; font-weight: bold;" class="broken-styling-warning">
			The fact that you see this message means that the CSS styling information for this site is not loading correctly, and usability would be severely impacted. Check your network connection, and if this issue persists, you should contact the system administrator.
		</div>
		<header>
			<div class="header-content">
				<div class="header-left">
					<h1><a id="site-title" href="./">CCA Selection System</a></h1>
				</div>
				<div class="header-middle">
					<nav>
						<ul>
							<li>
								<a href="./">Home</a>
							</li>
							<li>
								<a href="./docs/">Docs</a>
							</li>
							<li>
								<a href="./iadocs/">IA</a>
							</li>
							<li>
								<a href="./src/">Source</a>
							</li>
						</ul>
					</nav>
				</div>
				<div class="header-right">
					<p>{{- .Name }} (Staff)</p>
				</div>
			</div>
		</header>
		<div class="reading-width" id="wip-notice">
			<p>
			This site is still a work in progress and may contain bugs! Please contact <a href="mailto:s22537@stu.ykpaoschool.cn">Runxi Yu</a> for any issues.
			</p>
		</div>
		<div class="reading-width">
			<p><a href="./export/choices" class="btn-normal btn">Export all choices as a spreadsheet</a></p>
			<p><a href="./export/students" class="btn-normal btn">Export student confirmed status as a spreadsheet</a></p>
			{{- if ge .State 1 }}
			<p><a href="./state/0" class="btn-danger btn">Disable student access</a></p>
			{{- if ge .State 2 }}
			<p><a href="./state/1" class="btn-danger btn">Stop course selections</a></p>
			{{- else }}
			<p><a href="./state/2" class="btn-primary btn">Start course selections</a></p>
			{{- end }}
			{{- else }}
			<p><a href="./state/1" class="btn-primary btn">Enable student access</a></p>
			{{- end }}
			<table class="table-of-courses">
				<colgroup>
					<col style="width: 5%;" />
					<col style="width: 5%;" />
					<col style="width: 5%;" />
					<col/>
					<col style="width: 15%;" />
					<col style="width: 15%;" />
					<col style="width: 15%;" />
				</colgroup>
				<thead>
					<tr>
						<th scope="col">ID</th>
						<th scope="col">Used</th>
						<th scope="col">Max</th>
						<th scope="col">Name</th>
						<th scope="col">Type</th>
						<th scope="col">Teacher</th>
						<th scope="col">Location</th>
					</tr>
					<tr>
						<th colspan="7" class="tdinput">
							<input type="text" id="search" placeholder="Search..." />
						</th>
					</tr>
				</thead>
				<tbody>
					{{- range .Groups }}
					<tr><th colspan="7">{{ .Name }}</th></tr>
					{{- range .Courses }}
					<tr class="courseitem" id="course{{.ID}}" data-group="{{.Group}}">
						<th scope="row">
							{{.ID}}
						</th>
						<td>
							<span id="selected{{.ID}}">{{.Selected}}</span>
						</td>
						<td>
							<span id="max{{.ID}}">{{.Max}}</span>
						</td>
						<td>{{.Title}}</td>
						<td id="type{{.ID}}">{{.Type}}</td>
						<td>{{.Teacher}}</td>
						<td>{{.Location}}</td>
					</tr>
					{{- end }}
					{{- end }}
				</tbody>
				{{- if eq .State 0 }}
				<tfoot>
					<tr>
						<td class="th-like" colspan="7">
							<form method="POST" enctype="multipart/form-data" action="/newcourses">
								<div class="flex-justify">
									<div class="left">
									</div>
									<div class="right">
										<input title="Upload course list (CSV)" type="file" id="coursecsv" name="coursecsv" accept=".csv" />
										<input type="submit" value="Delete all choices and reset courses" class="btn btn-danger" />
									</div>
								</div>
							</form>
						</td>
					</tr>
				</tfoot>
				{{- end }}
			</table>
		</div>
		<script>
			document.addEventListener("DOMContentLoaded", () => {
				const search = document.getElementById("search")
				search.addEventListener("input", () => {
					const s = search.value.toLowerCase().trim().normalize('NFD')
					document.querySelectorAll(".courseitem").forEach(c => {
						c.hidden = (!c.textContent.toLowerCase().normalize('NFD').includes(s)) && (s.length > 0)
					})
				})
			})
		</script>
	</body>
</html>
{{- end -}}