fix : enabled & disabling numbers are working

This commit is contained in:
karthik 2025-08-14 16:36:52 +05:30
parent 210c2baf4a
commit 3ac0fd8cdb
2 changed files with 36 additions and 19 deletions

View File

@ -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 */
}

View File

@ -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;