Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -758,13 +758,24 @@ export const businessRuleDefs: MappedBusinessRuleDefs = {
totalPrepLoaned += quantity;
});

// Check for min attribute on countAmt input field after rendering
const inputs = document.querySelectorAll<HTMLInputElement>(
`input[name="countAmt"]`
);
const firstInput = inputs[0];
const minValue= firstInput?.getAttribute('min');
const hasMinAttribute = ( minValue !== null && minValue >= '0');
// Modified save blocker logic to consider min attribute and choose either the blocker for negative prepr or HTML min attribute to avoid conflict

if (totalPrep < 0) {
if (!hasMinAttribute) {
setSaveBlockers(
prep,
prep.specifyTable.field.countAmt,
[resourcesText.preparationIsNegative()],
PREPARATION_NEGATIVE_KEY
);
}
} else if (totalPrep < totalPrepLoaned) {
setSaveBlockers(
prep,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import { InteractionDialog } from '../Interactions/InteractionDialog';
import { hasTablePermission } from '../Permissions/helpers';
import { relationshipIsToMany } from '../WbPlanView/mappingHelpers';
import { AttachmentsCollection } from './AttachmentsCollection';
import { shouldBeToOne } from './helpers';
import { AttachmentWarningDeletion } from './AttachmentWarningDeletion';
import { shouldBeToOne } from './helpers';
import { RecordSelectorFromCollection } from './RecordSelectorFromCollection';

/** A wrapper for RecordSelector to integrate with Backbone.Collection */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Relationship } from '../DataModel/specifyField';
import type { Relationship } from '../DataModel/specifyField';

export const shouldBeToOne = (
relationship: Relationship | undefined
Expand Down