-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvote_wait.php
More file actions
71 lines (65 loc) · 2.82 KB
/
vote_wait.php
File metadata and controls
71 lines (65 loc) · 2.82 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
<!DOCTYPE html>
<html>
<head>
<!-- bootstrap -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- my styles -->
<link rel="stylesheet" href="style.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="js/auto_refresh.js"></script>
<title>Vote Wait - Random Notes!</title>
</head>
<body onload="autoRefreshAlert()">
<?php
include "helpers/confirm_or_redirect.php";
confirm_or_redirect("vote_wait");
include "helpers/top.php";
?>
<div class="main-content">
<div class="container-fluid">
<div class="row g-5">
<div class="col-md-6">
<h5 class="text-success border-bottom pb-2">Voted</h5>
<div id="voted-list" class="list-group"></div>
</div>
<div class="col-md-6">
<h5 class="text-warning border-bottom pb-2">Still Deciding...</h5>
<div id="waiting-list" class="list-group"></div>
</div>
</div>
<div class="row g-3" id="submissions"></div>
</div>
</div>
<script>
function load() {
fetch("helpers/display_votes.php")
.then(res => res.json())
.then(data => {
const votedList = document.getElementById("voted-list");
const waitingList = document.getElementById("waiting-list");
const submissionsWithNames = data.votes;
submissionsWithNames.forEach(submissionWithName => {
const player = submissionWithName.name;
const hasVoted = submissionWithName.vote != null;
if (hasVoted) {
// Item for those who have voted
votedList.innerHTML += `
<div class="list-group-item d-flex justify-content-between align-items-center list-group-item-success">
<span class="fw-bold">${player}</span>
<span class="badge bg-success rounded-pill">Ready</span>
</div>`;
} else {
// Item for those we are waiting for
waitingList.innerHTML += `
<div class="list-group-item d-flex justify-content-between align-items-center opacity-75">
<span>${player}</span>
<span class="badge bg-warning rounded-pill">Hurry Up</span>
</div>`;
}
})
})
}
load();
</script>
</body>
</html>