From 3ac0fd8cdbc1d11821901fd62f400bd051d014a3 Mon Sep 17 00:00:00 2001 From: karthik Date: Thu, 14 Aug 2025 16:36:52 +0530 Subject: [PATCH] fix : enabled & disabling numbers are working --- .../touch-pad-menu.component.css | 6 +++ .../touch-pad-menu.component.ts | 49 ++++++++++++------- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.css b/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.css index a814ea6..15633f1 100755 --- a/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.css +++ b/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.css @@ -735,3 +735,9 @@ button.ready-to-print { .limit-button:hover { background-color: #0056b3; } +.number-button button[disabled] { + background-color: #cccccc; /* Gray background for disabled */ + color: #666666; /* Darker text for contrast */ + cursor: not-allowed; /* Cursor indicates disabled state */ + opacity: 0.6; /* Slightly transparent */ +} \ No newline at end of file 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 80c57b9..3be3ad6 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 @@ -283,26 +283,37 @@ export class TouchPadMenuComponent implements OnInit, OnDestroy { // --- MODIFIED METHOD --- isNumberDisabled(number: number): boolean { - // Disable if number is not in actualRunners - if (!this.actualRunners.has(number)) { - return true; - } - // Allow all numbers for TAN when boxed - if (this.selectedLabel === 'TAN' && this.isBoxed) { - return false; - } - // Allow selection for TAN, multi-leg, or two-group labels - if ( - this.selectedLabel === 'TAN' || - this.multiLegLabels.includes(this.selectedLabel || '') || - this.twoGroupLabels.includes(this.selectedLabel || '') - ) { - return false; - } - // Disable if number is already selected or total amount limit reached - return this.selectedNumbers.includes(number) || this.totalAmountLimitReached; + // Disable if number is not in actualRunners + if (!this.actualRunners.has(number)) { + return true; } - + // Disable if total amount limit reached + if (this.totalAmountLimitReached) { + return true; + } + // Allow all numbers for TAN when boxed, but disable selected numbers + if (this.selectedLabel === 'TAN' && this.isBoxed) { + return this.selectedNumbers.includes(number); + } + // TAN (unboxed): Disable numbers already selected in the current group + if (this.selectedLabel === 'TAN') { + return this.tanGroups[this.tanGroupStage].includes(number); + } + // Multi-leg pools (TRE, MJP, JKP): Disable numbers already selected in the current leg + if (this.multiLegLabels.includes(this.selectedLabel || '')) { + return this.multiLegGroups[this.multiLegStage].includes(number); + } + // Two-group pools (FOR, QUI): Disable numbers already selected in the current group + if (this.twoGroupLabels.includes(this.selectedLabel || '')) { + if (!this.isFirstGroupComplete) { + return this.firstGroup.includes(number); + } else { + return this.secondGroup.includes(number); + } + } + // Default case for WIN, SHP, THP, PLC, etc.: Disable if already selected + return this.selectedNumbers.includes(number); +} selectLabel(label: string) { if (this.totalAmountLimitReached || this.blockedLabels.has(label)) { this.showLimitPopup = true;