t00-multiuser/server/views/admin/userbadges.ejs

61 lines
2 KiB
Text
Raw Normal View History

2024-10-12 11:52:13 +01:00
<%- include("../base/header", { title: "Unlocked Badge Management", userId: session.userId, isAdmin: true }) %>
<div class="row">
<div class="col">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/admin">Admin</a></li>
<li class="breadcrumb-item active"><a>Unlocked Badge Management</a></li>
</ol>
</nav>
</div>
</div>
<div class="row mb-3">
<div class="col">
<h1>Unlocked Badge Management</h1>
</div>
</div>
<div class="row">
<div class="col">
<form>
<label class="form-label" for="badgeq">Badge Name (fuzzy)</label>
<input class="form-control mb-3" name="badgeq" id="badgeq" value="<%= typeof(badgeq) === "undefined" ? "" : badgeq %>">
<label class="form-label">Username (fuzzy)</label>
<input class="form-control" name="userq" id="userq" value="<%= typeof(userq) === "undefined" ? "" : userq %>">
<input type="submit" hidden />
</form>
</div>
</div>
<div class="row my-5">
<div class="col">
<% for (const badge of badges) { %>
<% const unlockArray = unlockByBadgeId.get(badge.Id) ?? []; %>
<div class="row row-cols-1 mb-3">
<div class="col bg-light-subtle p-3">
<div class="row">
<div class="col-auto align-middle"><img style="image-rendering:pixelated" src="<%= badge.ImageUrl.trim().length === 0 ? "/img/missing.png" : badge.ImageUrl %>" width="32" height="32" /></div>
<div class="col d-flex align-items-center ps-0"><%= badge.Name %></div>
<div class="col-auto d-flex align-items-center pe-4"><%= unlockArray.length %></div>
</div>
</div>
<div class="col bg-dark-subtle">
<% for (const unlock of unlockArray) { %>
<div class="row border-bottom">
<div class="col p-3 d-flex align-items-center">
<%= unlock.Username %>
</div>
<div class="col-auto p-3">
<a class="btn btn-danger" href="/admin/removeuserbadge?id=<%= unlock.Id %>">Remove</a>
</div>
</div>
<% } %>
</div>
</div>
<% } %>
</div>
</div>
<%- include("../base/footer") %>