-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Background & Motivation
In the fdm-app, when configuring or viewing cultivations, users are asked whether crop residues are left on the field ("Gewasresten achterlaten" / m_cropresidue).
However, for many cultivations, crop residues are either not applicable, do not exist, or have an effective organic matter (EOM) value of 0. When the cultivation catalogue indicates that b_lu_eom_residues === 0 (or null), checking this box has no impact on calculations or the organic matter balance. Displaying this input in these scenarios leads to a cluttered UI and can cause confusion for users (farmers and advisors).
Requirements
- Conditionally render or disable the "Gewasresten achterlaten" inputs based on the cultivation's properties.
- Look up the selected crop in the cultivation catalogue (
b_lu_catalogue->b_lu_eom_residues). - If
b_lu_eom_residues === 0(ornull), the input should be hidden (or clearly marked as non-applicable/disabled). - Ensure that hiding the checkbox does not cause any React Hook Form / Zod validation errors. If hidden, the value should default to
falsegracefully upon submission.
Affected Areas
This input appears in several places across the application that need to be updated:
-
Cultivation Details Form
- File:
fdm-app/app/components/blocks/cultivation/card-details.tsx - Action: Hide the
m_cropresiduecheckbox (Label: "Gewasresten achterlaten") completely whenb_lu_eom_residues === 0with 'invisible' class.
- File:
-
Rotation Table Page
- File:
fdm-app/app/components/blocks/rotation/columns.tsx - Action: The "Gewasresten" column allows users to toggle
m_cropresidue. For rows where the crop hasb_lu_eom_residues === 0, this cell should not render an interactive checkbox/dropdown, but instead should hide it. - Related File:
fdm-app/app/components/blocks/rotation/table.tsx
- File:
-
Validation Schemas & Actions
- Files:
fdm-app/app/components/blocks/cultivation/schema.tsandfdm-app/app/components/blocks/rotation/schema.ts - Action: Ensure that
m_cropresiduecan gracefully handle being omitted or implicitly set tofalsewhen the UI inputs are hidden. - Action handler:
fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.cultivation.$b_lu.tsxand rotation actions.
- Files:
Technical Context
- The field in the database/schema is
b_lu_eom_residues(fromcultivations_catalogue).
Acceptance Criteria
- Users do not see the "Gewasresten achterlaten" checkbox in the Cultivation Details form for crops with
b_lu_eom_residues === 0. - In the Rotation Table, the "Gewasresten" input is hidden for applicable rows.
- Form submission works correctly regardless of whether the checkbox is visible, defaulting to
false.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels