-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
274 lines (236 loc) · 11.2 KB
/
Copy pathindex.html
File metadata and controls
274 lines (236 loc) · 11.2 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
<html data-bs-theme="dark">
<head>
<title>Song Requests</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Latest compiled and minified CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<!-- jQuery library -->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.4/dist/jquery.slim.min.js"></script>
<!-- Popper JS -->
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
crossorigin="anonymous"></script>
<!-- font awesome -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet">
</head>
<body class="container">
<br>
<h2 class="text-center">Song Requests</h2>
<p>{{ .LoggedInName }} (<a href="/logout">Sign Out</a>)</p>
{{ if .AdminUser }}
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item"><a class="nav-link active" data-bs-toggle="tab" href="#requests">My Requests</a></li>
<li class="nav-item"><a class="nav-link" data-bs-toggle="tab" href="#admin">Requests Admin</a></li>
<li class="nav-item"><a class="nav-link" data-bs-toggle="tab" href="#user">User Admin</a></li>
<li class="nav-item"><a class="nav-link" data-bs-toggle="tab" href="#settings">Settings</a></li>
</ul>
<br>
{{ else }}
<hr>
{{ end }}
<div class="tab-content">
<div id="requests" class="tab-pane fade active show">
<div class="alert alert-info">You have <b>{{ .RequestsLeft }}</b> requests left this year, but don't worry,
you can always buy the song
yourself and upload it (<a
href="https://docs.google.com/forms/d/e/1FAIpQLSeIkVMShKhuwtn5cKJyvJd242WNVf2vtn7elW3-myFEKrIPig/viewform">after
being trained</a>).</div>
{{ if gt .RequestsLeft 0 }}
<form action="/iwant" , method="post" , class="form" , target="_self">
<label for="song-title">Song Title:</label>
<input type="text" id="song-title" name="song-title" required class="form-control"><br><br>
<label for="artist">Artist:</label>
<input type="text" id="artist" name="artist" required class="form-control"><br><br>
<label for="other-info">Other Information (optional):</label>
<textarea id="other-info" name="other-info" class="form-control"></textarea><br><br>
<input type="submit" value="Submit" class="btn btn-primary">
</form>
{{ end }}
<hr>
{{ if .SongRequests }}
<h4>My Requests</h4>
<table class="table table-striped table-responsive align-middle">
{{ range .SongRequests }}
<tr>
<td>{{ .Title }}</td>
<td>{{ .Artist }}</td>
<td>{{ if (eq .Uploaded "UPLOADED") }}Uploaded!{{ else if (eq .Uploaded "REJECTED") }}Rejected{{
else if (eq .Uploaded "CANCELLED") }}Cancelled{{
else }}Submitted{{ end }}</td>
{{ if (eq .Uploaded "NOTUPLOADED") }}
<td>
<form action="/cancel" method="post" target="_self" class="m-1">
<input type="hidden" name="id" value="{{ .ID }}">
<input type="submit" value="Cancel" class="btn btn-danger btn-sm">
</form>
</td>
{{ else }}
<td></td>
{{ end }}
</tr>
{{ end }}
</table>
<hr>
{{ end }}
{{ if .UnuploadedRequests }}
<h4>Other People's Requests</h4>
<table class="table table-striped table-responsive align-middle">
{{ range .UnuploadedRequests }}
<tr>
<td>{{ .Title }}</td>
<td>{{ .Artist }}</td>
<td>
<form action="/ihaveuploaded" , method="post" , target="_self" class="m-1">
<input type="hidden" name="id" value="{{ .ID }}">
<input type="submit" value="I've Uploaded This" class="btn btn-success btn-sm">
</form>
</td>
</tr>
{{ end }}
</table>
<hr>
{{ end }}
</div>
{{ if .AdminUser }}
<div id="admin" class="tab-pane fade">
We have spent <b>£{{ .TotalCost }}</b>
<br>
<br>
<div class="panel-group">
<div class="panel panel-default">
<div class="panel-heading">
<h6 class="panel-title">
<a data-bs-toggle="collapse" href="#collapse1">View Completed Requests</a>
</h6>
</div>
<div id="collapse1" class="panel-collapse collapse">
<table class="table table-striped table-responsive">
{{ range .CompletedRequests }}
<tr>
<td class="align-middle">
<h4 class="m-0">
{{ .Title }}
</h4>
</td>
<td class="align-middle">
<h5 class="m-0">
{{ .Artist }}
</h5>
</td>
<td class="align-middle">
<span class="badge rounded-pill text-bg-secondary">
<i class="fas fa-user"></i>
{{ .UserName }}
</span>
</td>
<td class="align-middle">
{{ .TimeStr }}
</td>
<td>
<textarea>{{ .OtherInfo }}</textarea>
</td>
{{ if (eq .Uploaded "UPLOADED")}}
<td>£{{ .FormatCost }}</td>
<td>Uploaded by {{ .UploadedByName }}</td>
{{ else if (eq .Uploaded "REJECTED") }}
<td></td>
<td>Rejected by {{ .UploadedByName }}</td>
{{ else if (eq .Uploaded "CANCELLED") }}
<td></td>
<td>Cancelled</td>
{{ end }}
</tr>
{{ end }}
</table>
</div>
</div>
</div>
<br>
<table class="table table-striped table-responsive">
{{ range .UnuploadedRequests }}
<tr>
<td class="align-middle">
<h5 class="m-0">
{{ .Title }}
</h5>
</td>
<td class="align-middle">
<h5 class="m-0">
{{ .Artist }}
</h5>
</td>
<td class="align-middle">
<span class="badge rounded-pill text-bg-secondary">
<i class="fas fa-user"></i>
{{ .UserName }}
</span>
</td>
<td class="align-middle">
{{ .TimeStr }}
</td>
<td>
<textarea>{{ .OtherInfo }}</textarea>
</td>
<form action="/bought" method="post" target="_self">
<td><input type="number" min="0" step="0.01" name="cost" required class="form-control"
placeholder="Cost"></td>
<td><input type="hidden" name="id" value="{{ .ID }}">
<input type="submit" value="Uploaded" class="btn btn-success btn-sm">
</td>
</form>
<td>
<form action="/reject" method="post" target="_self">
<input type="hidden" name="id" value="{{ .ID }}">
<input type="submit" value="Reject" class="btn btn-danger btn-sm">
</form>
</td>
</tr>
{{ end }}
</table>
</div>
<div id="user" class="tab-pane fade">
<h4>User's Remaining Requests</h4>
<table class="table table-responsive table-striped">
{{ range $name, $numreqs := .UserRemainingRequests }}
<tr>
<td>{{ $name }}</td>
<td>{{ $numreqs.NumRequests }}</td>
<td><form action="/bonus" target="_self" method="post">
<input type="hidden" id="bonus" name="bonus" value={{ $numreqs.UserID }}>
<input type="submit" value="Give Extra Request" class="btn btn-sm btn-primary">
</form></td>
</tr>
{{ end }}
</table>
<hr>
</div>
<div id="settings" class="tab-pane fade">
<h4>Previous Year's Data</h4>
<table class="table table-responsive table-striped">
<tr><th>Save Date</th><th>Download Link</th></tr>
{{ range .PreviousYearsData }}
<tr>
<td>{{ . }}</td>
<td><a href="/csv?date={{ . }}">Download</a></td>
</tr>
{{ end }}
</table>
<hr>
<h4>Start New Year</h4>
<p>This will collapse all the current data in this website into a downloadable spreadsheet linked above, and then reset all requests. This should probably only be done once a year.</p>
<form action="/startnewyear">
<input type="checkbox" name="confirm"> Yes, I'm sure I want to do this.</input>
<br><br>
<button type="submit" class="btn btn-danger">Start New Year</button>
</form>
</div>
{{ end }}
<footer>
<p class="text-center ">Song Requests - version {{ .CommitHash }}</p>
</footer>
</div>
</body>
</html>