aboutsummaryrefslogtreecommitdiff
path: root/app/templates/players.j2
blob: 4b9660e870862b27a1f1864d0a1fe915b68901dd (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
{% from "macros.j2" import header, navbar, footer, player_button, guest_control %}
<!doctype html>
<html lang="en">
	{{ header(url_for) }}
	<body>
	<header class="container">{{ navbar(url_for) }}</header>
		<main class="container">
			<h3 >Members</h3>
            <div class="parent">
            {% for regular in regulars %}
                <div class="cell"> {{ player_button(regular) }} </div>
            {% endfor %}
            </div>
			<h3>Guests</h3>
			<div class="parent">
			{% for guest in guests %}
                <div class="cell"> {{ player_button(guest) }} </div>
            {% endfor %}
			</div>
			<h3>Controls</h3>
			<div class="grid">
				<button class="button is-dark is-responsive" 
						hx-post="/reset_players">RESET!</button>
			</div>
			<h3>Player Update</h3>
			<div class="grid">
				<form method="POST" enctype="multipart/form-data" hx-post="/update_players">
					<div id="file-js" class="file has-name is-fullwidth">
					<label class="file-label">
						<input class="file-input" type="file" name="players" />
					</label>
					<button class="button is-dark is-responsive">UPDATE!</button>
					</div>
				</form>
			</div>
			<footer class="container">{{ footer() }}</footer>
			<script>
				const fileInput = document.querySelector("#file-js input[type=file]");
					if (fileInput !== null) {
						fileInput.onchange = () => {
						if (fileInput.files.length > 0) {
							const fileName = document.querySelector("#file-js .file-name");
							fileName.textContent = fileInput.files[0].name;
						}
					}
				};
			</script>
		</main>
	</body>
</html>