fix : wsp enter fixed working

This commit is contained in:
karthik 2025-08-09 21:35:06 +05:30
parent ab9377f736
commit 3baed644a1

View File

@ -416,8 +416,8 @@ export class TouchPadMenuComponent implements OnInit, OnDestroy {
const group2 = allBoxed.slice(group1.length, group1.length + groupSize); const group2 = allBoxed.slice(group1.length, group1.length + groupSize);
const group3 = allBoxed.slice(group1.length + group2.length); const group3 = allBoxed.slice(group1.length + group2.length);
const combined: (number | string)[] = [...group1]; const combined: (number | string)[] = [...group1];
if (group2.length) combined.push( ...group2); if (group2.length) combined.push('-', ...group2);
if (group3.length) combined.push( ...group3); if (group3.length) combined.push('-', ...group3);
this.selectedNumbers = combined; this.selectedNumbers = combined;
this.selectionService.updatePartial({ this.selectionService.updatePartial({
numbers: [...this.selectedNumbers], numbers: [...this.selectedNumbers],
@ -1610,15 +1610,44 @@ try {
} }
// Update canEnterRow to require value between 1 and 100 // Update canEnterRow to require value between 1 and 100
get canEnterRow(): boolean { get canEnterRow(): boolean {
if (this.maxRowsReached) return false; if (this.maxRowsReached) {
console.log('[DEBUG] canEnterRow: maxRowsReached is true, disabling Enter');
return false;
}
// Special handling for WSP
if (this.selectedLabel === 'WSP') {
const isValidPadValue = this.padValue.trim().length > 0 && /^[0-9]+$/.test(this.padValue);
const hasNumbers = this.selectedNumbers.length > 0;
console.log('[DEBUG] canEnterRow (WSP):', {
isValidPadValue,
hasNumbers,
padValue: this.padValue,
selectedNumbers: this.selectedNumbers,
wspTicketStage: this.wspTicketStage
});
return isValidPadValue && hasNumbers;
}
// Default logic for non-WSP
const currentRow = this.selectionService.getCurrentRow(); const currentRow = this.selectionService.getCurrentRow();
return !!currentRow.label && const result = !!currentRow.label &&
!!currentRow.numbers && !!currentRow.numbers &&
currentRow.numbers.length > 0 && currentRow.numbers.length > 0 &&
typeof currentRow.value === 'number' && typeof currentRow.value === 'number' &&
currentRow.value >= 1 && currentRow.value >= 1 &&
currentRow.value <= 100 && currentRow.value <= 100 &&
currentRow.total > 0; currentRow.total > 0;
}
console.log('[DEBUG] canEnterRow (non-WSP):', {
label: currentRow.label,
numbers: currentRow.numbers,
value: currentRow.value,
total: currentRow.total,
result
});
return result;
}
} }