fix(kontoplan): remove the per-class active counter (#2273)
* fix(kontoplan): counter reflects the filtered selection
The per-class band row in the chart of accounts always rendered
"{active}/{total} aktiva" with total taken from the already-filtered
class group. With the "Utan verifikat" filter (#2231) or a search
active, that read as "43/43 aktiva": full coverage of a class that
was really a subset.
A narrowed band now counts what it shows against the unnarrowed class
("12 av 43 visas" / "12 of 43 shown"); an unnarrowed band keeps the
active ratio unchanged. Search and the Verifikat filter narrow Mina
konton; search narrows the BAS catalog. The K2 toggle is treated as
scope rather than a filter, since it defaults from the company's
regelverk and would otherwise flip every catalog band for K2
companies without the user touching anything.
Fixes #2263
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015qgLgdt4mLmha1ZLFMwq1u
* fix(kontoplan): remove the per-class active counter
The band row in Kontoplan rendered "{active}/{total} aktiva" from the
already-filtered class group, so under the Verifikat filter (#2231) or
a search it always read "N/N aktiva": full coverage of a class that
was really a subset. The reporter asked for the text to go, and the
issue offered removal as one of its two fixes.
Removing the counter is the fix from first principles: nothing consumes
it, the tab chip and the page footer ("Visar N av M konton") already
carry the only counts the page needs, and a counter that does not exist
cannot drift from the list again. This drops the countLabel parameter
from bandRow, the activeCount and activatedCount derivations, and the
now-unused chart_of_accounts.active_count_label key in both locales.
It also reverts the filtered-mode helper and memo split from the first
commit on this branch.
Fixes #2263
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015qgLgdt4mLmha1ZLFMwq1u
---------
Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
Jakob Wennberg
parent
f96a445d88
commit
7a9036caa6
@@ -553,11 +553,13 @@ export default function ChartOfAccountsManager() {
|
||||
}
|
||||
|
||||
// Concept band row (Klass N: label), clickable to fold the class away.
|
||||
// It carries no per-class counter: the old "{active}/{total} aktiva" was
|
||||
// derived from the filtered list and read as full coverage under the
|
||||
// Verifikat filter (#2263). Shown/total lives once, in the page footer.
|
||||
const bandRow = (
|
||||
cls: number,
|
||||
open: boolean,
|
||||
onToggle: () => void,
|
||||
countLabel: string,
|
||||
colSpan: number,
|
||||
) => (
|
||||
<tr key={`band-${cls}`}>
|
||||
@@ -570,7 +572,6 @@ export default function ChartOfAccountsManager() {
|
||||
>
|
||||
<ChevronRight className={cn('h-3 w-3 shrink-0 transition-transform duration-200', open && 'rotate-90')} />
|
||||
{t('class_heading', { cls, label: classLabel(cls) })}
|
||||
<span className="font-normal normal-case tabular-nums">{countLabel}</span>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -717,16 +718,9 @@ export default function ChartOfAccountsManager() {
|
||||
.map(([cls, classAccounts]) => {
|
||||
const classNum = Number(cls)
|
||||
const open = !collapsedMyClasses.has(classNum) || !!searchQuery
|
||||
const activeCount = classAccounts.filter((a) => a.is_active).length
|
||||
return (
|
||||
<Fragment key={cls}>
|
||||
{bandRow(
|
||||
classNum,
|
||||
open,
|
||||
() => toggleMyClass(classNum),
|
||||
t('active_count_label', { active: activeCount, total: classAccounts.length }),
|
||||
8,
|
||||
)}
|
||||
{bandRow(classNum, open, () => toggleMyClass(classNum), 8)}
|
||||
{open &&
|
||||
classAccounts.map((account) => (
|
||||
<tr
|
||||
@@ -867,19 +861,9 @@ export default function ChartOfAccountsManager() {
|
||||
.map(([cls, classAccounts]) => {
|
||||
const classNum = Number(cls)
|
||||
const open = expandedCatalogClasses.has(classNum) || !!searchQuery
|
||||
// Row existence alone is not activation: a deactivated
|
||||
// account is in the chart but not usable, so it must not
|
||||
// count as active here either.
|
||||
const activatedCount = classAccounts.filter((a) => a.is_activated && a.is_active).length
|
||||
return (
|
||||
<Fragment key={cls}>
|
||||
{bandRow(
|
||||
classNum,
|
||||
open,
|
||||
() => toggleCatalogClass(classNum),
|
||||
t('active_count_label', { active: activatedCount, total: classAccounts.length }),
|
||||
5,
|
||||
)}
|
||||
{bandRow(classNum, open, () => toggleCatalogClass(classNum), 5)}
|
||||
{open &&
|
||||
classAccounts.map((account) => (
|
||||
<tr
|
||||
|
||||
@@ -5348,7 +5348,6 @@
|
||||
"system_badge": "System",
|
||||
"activated": "Activated",
|
||||
"add": "Add",
|
||||
"active_count_label": "{active}/{total} active",
|
||||
"no_matches": "No accounts match the search",
|
||||
"no_accounts": "No accounts in the chart",
|
||||
"delete_confirm_title": "Delete account?",
|
||||
|
||||
@@ -5348,7 +5348,6 @@
|
||||
"system_badge": "System",
|
||||
"activated": "Aktiverat",
|
||||
"add": "Lägg till",
|
||||
"active_count_label": "{active}/{total} aktiva",
|
||||
"no_matches": "Inga konton matchar sökningen",
|
||||
"no_accounts": "Inga konton i kontoplanen",
|
||||
"delete_confirm_title": "Ta bort konto?",
|
||||
|
||||
Reference in New Issue
Block a user