feat(bookkeeping): page-size selector + First/Last pagination on verifikationslista (#738) (#743)

* feat(bookkeeping): page-size selector + First/Last pagination on verifikationslista

Closes #738.

The voucher list (verifikationslista) had a hardcoded page size of 20 and only
Previous/Next buttons. Adds:

- Page-size selector: 20 / 50 / 100 / Alla. Persisted per company in
  localStorage (same convention as the sort order and FiscalYearSelector) and
  hydrated in an effect so the first fetch already uses the saved size.
  "Alla" loads everything in the current scope and hides the pager.
- Pagination footer: First / Previous / Next / Last icon buttons, a page
  indicator, and a "Visar 1–20 av N" result-range label.
- Server: clamp limit to [1, 100000] and offset to >=0 so "Alla" sends a
  bounded large limit (defense in depth, ASVS V1.2.5).

Sorting asc/desc on date and voucher already existed in the filter dialog;
amount-column sorting is intentionally out of scope (journal_entries has no
stored total — the voucher amount is summed client-side from debit lines — so
ordering by it needs a schema change).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(bookkeeping): keep page-size selector reachable + clarify offset clamp

Addresses PR review feedback:

- Pagination footer now shows whenever a non-default page size (50/100/Alla)
  is active, not only when count > 20. A user who picks a larger size and then
  filters the list below 20 rows can still switch the size back. Default-20
  users are unchanged — no selector under 21 rows. Empty results stay hidden.
- offset clamp reads `rawOffset >= 0` instead of `> 0` (behaviour identical;
  clearer intent).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jakob Wennberg
2026-06-16 15:31:46 +02:00
committed by GitHub
co-authored by Claude Opus 4.8
parent 36e3f6ceb0
commit 45b31ad50f
5 changed files with 160 additions and 28 deletions
+6
View File
@@ -3031,7 +3031,13 @@
"no_results_description": "No journal entries match your filters. Adjust your search or clear the filters.",
"previous": "Previous",
"next": "Next",
"first_page": "First page",
"last_page": "Last page",
"page_of": "Page {page} of {total}",
"page_size_label": "Rows per page",
"page_size_all": "All",
"showing_range": "Showing {from}–{to} of {total}",
"showing_all": "Showing all {total}",
"read_only_tooltip": "You have read-only access to this company",
"toast_posted_title": "Journal entry posted",
"toast_posted_description": "Journal entry {voucher} has been posted.",
+6
View File
@@ -3031,7 +3031,13 @@
"no_results_description": "Inga verifikationer matchar dina filter. Justera sökningen eller rensa filtren.",
"previous": "Föregående",
"next": "Nästa",
"first_page": "Första sidan",
"last_page": "Sista sidan",
"page_of": "Sida {page} av {total}",
"page_size_label": "Rader per sida",
"page_size_all": "Alla",
"showing_range": "Visar {from}–{to} av {total}",
"showing_all": "Visar alla {total}",
"read_only_tooltip": "Du har endast läsbehörighet i detta företag",
"toast_posted_title": "Verifikat bokfört",
"toast_posted_description": "Verifikat {voucher} har bokförts.",