Skip to content

Conversation

@XingY
Copy link
Contributor

@XingY XingY commented Nov 17, 2025

Rationale

Related Pull Requests

Changes

  • Disallow negative sample amounts: Update getValidatedEditableGridValue to check for negative amount values
  • Added AmountUnitInput to show amount/units input side-by-side on bulk add/edit
  • Support enable/disable amount/units fields together in designer

@cnathe cnathe self-requested a review November 17, 2025 20:09
@XingY XingY requested a review from cnathe November 19, 2025 16:57
@XingY XingY changed the title Disallow negative sample amount Sample amount/units polish Nov 19, 2025
.filter(vd => vd && vd.display !== undefined)
.reduce((v, vd, i) => v + (i > 0 ? ', ' : '') + vd.display, '');

const showMenu = (showLookup || !!col.inputRenderer) && (NON_NEGATIVE_NUMBER_CONCEPT_URI !== col?.conceptURI);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what would be the use case here? I wouldn't expect any number fields to showMenu? Is it because the amount field now has an inputRenderer? seems like this could use a comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment added

const ColumnInputRenderer = resolveInputRenderer(col);
const ColumnInputRenderer =
col.conceptURI === NON_NEGATIVE_NUMBER_CONCEPT_URI
? null /* Use standard forminput for media amount/unit */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

based on the comment, it sounds like the media case is the one that uses NON_NEGATIVE_NUMBER_CONCEPT_URI is that right? I would have expected that conceptURI to be used for all amounts/units

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left media to continue to use separate amount / unit inputs because batch has 2 amount columns, so maybe it should be considered a special case: Recipe Amount and Recipe Actual Amount. It's possible to use the new component for it but would take some extra wiring for DetailDisplay and custom labels for the amount/unit combo so I'm not sure it's worth it.

@XingY XingY requested a review from cnathe November 20, 2025 18:04
.filter(vd => vd && vd.display !== undefined)
.reduce((v, vd, i) => v + (i > 0 ? ', ' : '') + vd.display, '');

const showMenu = (showLookup || !!col.inputRenderer) && (NON_NEGATIVE_NUMBER_CONCEPT_URI !== col?.conceptURI /*storedamount has inputRenderer but shouldn't show menu*/);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the comment, that helps. But as mentioned in the other PR, this still seems odd that we are tying together the NON_NEGATIVE_NUMBER_CONCEPT_URI and the new stored amount input renderer. Those seem like different parts/pieces.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree it's a bit odd. But it's also odd that we always show the menu dropdown if there is an inputRenderer. I'll leave as is for now, maybe will come back to it when we get to the rest of the amount/units polish.

@XingY XingY merged commit 375096c into develop Nov 20, 2025
3 checks passed
@XingY XingY deleted the fb_amountValidation branch November 20, 2025 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants