diff --git a/btc-UI/src/app/components/selection.service/label-restriction.service.ts b/btc-UI/src/app/components/selection.service/label-restriction.service.ts index 902f6a6..a284615 100644 --- a/btc-UI/src/app/components/selection.service/label-restriction.service.ts +++ b/btc-UI/src/app/components/selection.service/label-restriction.service.ts @@ -56,4 +56,33 @@ export class LabelRestrictionService { return blockLabels; } + + /** + * Returns true if Field should be disabled due to a BOX selection in FRP/QNP/TNP. + * + * We consider both finalized selections and the in-progress/current label (provided via `current`). + * + * @param selections finalized selections + * @param current optional object describing the in-progress row (e.g. { label: 'FRP', isBoxed: true }) + */ + isFieldDisabled( + selections: SelectionData[], + current?: { label?: string | null; isBoxed?: boolean } | null + ): boolean { + const boxedLabels = new Set(['FRP', 'QNP', 'TNP']); + + // check finalized selections + for (const s of selections) { + if (s && s.label && boxedLabels.has(s.label) && !!s.isBoxed) { + return true; + } + } + + // check the in-progress/current row if provided + if (current && current.label && boxedLabels.has(String(current.label)) && !!current.isBoxed) { + return true; + } + + return false; + } } diff --git a/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.ts b/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.ts index 6dcd1fb..f42803d 100755 --- a/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.ts +++ b/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.ts @@ -1699,6 +1699,13 @@ if (['FRP', 'QNP', 'TNP'].includes(row.label)) { canUseField(): boolean { if (this.totalAmountLimitReached) return false; + + // If any finalized or the current (in-progress) selection is a boxed FRP/QNP/TNP, disable Field + const currentPartial = { label: this.selectedLabel, isBoxed: this.isBoxed }; + if (this.labelRestrictionService.isFieldDisabled(this.selectionService.getSelections(), currentPartial)) { + return false; + } + if (this.selectedLabel === 'FRP' || this.selectedLabel === 'QNP') { if (!this.isFirstGroupComplete && this.firstGroup.length === 0) return true; if (this.isFirstGroupComplete && this.secondGroup.length === 0) return true;