Report year selectors: offer the business's years (initialAccounterYear → current year), disable unsupported ones

Open
#5,228 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
react, typescript
Domain
frontend, testing

Research direction

Start with packages/client/src/components/screens/reports/form-1214-report/years.ts, packages/client/src/components/screens/reports/shaam-6111-report/years.ts, and common/inputs/year-picker-input.tsx. Look for a shared helper that builds year options from initialAccounterYear or dateEstablished, plus unit tests, then update each report wrapper and its URL-year fallback. Done means the business-year range is displayed, unsupported years are disabled with a reason where known, used URL years remain selected, and the latest enabled year is the default.

Written by the indexing model from the issue text.

Description

Problem

Report year selectors don't reflect the years the active business actually has in Accounter:

  • Form 1214 (packages/client/src/components/screens/reports/form-1214-report/years.ts, coming in #5190): the select lists only report1214SupportedYears (the years @accounter/opcn1214-generator has a layout for — currently 2024, 2025). Any other year of the business is missing, and a ?year= outside that list silently falls back to the latest supported year.
  • SHAAM 6111 (packages/client/src/components/screens/reports/shaam-6111-report/years.ts): getShaam6111AvailableYears hard-codes FIRST_REPORT_YEAR = 2020 for every tenant, regardless of when the business started.
  • Tax report, profit & loss, corporate-tax-ruling compliance, yearly ledger, annual revenue: use the free YearPickerInput (common/inputs/year-picker-input.tsx), with no lower/upper bound at all.

Desired behaviour

  1. Range = the business's years. Every report's year selector lists every year from the admin business's initialAccounterYear (the year it was onboarded to Accounter, already exposed on adminContext) through the current year.
  2. Unsupported years are shown but disabled. A year in that range that the specific report cannot produce stays in the list, disabled (ideally with a short reason, e.g. "No 1214 layout for 2023 yet" / "Year not closed").
  3. Report-specific adjustments decide which years in the range are enabled, e.g.:
    • 1214: enabled ⇔ year ∈ report1214SupportedYears.
    • 6111: closed years only (≤ last year), as today; the current year is listed but disabled. Drop the hard-coded 2020.
    • Tax report / others: decide per report (e.g. a tax-rate table or layout that only exists from some year on; current year may be allowed as an in-progress report).
  4. Fallbacks: if initialAccounterYear is not set, fall back to dateEstablished's year, then to the current behaviour (today's lower bound). Years already in use through the URL (?year=, reference/comparison year) stay listed so selects never render blank, as getShaam6111AvailableYears does today. The default selection is the latest enabled year.

Suggested approach

  • A shared client helper, e.g. getReportYearOptions({ firstYear, currentYear, isSupported, keepYears }) → { year, disabled, reason? }[] (latest first), with unit tests. It replaces the per-report years.ts logic (keep thin per-report wrappers for the isSupported rule).
  • A small hook/query that reads adminContext { initialAccounterYear dateEstablished } once (shared by all reports).
  • A year Select (or YearPickerInput bounds/disabled option) that renders disabled items, used by 1214, 6111 and the YearPickerInput-based reports.

Scope / checklist

  • Shared year-options helper + tests
  • Form 1214 report (after #5190 lands)
  • SHAAM 6111 report
  • Tax report
  • Other annual reports using YearPickerInput (P&L, corporate-tax-ruling compliance, yearly ledger, annual revenue): apply the business-years range and any report-specific limits
  • Annual audit links that pass ?year=: an unsupported year shows as disabled + notice instead of silently switching
Dominant language
TypeScript
Stars
30
Forks
10
Avg merge
2d 12h
Merged PRs (30d)
276

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Urigo/accounter-fullstack

All issues in Urigo/accounter-fullstack

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.