Skip to content

Commit

Permalink
Adding voting status indicador and toggle button
Browse files Browse the repository at this point in the history
  • Loading branch information
jontyms committed Mar 18, 2024
1 parent 608707e commit 3e8fd9f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions static/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function load() {
"id": sanitizeHTML(member.id).replaceAll("-", "-"),
"name": sanitizeHTML(member.first_name + " " + member.surname),
"status": userStatus,
"voting_status": Boolean(member.can_vote),
"discord": "@" + sanitizeHTML(member.discord.username),
"email": sanitizeHTML(member.email),
"nid": sanitizeHTML(member.nid),
Expand Down Expand Up @@ -145,6 +146,7 @@ function showUser(userId) {
document.getElementById("statusColor").style.color = user.is_full_member ? "#51cd7f" : "#cf565f";

document.getElementById("status").innerText = user.status;
document.getElementById("voting_status").innerText = user.can_vote ? "✔️" : "❌";
document.getElementById("did_pay_dues").innerText = user.did_pay_dues ? "✔️" : "❌";
document.getElementById("ethics_form").innerText = (user.ethics_form.signtime && (Number.parseInt(user.ethics_form.signtime) !== -1)) ? (new Date(Number.parseInt(user.ethics_form.signtime))).toLocaleString() : "❌";
document.getElementById("is_full_member").innerText = user.is_full_member ? "✔️" : "❌";
Expand Down Expand Up @@ -202,6 +204,12 @@ function showUser(userId) {
"did_get_shirt": true
})
};
document.getElementById("toggleVote").onclick = (evt) => {
editUser({
"id": user.id,
"can_vote": !user.can_vote
})
}
document.getElementById("claimShirt").style.display = user.did_get_shirt ? "none" : "inline-block";

document.getElementById("setAdmin").onclick = (evt) => {
Expand Down
5 changes: 5 additions & 0 deletions templates/admin_searcher.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ <h2 id="discord"></h2>
<td>Membership Status</td>
<td id="status">Value</td>
</tr>
<tr>
<td>Voting Status</td>
<td id="voting_status">Value</td>
</tr>
<tr>
<td>Was Dues Paid?</td>
<td id="did_pay_dues">Value</td>
Expand Down Expand Up @@ -162,6 +166,7 @@ <h2 id="discord"></h2>
<button class="btn" id="joinInfra"><i class="fa-solid fa-server"></i> <span id="infraLabel">Invite to Infra</span></button>
<button class="hide_default btn" id="assignMentor"><i class="fa-solid fa-user-group"></i> Assign Mentor</button>
<button class="btn" id="sendMessage"><i class="fa-brands fa-discord"></i> Send Discord Message</button>
<button class="btn" id="toggleVote"><i class="fa-solid fa-check-to-slot"></i>Toggle Vote Status</button>
</details>
<details>
<summary><h2>View as JSON</h2></summary>
Expand Down

2 comments on commit 3e8fd9f

@jeffreydivi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huge issue about this:

So the reason can_vote exists is because originally Onboard was supposed to have context on membership attendance. However, it does NOT have that context now, so idk if making this manual is a smart idea, or if it should even be tracked, lest you add in event management logic.

I advise you roll the voting commits back.

@jontyms
Copy link
Member Author

@jontyms jontyms commented on 3e8fd9f Mar 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeffreydivi This is a temporary measure. We are going to have a python script take data from the attendance spreadsheet and update this value in Onboard. I fully intend on rolling this back after elections.

Please sign in to comment.