From 2669f234ddb4a071c0d43a2cc9a256f80c7839e4 Mon Sep 17 00:00:00 2001 From: karthik Date: Tue, 29 Jul 2025 14:46:32 +0530 Subject: [PATCH] fix : disabled box for MJP,JKP,TRE --- .../touch-pad-menu.component.ts | 49 ++++++++++++------- 1 file changed, 30 insertions(+), 19 deletions(-) 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 e3824c8..db78498 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 @@ -111,23 +111,22 @@ export class TouchPadMenuComponent implements OnInit { } get isBoxToggleDisabled(): boolean { - if (!this.selectedLabel) return true; + if (!this.selectedLabel) return true; - // ❌ Disallow box mode for these labels - const disallowedBoxLabels = ['WIN', 'SHP', 'THP', 'PLC', 'SHW']; - if (disallowedBoxLabels.includes(this.selectedLabel)) { - return true; + // Disable box mode for these labels + const disallowedBoxLabels = ['WIN', 'SHP', 'THP', 'PLC', 'SHW', 'TRE', 'MJP', 'JKP']; + if (disallowedBoxLabels.includes(this.selectedLabel)) { + return true; + } + + // Disable box toggle if FIELD (F) is selected + if (this.selectedNumbers.includes('F')) { + return true; + } + + return false; } - // ❌ Disallow box toggle if FIELD (F) is selected - if (this.selectedNumbers.includes('F')) { - return true; - } - - return false; -} - - private chunk(array: T[], size: number): T[][] { return Array.from({ length: Math.ceil(array.length / size) }, (_, i) => array.slice(i * size, i * size + size) @@ -145,16 +144,16 @@ export class TouchPadMenuComponent implements OnInit { this.canPrint = false; this.isBoxed = false; - // ✅ Reset TAN + // Reset TAN this.tanGroupStage = 0; this.tanGroups = [[], [], []]; - // ✅ Reset FOR/QUI + // Reset FOR/QUI this.isFirstGroupComplete = false; this.firstGroup = []; this.secondGroup = []; - // ✅ Reset Multi-leg + // Reset Multi-leg this.multiLegStage = 0; this.multiLegGroups = [[], [], [], [], []]; @@ -485,8 +484,11 @@ export class TouchPadMenuComponent implements OnInit { } return false; } - if (this.selectedLabel === 'TAN') { - if (this.tanGroups[this.tanGroupStage].length === 0) { + if (this.selectedLabel === 'TAN' || this.multiLegLabels.includes(this.selectedLabel || '')) { + if (this.selectedLabel === 'TAN' && this.tanGroups[this.tanGroupStage].length === 0) { + return true; + } + if (this.multiLegLabels.includes(this.selectedLabel || '') && this.multiLegGroups[this.multiLegStage].length === 0) { return true; } return false; @@ -563,6 +565,15 @@ export class TouchPadMenuComponent implements OnInit { value: 1 }); } + } else if (this.multiLegLabels.includes(this.selectedLabel)) { + this.multiLegGroups[this.multiLegStage] = ['F']; + this.updateMultiLegSelection(); + this.selectionService.updatePartial({ + label: this.selectedLabel, + numbers: [...this.selectedNumbers], + isBoxed: false, + value: 1 + }); } else { this.selectedNumbers = ['F']; this.selectionService.updatePartial({