This commit is contained in:
oliver
2026-06-15 19:06:39 -03:00
parent a5e642bf6d
commit 16bec05592
2 changed files with 27 additions and 0 deletions
+17
View File
@@ -1496,6 +1496,23 @@ function crmRender() {
? `${total} contact${total !== 1 ? "s" : ""}`
: `${filtered.length} / ${total} contacts`;
// Compute category counts from all records (unfiltered)
const catCounts = {};
for (const r of crmRecords) {
const cat = (r.category || "Uncategorized").trim();
catCounts[cat] = (catCounts[cat] || 0) + 1;
}
const catContainer = document.getElementById("crm-category-counts");
if (catContainer) {
catContainer.innerHTML = Object.entries(catCounts)
.sort((a, b) => b[1] - a[1])
.map(
([cat, cnt]) =>
`<span style="font-size:11px;color:var(--text-muted);background:var(--bg-input);border:1px solid var(--border);border-radius:4px;padding:1px 6px;white-space:nowrap">${escHtml(cat)}: ${cnt}</span>`,
)
.join("");
}
// Reset check-all state
const checkAll = document.getElementById("crm-check-all");
if (checkAll) checkAll.checked = false;