Skip to content

Commit 7fcb6f7

Browse files
committed
v1.22.0: fix public list pagination, add history total, load 10 per page
1 parent 36e0aa6 commit 7fcb6f7

1 file changed

Lines changed: 24 additions & 9 deletions

File tree

index.html

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ <h4>Pending UPI payments <span id="pendingCount" class="pending-badge">0</span><
366366
</main>
367367

368368
<div id="modalRoot"></div>
369-
<footer>New Serchhip North Village Council · v1.21.0</footer>
369+
<footer>New Serchhip North Village Council · v1.22.0</footer>
370370

371371
<script type="module">
372372
/* ============================================================
@@ -1255,7 +1255,7 @@ <h4>Pending UPI payments <span id="pendingCount" class="pending-badge">0</span><
12551255

12561256
/* ---------- public list ---------- */
12571257
let pubAll=[], pubShown=6, backTarget="list";
1258-
const PUB_STEP=6;
1258+
const PUB_STEP=10;
12591259

12601260
function showList(){
12611261
backTarget="list";
@@ -1275,12 +1275,18 @@ <h4>Pending UPI payments <span id="pendingCount" class="pending-badge">0</span><
12751275
requestAnimationFrame(()=>{
12761276
const more = pubAll.slice(pubShown, Math.min(pubShown + PUB_STEP, pubAll.length));
12771277
if(more.length){
1278-
const current = $("citizenList").innerHTML;
1279-
const extra = more.map(c=>personCardHTML(c.id, c)).join("");
1280-
const marker = current.includes('id="seeMore"') ? '<button class="btn block ghost small" id="seeMore" style="margin-top:12px">Show next 6</button>' : '';
1281-
$("citizenList").innerHTML = current.replace(marker, marker + extra);
1282-
document.querySelectorAll("#citizenList .result-card").forEach(b=>
1283-
b.addEventListener("click", ()=>openMatch(b.dataset.id, true)));
1278+
const seeMoreBtn = $("seeMore");
1279+
if(seeMoreBtn){
1280+
const frag = document.createDocumentFragment();
1281+
more.forEach(c=>{
1282+
const tmp = document.createElement("div");
1283+
tmp.innerHTML = personCardHTML(c.id, c);
1284+
const card = tmp.firstElementChild;
1285+
card.addEventListener("click", ()=>openMatch(c.id, true));
1286+
frag.appendChild(card);
1287+
});
1288+
seeMoreBtn.parentNode.insertBefore(frag, seeMoreBtn);
1289+
}
12841290
}
12851291
});
12861292
}
@@ -1311,6 +1317,7 @@ <h4>Pending UPI payments <span id="pendingCount" class="pending-badge">0</span><
13111317
const st = statusOf(c);
13121318

13131319
const chrono = [...entries].sort((a,b)=>a.createdAt-b.createdAt);
1320+
let sum = 0;
13141321
let rows = chrono.length ? chrono.map((e, idx)=>{
13151322
const isPayment = e.type==="payment";
13161323
const isForgive = e.type==="forgive";
@@ -1319,11 +1326,19 @@ <h4>Pending UPI payments <span id="pendingCount" class="pending-badge">0</span><
13191326
let amtClass = e.type==="payment" ? "payment" : (e.type==="forgive" ? "payment" : "charge");
13201327
let amtSign = e.type==="payment" ? "− " : (e.type==="forgive" ? "− " : "+ ");
13211328
let rowClass = "row" + (isPayment ? " payment-indent" : "") + (isDeferred ? " deferred" : "");
1329+
sum += e.type==="charge" ? e.amount : -e.amount;
13221330
return `<div class="${rowClass}">
13231331
<div class="desc"><b>${esc(label)}</b><small>${esc(e.date||"")}</small></div>
13241332
<div class="amt ${amtClass}">${amtSign}${fmt(e.amount)}</div>
13251333
</div>`;
13261334
}).join("") : `<div class="empty">No entries yet.</div>`;
1335+
if(chrono.length){
1336+
const sumClass = sum > 0 ? "owing" : "payment";
1337+
rows += `<div class="row" style="border-top:1px solid var(--border);margin-top:4px;padding-top:6px;font-weight:700">
1338+
<div class="desc">Total</div>
1339+
<div class="amt ${sumClass}" style="color:var(--due)">${sum > 0 ? "+ " : ""}${fmt(sum)}</div>
1340+
</div>`;
1341+
}
13271342

13281343
let upiButton = '';
13291344
if(toPay > 0){
@@ -1537,7 +1552,7 @@ <h4>Account</h4>
15371552
<div class="panel">
15381553
<h4>App Info</h4>
15391554
<div style="font-size:13px;color:var(--muted);line-height:1.6">
1540-
<div>Version: v1.21.0</div>
1555+
<div>Version: v1.22.0</div>
15411556
<div>New Serchhip North Village Council</div>
15421557
</div>
15431558
</div>

0 commit comments

Comments
 (0)