From d68b6c5ffd74488c58d6c996232432f8a800c5c6 Mon Sep 17 00:00:00 2001
From: Aki Kuivas <91662678+asku1990@users.noreply.github.com>
Date: Thu, 23 Jul 2026 10:56:32 +0300
Subject: [PATCH 1/8] docs/bej-103-creation-planning
ref bej-103
---
docs/planning/trials/README.md | 21 ++-
docs/planning/trials/later-ux.md | 10 +-
.../trials/result-creation-guided-ux.md | 145 +++++++++++++++++
.../trials/result-fields-by-rule-window.md | 153 ++++++++++--------
4 files changed, 258 insertions(+), 71 deletions(-)
create mode 100644 docs/planning/trials/result-creation-guided-ux.md
diff --git a/docs/planning/trials/README.md b/docs/planning/trials/README.md
index 19878253..bb3e6cc8 100644
--- a/docs/planning/trials/README.md
+++ b/docs/planning/trials/README.md
@@ -19,9 +19,13 @@ on the next gate.
identity, transaction, error, date-only, and Server Action backend contract.
- [Result creation R2](./result-creation-r2.md) defines the full-page result
form and admin UI workflow built on the approved R1 contract.
-- [Rule-window-aware result fields](./result-fields-by-rule-window.md) defines
- the second result-creation follow-up after R2: introduce field-set selection
- for every rule window and verify the 2023+ set first.
+- [Rule-window-aware result creation](./result-fields-by-rule-window.md)
+ defines R3A: make the existing result-create form use the event's persisted
+ rule window, verify the 2023+ field set, and retain a warned show-all
+ fallback for other windows.
+- [Guided result-creation UX](./result-creation-guided-ux.md) defines R3B:
+ replace only the full-page result-create form with a four-step workflow
+ after R3A has been reviewed.
- [Later UX](./later-ux.md) records deferred ideas only and does not authorize
their implementation.
@@ -66,6 +70,9 @@ Repository guardrails and current feature documentation:
adding another result to the same event and finishing at the event workspace.
- The existing trials master-detail list and existing result-edit modal remain
in place for BEJ-103.
+- Rule-window-aware presentation is introduced for result creation before any
+ result-editing redesign. Existing result editing remains unchanged through
+ R3A and R3B.
## Implementation order and review rules
@@ -80,14 +87,17 @@ R1 (backend)
↓
R2 (UI)
↓
-R3 (rule-window field sets)
+R3A (rule-window-aware creation)
+ ↓
+R3B (guided creation UX)
```
1. `E1` - event workspace
2. `E2` - event creation and empty-event lifecycle
3. `R1` - manual result schema and backend
4. `R2` - manual result UI and workflow
-5. `R3` - rule-window-aware result fields, after R2 review
+5. `R3A` - rule-window-aware result creation, after R2 review
+6. `R3B` - guided result-creation UX, after R3A review
For every gate:
@@ -108,6 +118,7 @@ BEJ-103 does not authorize:
- changes to trial statistics or their calculation;
- redesign of legacy import or Koiratietokanta ingestion;
- redesign of existing result editing;
+- rule-window-aware result editing;
- batch entry of several unsaved dog results;
- a draft/publish workflow;
- autosave;
diff --git a/docs/planning/trials/later-ux.md b/docs/planning/trials/later-ux.md
index 76170f9a..74f4e884 100644
--- a/docs/planning/trials/later-ux.md
+++ b/docs/planning/trials/later-ux.md
@@ -16,6 +16,10 @@ the review rules in the [BEJ-103 planning overview](./README.md).
index.
- Move editing of existing results from the modal to the reusable full-page
result form.
+- Make existing result editing rule-window-aware, including preservation of
+ stored fields hidden by a narrower verified field set.
+- Redesign result editing only after the R3A and R3B creation gates have been
+ implemented, validated, and reviewed.
- Add searchable dog selection to manual result creation.
- Allow inline dog creation from the result flow.
- Add an explicit draft/publish state for trial events or results.
@@ -27,8 +31,10 @@ the review rules in the [BEJ-103 planning overview](./README.md).
- E1 and E2 retain the existing trials master-detail list.
- R1 and R2 retain the existing result-edit modal.
-- R2 uses a free-text registration field and saves one complete result at a
- time.
+- R2, R3A, and R3B use a free-text registration field and save one complete
+ result at a time.
+- R3A and R3B do not change result editing. Older, null, and unknown rule
+ windows use the warned show-all fallback only in result creation.
- Matching Koiratietokanta upserts are resolved by the authoritative backend
behavior documented in [Result creation](./result-creation.md), without a
manual reconciliation screen.
diff --git a/docs/planning/trials/result-creation-guided-ux.md b/docs/planning/trials/result-creation-guided-ux.md
new file mode 100644
index 00000000..41f36eab
--- /dev/null
+++ b/docs/planning/trials/result-creation-guided-ux.md
@@ -0,0 +1,145 @@
+# Follow-up R3B — Guided Result-Creation UX
+
+## Status and sequencing
+
+This is the second creation follow-up after R2. It is planning only and does
+not authorize implementation.
+
+R3A must be implemented, validated, reviewed, and approved before R3B begins.
+R3B consumes the R3A field-set registry and changes only the full-page
+result-create experience. Existing result editing remains unchanged.
+
+## Purpose
+
+Replace the long result-create form with a guided, mobile-capable workflow
+that keeps event context visible, presents only the selected rule window's
+fields, and provides a clear review step before the one atomic save.
+
+## Four-step creation flow
+
+The create route keeps one in-memory draft across four steps:
+
+1. **Perustiedot**
+ - Show read-only event date, place, SKL ID, and rule-window information.
+ - Enter registration, trial/dog metadata, owner snapshots, and
+ judge/signature fields.
+2. **Tulos ja pisteet**
+ - Enter result, status, score, total, note, and era fields allowed by the
+ R3A field set.
+3. **Lisätiedot**
+ - Select and enter the rule-window-specific per-era lisätiedot.
+4. **Yhteenveto**
+ - Review a structured, print-friendly representation of the unsaved
+ request before submission.
+
+No database write occurs when changing steps. The create mutation is called
+only from the summary step.
+
+Backward navigation is always allowed and retains the draft. Moving forward
+validates the current step. Completed steps may be reopened directly; future
+steps cannot be skipped.
+
+## Lisätiedot interaction
+
+- Group rows by the real PDF domains:
+ - Olosuhteet
+ - Haku
+ - Haukku
+ - Metsästysinto
+ - Ajo
+ - Muut ominaisuudet
+- Support search by localized name or code, domain filtering, group
+ expand/collapse, expand all, selected-row chips, and clearing selections.
+- Show the lisätieto code before its localized name.
+- Use localized value-kind or unit guidance. Do not invent descriptive
+ business text that has no authoritative repository source.
+- Selecting a row reveals one control per current era:
+ - marker fields use checkbox-style controls;
+ - integer and decimal fields use matching numeric input modes; and
+ - the unverified fallback can continue to expose text inputs where its
+ generic configuration requires them.
+- Removing a selected row clears its unsaved era values and excludes it from
+ the request.
+- On desktop, keep the selected-row summary visible beside the groups when
+ space permits. On mobile, render the same information above the stacked
+ group cards.
+- Show the current rule-window label and technical ID as read-only context.
+ Show the R3A unverified warning for fallback field sets.
+
+## Review, save, and errors
+
+- The summary displays event identity, registration/basic data, result and
+ era values, and selected non-empty lisätiedot.
+- Do not add an unsaved official-PDF preview contract. The existing official
+ PDF remains available only after a saved entry has an ID.
+- Preserve the existing two successful submission paths:
+ - **Save and add another** creates one result, then resets to step 1 with
+ event-level judge defaults restored.
+ - **Save and finish** creates one result and returns to the event workspace.
+- Preserve duplicate-submit protection, Server Action mutation behavior,
+ query invalidation/refetch, and the rule against optimistic partial cache
+ insertion.
+- Stable backend validation errors return to the populated relevant step:
+ registration/basic errors to step 1, entry/era errors to step 2, and
+ lisätieto errors to step 3.
+- Event-not-found and missing-SKL errors retain their event-level states.
+ Authentication and authorization retain the existing admin behavior.
+- Preserve the existing dirty internal-navigation confirmation and native
+ refresh/tab-close protection across every step. Browser Back retains the R2
+ behavior.
+- Add Finnish and Swedish labels, value hints, validation messages, success
+ feedback, and error feedback for the redesigned creation flow.
+- Add a user-visible `CHANGELOG.md` entry and update durable admin-trial
+ documentation when implemented.
+
+## Exclusions
+
+- No result-edit UI or rule-window-aware editing.
+- No migration of the edit modal to the guided flow.
+- No unsaved PDF generation or new PDF preview endpoint.
+- No searchable dog picker, inline dog creation, batch creation, autosave,
+ draft/publish state, or reconciliation UI.
+- No Prisma schema, backend write-contract, server-validation, PDF renderer,
+ or Koiratietokanta ingestion changes.
+- No new production dependency.
+- No redesign of the trials index or event workspace.
+
+## Acceptance criteria
+
+- Creation uses the R3A field set for the event's persisted rule window.
+- The four steps retain one draft and enforce forward validation without
+ writing before the summary.
+- Search, filtering, grouping, selection chips, and per-era inputs work with
+ both the verified current field set and the warned fallback.
+- The summary represents the final create request without offering an unsaved
+ official PDF.
+- Stable errors return to the correct populated step without losing values.
+- Save-and-add-another and save-and-finish retain their existing persistence,
+ reset, navigation, and cache behavior.
+- Dirty navigation protection works throughout the flow.
+- The workflow is usable at desktop and mobile widths in Finnish and Swedish.
+- The existing result-edit modal behaves exactly as before.
+
+## Targeted validation
+
+- Form-model tests for step ownership, forward validation, backward
+ navigation, completed-step navigation, reset, and draft retention.
+- Lisätieto tests for search, filtering, grouping, selection/removal,
+ per-era controls, corrected input kinds, and mobile/desktop summaries.
+- Summary tests proving parity with the serialized create request.
+- Mutation tests for stable error-to-step mapping, success continuations,
+ duplicate-submit protection, invalidation/refetch, and no optimistic row.
+- Navigation tests for dirty cancel, internal links, browser Back, and native
+ refresh/close protection.
+- Regression tests for event-level missing/error states, the event workspace,
+ selected-event panel, and existing result-edit modal.
+- Targeted web type checking, unit/component tests, and lint without cycle
+ lint.
+- Manual desktop and mobile browser checks for all four steps and both
+ successful continuations when browser tooling is available.
+
+## Merge independence and review gate
+
+R3B can merge after R3A without any result-editing work. Stop after validation
+and request creation-flow review. Editing remains a separately planned and
+approved follow-up.
diff --git a/docs/planning/trials/result-fields-by-rule-window.md b/docs/planning/trials/result-fields-by-rule-window.md
index 937e7e33..b3306d98 100644
--- a/docs/planning/trials/result-fields-by-rule-window.md
+++ b/docs/planning/trials/result-fields-by-rule-window.md
@@ -1,108 +1,133 @@
-# Follow-up R3 — Rule-window-aware Result Fields
+# Follow-up R3A — Rule-Window-Aware Result Creation
## Status and sequencing
-This is the second result-creation follow-up after the current R2 implementation
-and validation work. It is planning only and does not authorize implementation.
+This is the first creation follow-up after R2. It is planning only and does
+not authorize implementation.
-R2 must be completed and reviewed before this work begins. The initial R3
-change introduces the rule-window structure and verifies only the current
-2023+ field set. Exact historical field-set audits remain separate follow-up
-work.
+R2 must be completed and reviewed before this work begins. R3A introduces the
+rule-window field-set structure only for the existing full-page result-create
+form and verifies the current 2023+ field set. R3B may redesign result
+creation only after R3A has been implemented, validated, and reviewed.
+
+Existing result editing remains unchanged. Rule-window-aware editing and edit
+UX are deferred work recorded in [Later UX](./later-ux.md).
## Purpose
-Make manual trial result creation and editing choose their visible score, era,
-and lisätieto fields from the event's persisted `trialRuleWindowId`. This keeps
-the current form aligned with the corresponding dog-trial PDF without coupling
-form behavior to PDF coordinates.
+Make manual trial result creation choose its visible score, era, and
+lisätieto fields from the event's persisted `trialRuleWindowId`. This aligns
+new 2023+ results with the corresponding dog-trial PDF before changing the
+creation UI.
The current mismatch is structural:
-- PDF rendering already selects a renderer by rule window, while the admin form
- uses one global field list.
-- The 2023+ renderer does not print the current form's `tja` and `pin` score
+- PDF rendering already selects a renderer by rule window, while the admin
+ create form uses one global field list.
+- The 2023+ renderer does not print the create form's `tja` and `pin` score
fields.
- The current PDF consumes only part `a` for lisätieto codes `25` and `27`,
while the form exposes parts `a`, `b`, and `c`.
-- Lisätieto input types differ for codes `19`, `23`, `26`, and `59`.
-- Historical templates contain different score and lisätieto sets.
+- Create-form lisätieto input kinds differ from the renderer for codes `19`,
+ `23`, `26`, and `59`.
+- Historical templates contain different score and lisätieto sets, but their
+ exact create-form configurations have not been audited.
## Scope
- Add `trialRuleWindowId` to the admin event-detail contract and propagate the
stored value through the DB and service mappings.
-- Add a semantic admin result field-set registry covering every seeded rule
+- Add a semantic result-create field-set registry covering every seeded rule
window ID.
+- Resolve the create field set from the event's persisted
+ `trialRuleWindowId`, never from the browser or by recalculating from the
+ event date.
- Keep PDF coordinates and drawing logic inside the PDF rule-set modules. The
- shared semantic configuration defines field availability and value kinds,
- not layout.
+ create registry defines field availability and value kinds, not layout.
- Configure `trw_post_20230801` as the first verified field set:
- - drive visible entry score fields, era fields, and lisätieto rows from the
- configuration;
- - omit current-window score fields not consumed by the 2023+ PDF;
- - represent codes `25` and `27` with the PDF-consumed `a` part without showing
- the implementation suffix to the administrator;
- - correct lisätieto value kinds to match the current renderer; and
- - retain shared registration, owner, judge, result-status, trial-type, and
- other metadata required by persistence or PDF generation.
-- Register other known, null, and unknown rule windows through one explicitly
- unverified fallback matching the current form behavior. Show a localized
- warning instead of presenting the fallback as template-verified.
-- Apply the selected field set to both the full-page create form and the
- existing edit modal.
-- Preserve hidden values when editing an existing result. Selecting a narrower
- field set must not silently clear compatibility data or source-projected
- lisätieto rows.
+ - retain the existing registration, event/result metadata, owner, judge,
+ status, note, total, and other persistence fields required by creation and
+ PDF generation;
+ - omit entry- and era-level `tja` and `pin` score fields;
+ - expose lisätieto codes `10`–`27`, `30`–`42`, and `50`–`62`;
+ - represent codes `25` and `27` with only their PDF-consumed `a` part,
+ displayed as a single row without an implementation suffix;
+ - use integer input for code `19`, decimal input for codes `23`, `26`, and
+ `59`, and retain the renderer-compatible kinds for all other rows; and
+ - keep the existing continuous-era behavior: start with one era and permit
+ additional eras without a create-form maximum, even though the current
+ PDF renders only eras 1 and 2.
+- Register older known, null, and unknown rule windows through one explicitly
+ unverified fallback matching the current show-all create-form behavior.
+- Show a localized warning whenever the unverified fallback is active.
+- Pass field-set configuration only into the result-create flow. Shared
+ components must keep their current default behavior so the existing edit
+ modal is unaffected.
- Keep backend write shapes and their existing validation semantics unchanged.
- This gate controls admin presentation and does not add rule-window-specific
+ R3A controls create-form presentation and does not add rule-window-specific
server rejection.
-- Update the durable admin-trial documentation and add a user-visible
- `CHANGELOG.md` entry when the behavior is implemented.
+- Update durable admin-trial documentation and add a user-visible
+ `CHANGELOG.md` entry when implemented.
## Exclusions
+- No result-create layout or navigation redesign.
+- No changes to the existing result-edit modal, its visible fields, or its
+ serialization behavior.
+- No rule-window-aware result editing or hidden-value preservation work.
- No Prisma schema or migration changes.
- No new production dependency.
-- No PDF coordinate or template changes.
-- No claim that 2005–2011 or 2011–2023 admin field sets are exact.
+- No PDF coordinate, mapper, template, or rendering changes.
+- No exact 2005–2011, 2011–2023, pre-2002, or 2002–2005 field-set claim.
- No removal or migration of stored compatibility fields.
-- No rule-window-specific validation in Koiratietokanta ingestion.
-- No redesign of result creation or the existing edit modal.
+- No rule-window-specific backend validation or Koiratietokanta ingestion
+ changes.
## Acceptance criteria
- Admin event details return the event's persisted `trialRuleWindowId`.
-- Create and edit resolve their field set from that stored ID rather than from
- the browser date.
-- A 2023+ event displays the verified score, era, and lisätieto configuration.
+- Result creation resolves its field set from that stored ID.
+- A 2023+ create form displays the verified score, era, and lisätieto
+ configuration.
- Codes `25` and `27` persist with part `a`, appear as single rows, and reach
the existing PDF pivot correctly.
-- Current-window lisätieto value kinds match the 2023+ renderer.
-- Other known, null, and unknown windows retain the existing generic editing
+- Current-window lisätieto input kinds match the 2023+ renderer.
+- Additional continuous eras remain available in the create form.
+- Older known, null, and unknown windows retain the existing generic creation
capability and display an unverified-field-set warning.
-- Editing through a narrower field set preserves hidden existing values.
-- Existing create/update request contracts and server validation behavior do
- not change.
+- Existing create request contracts and server validation behavior do not
+ change.
+- The existing edit modal renders and submits exactly as before.
## Targeted validation
-- Contract, DB-mapping, and service tests for `trialRuleWindowId` in admin event
- details.
-- Field-registry tests covering every seeded rule-window ID and fallback
- behavior.
-- 2023+ parity tests for visible score fields, era fields, lisätieto codes,
+- Contract, DB-mapping, and service tests for `trialRuleWindowId` in admin
+ event details.
+- Field-registry tests covering every seeded rule-window ID and null/unknown
+ fallback behavior.
+- 2023+ parity tests for visible entry fields, era fields, lisätieto codes,
parts, ordering, and input kinds.
-- Create-form and edit-modal tests for rule selection, the fallback warning,
- and hidden-value preservation.
-- Regression tests for request serialization, current validation feedback, and
- PDF part-`a` mapping.
+- Create-form tests for persisted-rule selection, fallback warning, unlimited
+ continuous eras, and request serialization.
+- Regression tests proving the edit modal retains its current complete field
+ set and request serialization.
+- PDF pivot regression tests for part `a` of codes `25` and `27`.
- Targeted web, contracts, server, and DB type checks and tests, plus targeted
lint without cycle lint.
-## Later historical audit
+## Merge independence and review gate
+
+R3A can merge independently after R2. It changes only the semantic
+presentation of result creation and leaves result editing unchanged.
+
+Stop after validation and request explicit review. Do not begin the guided
+creation UX in R3B without separate approval.
+
+## Later historical and edit work
+
+After the creation gates are reviewed, plan result editing separately. That
+work must define rule-window selection, hidden stored-value preservation, and
+the edit interaction before changing the existing modal.
-After R3 is reviewed, separately compare the 2005–2011 and 2011–2023 PDF
-templates and renderers with stored legacy/API data. Replace the unverified
-fallback for each window only after its score fields, supported era behavior,
-lisätieto rows, value kinds, and preservation behavior have dedicated tests.
+Historical create/edit field sets also require separate audits against the
+2005–2011, 2011–2023, pre-2002, and 2002–2005 templates and source data.
From 873c294d3e99caeb43defd3e953fee5112c7b73f Mon Sep 17 00:00:00 2001
From: Aki Kuivas <91662678+asku1990@users.noreply.github.com>
Date: Thu, 23 Jul 2026 11:14:18 +0300
Subject: [PATCH 2/8] docs(trials): refine rule-window creation UX plans
ref bej-103
---
docs/planning/trials/README.md | 10 +-
docs/planning/trials/later-ux.md | 5 +
.../trials/result-creation-guided-ux.md | 145 -----------
docs/planning/trials/result-creation-ux.md | 235 ++++++++++++++++++
.../trials/result-fields-by-rule-window.md | 39 ++-
5 files changed, 280 insertions(+), 154 deletions(-)
delete mode 100644 docs/planning/trials/result-creation-guided-ux.md
create mode 100644 docs/planning/trials/result-creation-ux.md
diff --git a/docs/planning/trials/README.md b/docs/planning/trials/README.md
index bb3e6cc8..79db8678 100644
--- a/docs/planning/trials/README.md
+++ b/docs/planning/trials/README.md
@@ -23,9 +23,9 @@ on the next gate.
defines R3A: make the existing result-create form use the event's persisted
rule window, verify the 2023+ field set, and retain a warned show-all
fallback for other windows.
-- [Guided result-creation UX](./result-creation-guided-ux.md) defines R3B:
- replace only the full-page result-create form with a four-step workflow
- after R3A has been reviewed.
+- [Result-creation UX](./result-creation-ux.md) defines R3B: evolve the
+ existing full-page create form into a clearer card-based single-page
+ experience after R3A has been reviewed.
- [Later UX](./later-ux.md) records deferred ideas only and does not authorize
their implementation.
@@ -89,7 +89,7 @@ R2 (UI)
↓
R3A (rule-window-aware creation)
↓
-R3B (guided creation UX)
+R3B (result-creation UX)
```
1. `E1` - event workspace
@@ -97,7 +97,7 @@ R3B (guided creation UX)
3. `R1` - manual result schema and backend
4. `R2` - manual result UI and workflow
5. `R3A` - rule-window-aware result creation, after R2 review
-6. `R3B` - guided result-creation UX, after R3A review
+6. `R3B` - card-based result-creation UX, after R3A review
For every gate:
diff --git a/docs/planning/trials/later-ux.md b/docs/planning/trials/later-ux.md
index 74f4e884..9f3db1c4 100644
--- a/docs/planning/trials/later-ux.md
+++ b/docs/planning/trials/later-ux.md
@@ -20,6 +20,9 @@ the review rules in the [BEJ-103 planning overview](./README.md).
stored fields hidden by a narrower verified field set.
- Redesign result editing only after the R3A and R3B creation gates have been
implemented, validated, and reviewed.
+- If a guided or multi-step result flow is adopted later, implement it as a
+ coordinator that controls visibility of the reusable R3B cards rather than
+ rewriting their field presentation.
- Add searchable dog selection to manual result creation.
- Allow inline dog creation from the result flow.
- Add an explicit draft/publish state for trial events or results.
@@ -35,6 +38,8 @@ the review rules in the [BEJ-103 planning overview](./README.md).
result at a time.
- R3A and R3B do not change result editing. Older, null, and unknown rule
windows use the warned show-all fallback only in result creation.
+- R3B keeps result creation on one page; a wizard or mandatory multi-step
+ coordinator is not part of the current gates.
- Matching Koiratietokanta upserts are resolved by the authoritative backend
behavior documented in [Result creation](./result-creation.md), without a
manual reconciliation screen.
diff --git a/docs/planning/trials/result-creation-guided-ux.md b/docs/planning/trials/result-creation-guided-ux.md
deleted file mode 100644
index 41f36eab..00000000
--- a/docs/planning/trials/result-creation-guided-ux.md
+++ /dev/null
@@ -1,145 +0,0 @@
-# Follow-up R3B — Guided Result-Creation UX
-
-## Status and sequencing
-
-This is the second creation follow-up after R2. It is planning only and does
-not authorize implementation.
-
-R3A must be implemented, validated, reviewed, and approved before R3B begins.
-R3B consumes the R3A field-set registry and changes only the full-page
-result-create experience. Existing result editing remains unchanged.
-
-## Purpose
-
-Replace the long result-create form with a guided, mobile-capable workflow
-that keeps event context visible, presents only the selected rule window's
-fields, and provides a clear review step before the one atomic save.
-
-## Four-step creation flow
-
-The create route keeps one in-memory draft across four steps:
-
-1. **Perustiedot**
- - Show read-only event date, place, SKL ID, and rule-window information.
- - Enter registration, trial/dog metadata, owner snapshots, and
- judge/signature fields.
-2. **Tulos ja pisteet**
- - Enter result, status, score, total, note, and era fields allowed by the
- R3A field set.
-3. **Lisätiedot**
- - Select and enter the rule-window-specific per-era lisätiedot.
-4. **Yhteenveto**
- - Review a structured, print-friendly representation of the unsaved
- request before submission.
-
-No database write occurs when changing steps. The create mutation is called
-only from the summary step.
-
-Backward navigation is always allowed and retains the draft. Moving forward
-validates the current step. Completed steps may be reopened directly; future
-steps cannot be skipped.
-
-## Lisätiedot interaction
-
-- Group rows by the real PDF domains:
- - Olosuhteet
- - Haku
- - Haukku
- - Metsästysinto
- - Ajo
- - Muut ominaisuudet
-- Support search by localized name or code, domain filtering, group
- expand/collapse, expand all, selected-row chips, and clearing selections.
-- Show the lisätieto code before its localized name.
-- Use localized value-kind or unit guidance. Do not invent descriptive
- business text that has no authoritative repository source.
-- Selecting a row reveals one control per current era:
- - marker fields use checkbox-style controls;
- - integer and decimal fields use matching numeric input modes; and
- - the unverified fallback can continue to expose text inputs where its
- generic configuration requires them.
-- Removing a selected row clears its unsaved era values and excludes it from
- the request.
-- On desktop, keep the selected-row summary visible beside the groups when
- space permits. On mobile, render the same information above the stacked
- group cards.
-- Show the current rule-window label and technical ID as read-only context.
- Show the R3A unverified warning for fallback field sets.
-
-## Review, save, and errors
-
-- The summary displays event identity, registration/basic data, result and
- era values, and selected non-empty lisätiedot.
-- Do not add an unsaved official-PDF preview contract. The existing official
- PDF remains available only after a saved entry has an ID.
-- Preserve the existing two successful submission paths:
- - **Save and add another** creates one result, then resets to step 1 with
- event-level judge defaults restored.
- - **Save and finish** creates one result and returns to the event workspace.
-- Preserve duplicate-submit protection, Server Action mutation behavior,
- query invalidation/refetch, and the rule against optimistic partial cache
- insertion.
-- Stable backend validation errors return to the populated relevant step:
- registration/basic errors to step 1, entry/era errors to step 2, and
- lisätieto errors to step 3.
-- Event-not-found and missing-SKL errors retain their event-level states.
- Authentication and authorization retain the existing admin behavior.
-- Preserve the existing dirty internal-navigation confirmation and native
- refresh/tab-close protection across every step. Browser Back retains the R2
- behavior.
-- Add Finnish and Swedish labels, value hints, validation messages, success
- feedback, and error feedback for the redesigned creation flow.
-- Add a user-visible `CHANGELOG.md` entry and update durable admin-trial
- documentation when implemented.
-
-## Exclusions
-
-- No result-edit UI or rule-window-aware editing.
-- No migration of the edit modal to the guided flow.
-- No unsaved PDF generation or new PDF preview endpoint.
-- No searchable dog picker, inline dog creation, batch creation, autosave,
- draft/publish state, or reconciliation UI.
-- No Prisma schema, backend write-contract, server-validation, PDF renderer,
- or Koiratietokanta ingestion changes.
-- No new production dependency.
-- No redesign of the trials index or event workspace.
-
-## Acceptance criteria
-
-- Creation uses the R3A field set for the event's persisted rule window.
-- The four steps retain one draft and enforce forward validation without
- writing before the summary.
-- Search, filtering, grouping, selection chips, and per-era inputs work with
- both the verified current field set and the warned fallback.
-- The summary represents the final create request without offering an unsaved
- official PDF.
-- Stable errors return to the correct populated step without losing values.
-- Save-and-add-another and save-and-finish retain their existing persistence,
- reset, navigation, and cache behavior.
-- Dirty navigation protection works throughout the flow.
-- The workflow is usable at desktop and mobile widths in Finnish and Swedish.
-- The existing result-edit modal behaves exactly as before.
-
-## Targeted validation
-
-- Form-model tests for step ownership, forward validation, backward
- navigation, completed-step navigation, reset, and draft retention.
-- Lisätieto tests for search, filtering, grouping, selection/removal,
- per-era controls, corrected input kinds, and mobile/desktop summaries.
-- Summary tests proving parity with the serialized create request.
-- Mutation tests for stable error-to-step mapping, success continuations,
- duplicate-submit protection, invalidation/refetch, and no optimistic row.
-- Navigation tests for dirty cancel, internal links, browser Back, and native
- refresh/close protection.
-- Regression tests for event-level missing/error states, the event workspace,
- selected-event panel, and existing result-edit modal.
-- Targeted web type checking, unit/component tests, and lint without cycle
- lint.
-- Manual desktop and mobile browser checks for all four steps and both
- successful continuations when browser tooling is available.
-
-## Merge independence and review gate
-
-R3B can merge after R3A without any result-editing work. Stop after validation
-and request creation-flow review. Editing remains a separately planned and
-approved follow-up.
diff --git a/docs/planning/trials/result-creation-ux.md b/docs/planning/trials/result-creation-ux.md
new file mode 100644
index 00000000..5fd8ca89
--- /dev/null
+++ b/docs/planning/trials/result-creation-ux.md
@@ -0,0 +1,235 @@
+# Follow-up R3B — Result-Creation UX
+
+## Status and sequencing
+
+This is the second creation follow-up after R2. It is planning only and does
+not authorize implementation.
+
+R3A must be implemented, validated, reviewed, and approved before R3B begins.
+R3B consumes the R3A field-set registry and changes only the presentation of
+the existing full-page result-create experience. Existing result editing
+remains unchanged.
+
+The referenced UX screenshots are concepts for hierarchy, cards, and
+lisätieto interaction. They do not specify exact geometry, field counts,
+placement, wording, or a mandatory navigation model.
+
+## Purpose
+
+Evolve the current single-page result-create form into a clearer,
+mobile-capable set of reusable cards. Preserve the familiar save flow and
+overall navigation while improving hierarchy, spacing, descriptions, and
+grouping.
+
+R3B owns presentation only. Field correctness, availability, ordering,
+business grouping, semantic input kinds, and persistence mapping remain owned
+by the R3A registry.
+
+## Single-page card composition
+
+Keep one full-page form and one in-memory draft. Do not require a wizard or
+mandatory multi-step navigation.
+
+Compose the page from independently reusable cards such as:
+
+- event context;
+- Perustiedot;
+- Tulos ja huomautus;
+- Ansiopisteet;
+- Haku, Haukku ja muut;
+- Tuomarit;
+- Erät;
+- Lisätiedot; and
+- an optional informational Yhteenveto.
+
+The exact card boundaries may combine closely related fields when needed for
+responsive layout, but must preserve the current form organization and
+backend request ownership. Other than Lisätiedot, R3B changes spacing,
+descriptions, visual hierarchy, and grouping rather than introducing a new
+workflow.
+
+Cards must not own page navigation or rule-window resolution. They receive
+draft values, callbacks, validation state, and resolved field configuration
+through their interfaces. This keeps them reusable for future editing or for
+a later optional coordinator that controls card visibility without rewriting
+the cards.
+
+## Rule-window presentation
+
+- The event already owns the rule window; the administrator never selects it.
+- Show only minimal localized read-only context, for example
+ `Säännöt: 1.8.2023 →`.
+- Do not expose `trialRuleWindowId` as a normal field. The technical ID may
+ appear only in a tooltip, expandable debug information, or developer
+ diagnostics.
+- For an unverified fallback, show the R3A localized warning without asking
+ the administrator to choose another rule window.
+- Presentation components consume the R3A field set and contain no
+ rule-window-specific branching.
+
+## Lisätiedot workspace
+
+Lisätiedot is the primary R3B UX improvement. Replace the extremely long
+scrolling matrix with a dedicated workspace inside its own card.
+
+The workspace supports:
+
+- search by code;
+- search by localized name;
+- filtering by business/PDF domain;
+- collapsible domain groups;
+- expand all and collapse all;
+- a selected-row summary above the groups;
+- semantic per-era controls; and
+- responsive desktop and mobile layouts.
+
+Use the real business/PDF domains as the primary groups:
+
+- Olosuhteet;
+- Haku;
+- Haukku;
+- Metsästysinto;
+- Ajo; and
+- Muut ominaisuudet.
+
+Numeric ranges may appear as secondary information but never define the
+primary grouping.
+
+Each row presents its code, localized name, optional authoritative
+description, and semantic control together. Do not invent descriptions when
+no authoritative source exists; use localized value-kind or unit guidance
+instead.
+
+Controls come from the R3A semantic input kind:
+
+- `marker` renders as a checkbox or equivalent boolean control;
+- `integer` renders as an integer input;
+- `decimal` renders as a decimal input;
+- `text` renders as a text input; and
+- `tri-state` is allowed only when persistence explicitly distinguishes empty,
+ `0`, and `1`, and renders as meaningful localized choices rather than raw
+ persistence values.
+
+Administrators must not normally enter raw persistence values such as `0` or
+`1`. The UI translates semantic control state through registry persistence
+mapping.
+
+Selected rows remain visible in the summary above the groups. Removing a
+selected row clears all of its unsaved era values. Rows with no values are
+omitted from the create request, preserving the existing request behavior.
+
+On desktop, the workspace may use adjacent filter, group, selected-row, and
+editor regions when space permits. On mobile, it uses stacked groups or an
+overlay/sheet while preserving the same selection and semantic controls.
+These are responsive implementation choices, not separate workflows.
+
+## Erät and other sections
+
+- Keep each era visually independent in the existing card direction.
+- Preserve adding and removing continuous eras and the R3A-configured visible
+ fields.
+- Retain the current organization and validation semantics for all other
+ sections.
+- Improve only spacing, localized descriptions, hierarchy, and grouping
+ outside the Lisätiedot workspace.
+
+## Optional summary
+
+A lightweight informational summary card may appear near the bottom of the
+same page. It may summarize:
+
+- event context;
+- dog/registration data;
+- eras; and
+- selected non-empty lisätiedot.
+
+The summary is not a required confirmation step and does not add an official
+PDF preview. The existing official PDF remains available only after a saved
+entry has an ID.
+
+## Save, errors, and navigation
+
+- Preserve the existing two successful submission paths:
+ - **Save and add another** creates one result, then resets the same page with
+ event-level judge defaults restored.
+ - **Save and finish** creates one result and returns to the event workspace.
+- Preserve existing client/server validation, stable error mapping,
+ duplicate-submit protection, Server Action mutation behavior, query
+ invalidation/refetch, and the rule against optimistic partial cache
+ insertion.
+- Validation and server failures keep the populated single-page form visible
+ and identify the relevant card or field without changing navigation.
+- Preserve the existing dirty internal-navigation confirmation and native
+ refresh/tab-close protection. Browser Back retains the R2 behavior.
+- Add Finnish and Swedish labels, value hints, validation messages, success
+ feedback, and error feedback for the evolved presentation.
+- Add a user-visible `CHANGELOG.md` entry and update durable admin-trial
+ documentation when implemented.
+
+## Exclusions
+
+- No wizard or mandatory multi-step flow.
+- No result-edit UI or rule-window-aware editing.
+- No migration of the edit modal to the card-based create page.
+- No unsaved PDF generation or new PDF preview endpoint.
+- No searchable dog picker, inline dog creation, batch creation, autosave,
+ draft/publish state, or reconciliation UI.
+- No Prisma schema, backend write-contract, server-validation, PDF renderer,
+ or Koiratietokanta ingestion changes.
+- No new production dependency.
+- No redesign of the trials index or event workspace.
+
+## Acceptance criteria
+
+- R3A remains the owner of business correctness and R3B changes presentation
+ only.
+- The existing result-create route remains a familiar single-page form with
+ the same save and navigation behavior.
+- Reusable cards render from the resolved R3A field set and contain no
+ rule-window-specific branching.
+- Rule windows remain mostly invisible: administrators cannot select one,
+ normally see only a localized period label, and do not see the technical ID
+ as a standard field.
+- Lisätiedot provides search, domain filtering, collapsible groups,
+ expand/collapse all, selected-row summary, and semantic per-era controls.
+- Business/PDF domains are the primary lisätieto grouping; numeric ranges are
+ secondary only.
+- Removing a selected lisätieto clears its unsaved values, and empty rows are
+ omitted from the create request.
+- Erät and other sections preserve their current behavior while gaining
+ clearer card hierarchy and responsive presentation.
+- The optional summary is informational and does not create a new confirmation
+ or PDF-preview step.
+- Save-and-add-another, save-and-finish, validation, dirty navigation,
+ mutation, and cache behavior remain unchanged.
+- Cards are independently reusable by future editing without implementing or
+ redesigning editing in R3B.
+- The page is usable at desktop and mobile widths in Finnish and Swedish.
+- The existing result-edit modal behaves exactly as before.
+
+## Targeted validation
+
+- Card tests for independent rendering, field-set-driven visibility,
+ validation presentation, and draft callbacks.
+- Lisätieto tests for code/name search, domain filtering, group
+ expand/collapse, selected-row summary, selection removal, semantic controls,
+ per-era values, and omission of empty rows.
+- Tests proving semantic marker and tri-state controls serialize through the
+ registry without exposing raw persistence values.
+- Responsive component tests for desktop and mobile workspace variants.
+- Regression tests for create request serialization, both success
+ continuations, stable errors, duplicate-submit protection,
+ invalidation/refetch, dirty navigation, and no optimistic row.
+- Regression tests for event-level missing/error states, the event workspace,
+ selected-event panel, and existing result-edit modal.
+- Targeted web type checking, unit/component tests, and lint without cycle
+ lint.
+- Manual desktop and mobile browser checks for the card hierarchy,
+ Lisätiedot workspace, and both successful continuations when browser tooling
+ is available.
+
+## Merge independence and review gate
+
+R3B can merge after R3A without any result-editing work. Stop after validation
+and request creation-flow review. Editing remains a separately planned and
+approved follow-up.
diff --git a/docs/planning/trials/result-fields-by-rule-window.md b/docs/planning/trials/result-fields-by-rule-window.md
index b3306d98..386b133c 100644
--- a/docs/planning/trials/result-fields-by-rule-window.md
+++ b/docs/planning/trials/result-fields-by-rule-window.md
@@ -20,6 +20,12 @@ lisätieto fields from the event's persisted `trialRuleWindowId`. This aligns
new 2023+ results with the corresponding dog-trial PDF before changing the
creation UI.
+R3A owns field correctness, not layout. Its registry is the single source of
+truth for visible fields, ordering, business/PDF grouping, semantic input
+kinds, and the persistence metadata needed to serialize a selected field.
+Presentation components consume the resolved field set and must not branch on
+specific rule-window IDs.
+
The current mismatch is structural:
- PDF rendering already selects a renderer by rule window, while the admin
@@ -38,7 +44,13 @@ The current mismatch is structural:
- Add `trialRuleWindowId` to the admin event-detail contract and propagate the
stored value through the DB and service mappings.
- Add a semantic result-create field-set registry covering every seeded rule
- window ID.
+ window ID. The registry defines field visibility, ordering, grouping,
+ semantic input kinds, and persistence mapping.
+- Define semantic input kinds independently from stored values:
+ `marker`, `integer`, `decimal`, and `text`, plus `tri-state` only for a field
+ whose persistence explicitly distinguishes empty, `0`, and `1`. The
+ registry owns the mapping between semantic control state and persisted
+ values.
- Resolve the create field set from the event's persisted
`trialRuleWindowId`, never from the browser or by recalculating from the
event date.
@@ -60,6 +72,12 @@ The current mismatch is structural:
- Register older known, null, and unknown rule windows through one explicitly
unverified fallback matching the current show-all create-form behavior.
- Show a localized warning whenever the unverified fallback is active.
+- Treat rule-window selection as event-owned context. The administrator never
+ chooses or changes it from the result-create form.
+- Show only a minimal localized read-only rule-period label, for example
+ `Säännöt: 1.8.2023 →`. The technical `trialRuleWindowId` may appear only in
+ a tooltip, expandable diagnostics, or developer output, never as a normal
+ user-facing form field.
- Pass field-set configuration only into the result-create flow. Shared
components must keep their current default behavior so the existing edit
modal is unaffected.
@@ -87,6 +105,14 @@ The current mismatch is structural:
- Admin event details return the event's persisted `trialRuleWindowId`.
- Result creation resolves its field set from that stored ID.
+- The field registry is the single source of truth for create-form visibility,
+ ordering, grouping, semantic controls, and persistence mapping; UI
+ components contain no rule-window-ID branches.
+- Semantic control state maps to persistence values through the registry,
+ including tri-state only where empty, `0`, and `1` are distinct domain
+ values.
+- Administrators cannot select a rule window and normally see only its
+ localized period label.
- A 2023+ create form displays the verified score, era, and lisätieto
configuration.
- Codes `25` and `27` persist with part `a`, appear as single rows, and reach
@@ -105,10 +131,15 @@ The current mismatch is structural:
event details.
- Field-registry tests covering every seeded rule-window ID and null/unknown
fallback behavior.
+- Registry tests for semantic input kinds and control-state-to-persistence
+ mapping, including any explicitly configured tri-state field.
- 2023+ parity tests for visible entry fields, era fields, lisätieto codes,
parts, ordering, and input kinds.
- Create-form tests for persisted-rule selection, fallback warning, unlimited
- continuous eras, and request serialization.
+ continuous eras, minimal rule-period presentation, and request
+ serialization.
+- Presentation tests proving the resolved registry configuration drives
+ rendering without rule-window-specific component branches.
- Regression tests proving the edit modal retains its current complete field
set and request serialization.
- PDF pivot regression tests for part `a` of codes `25` and `27`.
@@ -120,8 +151,8 @@ The current mismatch is structural:
R3A can merge independently after R2. It changes only the semantic
presentation of result creation and leaves result editing unchanged.
-Stop after validation and request explicit review. Do not begin the guided
-creation UX in R3B without separate approval.
+Stop after validation and request explicit review. Do not begin the
+card-based creation UX in R3B without separate approval.
## Later historical and edit work
From 6298f1fa73d5edd2a6ad109fd37840a5e30f554d Mon Sep 17 00:00:00 2001
From: Aki Kuivas <91662678+asku1990@users.noreply.github.com>
Date: Thu, 23 Jul 2026 11:53:55 +0300
Subject: [PATCH 3/8] docs(trials): clarify reusable creation UX scope
---
docs/planning/trials/later-ux.md | 8 +++-----
docs/planning/trials/result-creation-ux.md | 14 ++++++++++++--
.../trials/result-fields-by-rule-window.md | 15 ++++++++-------
3 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/docs/planning/trials/later-ux.md b/docs/planning/trials/later-ux.md
index 9f3db1c4..9161af6b 100644
--- a/docs/planning/trials/later-ux.md
+++ b/docs/planning/trials/later-ux.md
@@ -20,9 +20,6 @@ the review rules in the [BEJ-103 planning overview](./README.md).
stored fields hidden by a narrower verified field set.
- Redesign result editing only after the R3A and R3B creation gates have been
implemented, validated, and reviewed.
-- If a guided or multi-step result flow is adopted later, implement it as a
- coordinator that controls visibility of the reusable R3B cards rather than
- rewriting their field presentation.
- Add searchable dog selection to manual result creation.
- Allow inline dog creation from the result flow.
- Add an explicit draft/publish state for trial events or results.
@@ -38,8 +35,9 @@ the review rules in the [BEJ-103 planning overview](./README.md).
result at a time.
- R3A and R3B do not change result editing. Older, null, and unknown rule
windows use the warned show-all fallback only in result creation.
-- R3B keeps result creation on one page; a wizard or mandatory multi-step
- coordinator is not part of the current gates.
+- R3B does not require a wizard. If a guided presentation is adopted during
+ R3B, it must be a thin coordinator over the same reusable cards and preserve
+ the existing save and navigation behavior.
- Matching Koiratietokanta upserts are resolved by the authoritative backend
behavior documented in [Result creation](./result-creation.md), without a
manual reconciliation screen.
diff --git a/docs/planning/trials/result-creation-ux.md b/docs/planning/trials/result-creation-ux.md
index 5fd8ca89..1f2009cd 100644
--- a/docs/planning/trials/result-creation-ux.md
+++ b/docs/planning/trials/result-creation-ux.md
@@ -30,6 +30,12 @@ by the R3A registry.
Keep one full-page form and one in-memory draft. Do not require a wizard or
mandatory multi-step navigation.
+A guided or multi-step presentation is permitted, but it is not an R3B
+requirement. If implementation review shows that guidance is useful, add it as
+a thin coordinator that controls which reusable cards are visible. It must not
+duplicate card content, create separate field models, or change the existing
+save and navigation contract.
+
Compose the page from independently reusable cards such as:
- event context;
@@ -51,7 +57,7 @@ workflow.
Cards must not own page navigation or rule-window resolution. They receive
draft values, callbacks, validation state, and resolved field configuration
through their interfaces. This keeps them reusable for future editing or for
-a later optional coordinator that controls card visibility without rewriting
+an optional R3B coordinator that controls card visibility without rewriting
the cards.
## Rule-window presentation
@@ -168,7 +174,9 @@ entry has an ID.
## Exclusions
-- No wizard or mandatory multi-step flow.
+- No requirement to implement a wizard or mandatory multi-step flow. Any
+ guided presentation must remain a thin coordinator over the same reusable
+ cards.
- No result-edit UI or rule-window-aware editing.
- No migration of the edit modal to the card-based create page.
- No unsaved PDF generation or new PDF preview endpoint.
@@ -185,6 +193,8 @@ entry has an ID.
only.
- The existing result-create route remains a familiar single-page form with
the same save and navigation behavior.
+- A guided presentation, if adopted, reuses the same cards and field model and
+ does not change persistence, save, or navigation behavior.
- Reusable cards render from the resolved R3A field set and contain no
rule-window-specific branching.
- Rule windows remain mostly invisible: administrators cannot select one,
diff --git a/docs/planning/trials/result-fields-by-rule-window.md b/docs/planning/trials/result-fields-by-rule-window.md
index 386b133c..d7ca795c 100644
--- a/docs/planning/trials/result-fields-by-rule-window.md
+++ b/docs/planning/trials/result-fields-by-rule-window.md
@@ -22,9 +22,9 @@ creation UI.
R3A owns field correctness, not layout. Its registry is the single source of
truth for visible fields, ordering, business/PDF grouping, semantic input
-kinds, and the persistence metadata needed to serialize a selected field.
-Presentation components consume the resolved field set and must not branch on
-specific rule-window IDs.
+kinds, localized value hints, and the persistence metadata needed to serialize
+a selected field. Presentation components consume the resolved field set and
+must not branch on specific rule-window IDs.
The current mismatch is structural:
@@ -45,7 +45,7 @@ The current mismatch is structural:
stored value through the DB and service mappings.
- Add a semantic result-create field-set registry covering every seeded rule
window ID. The registry defines field visibility, ordering, grouping,
- semantic input kinds, and persistence mapping.
+ semantic input kinds, localized value hints, and persistence mapping.
- Define semantic input kinds independently from stored values:
`marker`, `integer`, `decimal`, and `text`, plus `tri-state` only for a field
whose persistence explicitly distinguishes empty, `0`, and `1`. The
@@ -106,8 +106,8 @@ The current mismatch is structural:
- Admin event details return the event's persisted `trialRuleWindowId`.
- Result creation resolves its field set from that stored ID.
- The field registry is the single source of truth for create-form visibility,
- ordering, grouping, semantic controls, and persistence mapping; UI
- components contain no rule-window-ID branches.
+ ordering, grouping, semantic controls, localized value hints, and
+ persistence mapping; UI components contain no rule-window-ID branches.
- Semantic control state maps to persistence values through the registry,
including tri-state only where empty, `0`, and `1` are distinct domain
values.
@@ -132,7 +132,8 @@ The current mismatch is structural:
- Field-registry tests covering every seeded rule-window ID and null/unknown
fallback behavior.
- Registry tests for semantic input kinds and control-state-to-persistence
- mapping, including any explicitly configured tri-state field.
+ mapping, including localized value hints and any explicitly configured
+ tri-state field.
- 2023+ parity tests for visible entry fields, era fields, lisätieto codes,
parts, ordering, and input kinds.
- Create-form tests for persisted-rule selection, fallback warning, unlimited
From ae771ccbbc7afdb4ca920c9d9660eef316e7d599 Mon Sep 17 00:00:00 2001
From: Aki Kuivas <91662678+asku1990@users.noreply.github.com>
Date: Thu, 23 Jul 2026 12:57:11 +0300
Subject: [PATCH 4/8] feat(trials): make result creation rule-window aware
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Resolve the manual result-create field set from the trial event’s
persisted
rule window.
- add trialRuleWindowId to admin event details
- configure and verify the current 2023+ score, era, and lisätieto
fields
- hide obsolete tja and pin score fields for current rules
- use Ajotaito for the current rule period
- align lisätieto codes, parts, input types, and marker persistence
with the PDF
- retain a warned legacy fallback for older and unknown rule windows
- preserve existing result-edit behavior
ref bej-103
---
CHANGELOG.md | 1 +
.../admin-trial-event-edit-dialog.test.tsx | 1 +
.../admin-trial-selected-event-panel.test.tsx | 3 +
.../admin-trial-entry-create-page-client.tsx | 21 ++-
.../__tests__/entry-meta-section.test.tsx | 20 +++
.../internal/__tests__/era-section.test.tsx | 33 ++++
.../trials/internal/entry-meta-section.tsx | 141 +++++++++++----
.../admin/trials/internal/era-section.tsx | 50 +++---
.../trials/internal/lisatiedot-matrix.tsx | 52 +++++-
.../__tests__/entry-create-model.test.ts | 22 +++
.../result-create-field-registry.test.ts | 80 +++++++++
.../lib/admin/trials/entry-create-model.ts | 17 +-
.../web/lib/admin/trials/entry-edit-config.ts | 7 +-
.../admin/trials/entry-edit-dialog-model.ts | 21 ++-
apps/web/lib/admin/trials/index.ts | 1 +
.../trials/result-create-field-registry.ts | 165 ++++++++++++++++++
.../lib/i18n/messages/admin/trials/manage.ts | 22 +++
docs/features/admin-trial-management.md | 16 +-
.../manage/admin-trial-event-details.ts | 1 +
.../get-trial-event-details.parity.test.ts | 2 +
.../trials/manage/get-trial-event-details.ts | 2 +
packages/db/admin/trials/manage/types.ts | 1 +
.../manage/__tests__/get-trial-event.test.ts | 2 +
.../admin/trials/manage/get-trial-event.ts | 1 +
.../__tests__/get-trial-dog-pdf-data.test.ts | 35 ++++
25 files changed, 650 insertions(+), 67 deletions(-)
create mode 100644 apps/web/components/admin/trials/internal/__tests__/era-section.test.tsx
create mode 100644 apps/web/lib/admin/trials/__tests__/result-create-field-registry.test.ts
create mode 100644 apps/web/lib/admin/trials/result-create-field-registry.ts
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0c8e92c6..191007c0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,7 @@ This project uses a user-facing changelog format.
- Viimeisen koetuloksen poistaminen säilyttää ajokoetapahtuman tyhjänä, kunnes ylläpitäjä poistaa tapahtuman erikseen.
- Uuden ajokoetapahtuman luomisen jälkeen siirrytään suoraan lisäämään tapahtuman ensimmäistä koetulosta.
+- Ajokoetuloksen lisäyslomake näyttää 1.8.2023 alkaen käytössä olevan sääntökauden mukaiset kentät. Vanhemmilla tai tunnistamattomilla sääntökausilla kaikki yhteensopivuuskentät säilyvät näkyvissä varoituksen kanssa.
### Fixed
diff --git a/apps/web/components/admin/trials/__tests__/admin-trial-event-edit-dialog.test.tsx b/apps/web/components/admin/trials/__tests__/admin-trial-event-edit-dialog.test.tsx
index c532fe21..6dc0f26f 100644
--- a/apps/web/components/admin/trials/__tests__/admin-trial-event-edit-dialog.test.tsx
+++ b/apps/web/components/admin/trials/__tests__/admin-trial-event-edit-dialog.test.tsx
@@ -51,6 +51,7 @@ vi.mock("@/components/ui/input", () => ({
const event1 = {
trialEventId: "event-1",
+ trialRuleWindowId: "trw_post_20230801",
eventDate: "2026-04-14",
eventPlace: "Helsinki",
eventName: "Kevatkoe",
diff --git a/apps/web/components/admin/trials/__tests__/admin-trial-selected-event-panel.test.tsx b/apps/web/components/admin/trials/__tests__/admin-trial-selected-event-panel.test.tsx
index 41dd1c23..f1edacaf 100644
--- a/apps/web/components/admin/trials/__tests__/admin-trial-selected-event-panel.test.tsx
+++ b/apps/web/components/admin/trials/__tests__/admin-trial-selected-event-panel.test.tsx
@@ -94,6 +94,7 @@ describe("AdminTrialSelectedEventPanel", () => {
React.createElement(AdminTrialSelectedEventPanel, {
selectedEvent: {
trialEventId: "event-1",
+ trialRuleWindowId: "trw_post_20230801",
eventDate: "2026-04-14",
eventPlace: "Helsinki",
eventName: "Kevatkoe",
@@ -143,6 +144,7 @@ describe("AdminTrialSelectedEventPanel", () => {
React.createElement(AdminTrialSelectedEventPanel, {
selectedEvent: {
trialEventId: "event-1",
+ trialRuleWindowId: null,
eventDate: "2026-04-14",
eventPlace: "Helsinki",
eventName: null,
@@ -175,6 +177,7 @@ describe("AdminTrialSelectedEventPanel", () => {
React.createElement(AdminTrialSelectedEventPanel, {
selectedEvent: {
trialEventId: "event-1",
+ trialRuleWindowId: null,
eventDate: "2026-04-14",
eventPlace: "Helsinki",
eventName: null,
diff --git a/apps/web/components/admin/trials/admin-trial-entry-create-page-client.tsx b/apps/web/components/admin/trials/admin-trial-entry-create-page-client.tsx
index 8cf7f2ad..77af1c1d 100644
--- a/apps/web/components/admin/trials/admin-trial-entry-create-page-client.tsx
+++ b/apps/web/components/admin/trials/admin-trial-entry-create-page-client.tsx
@@ -19,6 +19,7 @@ import {
getAdminTrialEventHref,
getAdminTrialsHref,
getNextEraNumber,
+ resolveResultCreateFieldSet,
toCreateAdminTrialEntryRequest,
} from "@/lib/admin/trials";
import {
@@ -113,9 +114,13 @@ function ResultCreateForm({
const { t } = useI18n();
const router = useRouter();
const mutation = useCreateAdminTrialEntryMutation();
+ const fieldSet = React.useMemo(
+ () => resolveResultCreateFieldSet(event.trialRuleWindowId),
+ [event.trialRuleWindowId],
+ );
const initial = React.useMemo(
- () => createAdminTrialEntryCreateDraft(event),
- [event],
+ () => createAdminTrialEntryCreateDraft(event, fieldSet),
+ [event, fieldSet],
);
const [draft, setDraft] = React.useState(initial);
const [errorText, setErrorText] = React.useState
+ {t(fieldSet.rulePeriodMessageKey)} +
+ {!fieldSet.verified ? ( ++ {t("admin.trials.manage.resultCreate.ruleWindowWarning")} +
+ ) : null}