sub showing results

This commit is contained in:
Corban-Lee Jones 2024-06-24 20:52:19 +01:00
parent 02c88293d8
commit 03139848c6
2 changed files with 13 additions and 3 deletions

View File

@ -289,6 +289,7 @@ async function loadSubscriptions(guildId, page=1, pageSize=null) {
const subscriptions = await getSubscriptions(guildId, page, pageSize);
subTable.rows.add(subscriptions.results).draw(false);
handleSubPagination(page, pageSize, subscriptions.count, subscriptions.next, subscriptions.previous);
handleSubPageInfo(subscriptions.results.length, subscriptions.count);
$("#subTable thead .table-select-all").prop("disabled", subscriptions.results.length === 0);
console.debug("loading subs, " + subscriptions.results.length + " found");
}
@ -305,6 +306,11 @@ $("#subTablePageSize").on("change", async function() {
loadSubscriptions(getCurrentlyActiveServer().guild_id, page, pageSize);
});
function handleSubPageInfo(showing, total) {
$("#subTablePageInfo .pageinfo-showing").text(showing);
$("#subTablePageInfo .pageinfo-total").text(total);
}
// Update the UI pagination options according to the passed data.
function handleSubPagination(currentPage, pageSize, totalItems, nextExists, prevExists) {

View File

@ -104,10 +104,10 @@
<div class="col-12">
<div id="serverTabContent" class="tab-content">
<div id="subscriptionsTabPane" class="tab-pane fade" role="tabpanel" aria-labelledby="subscriptionsTab" tabindex="0">
<div class="table-responsive my-3">
<div class="table-responsive my-3 px-3">
<table id="subTable" class="table table-hover align-middle"></table>
</div>
<div class="table-controls d-flex mb-3">
<div class="table-controls d-flex mb-3 px-3">
<nav id="subPagination">
<ul class="pagination mb-0">
<li class="page-item">
@ -118,7 +118,11 @@
</li>
</ul>
</nav>
<div class="d-flex ms-auto">
<div id="subTablePageInfo" class="d-flex align-items-center mx-auto">
showing&nbsp;<span class="pageinfo-showing"></span>
&nbsp;of&nbsp;<span class="pageinfo-total"></span>
</div>
<div class="d-flex">
<label for="subTablePageSize" class="form-label align-self-center mb-0 me-2">Per Page</label>
<select name="subTablePageSize" id="subTablePageSize" class="select-2">
<option value="10" selected>10&emsp;</option>