fix : TNP is fixed for auto populating non box

This commit is contained in:
karthik 2025-09-21 11:43:24 +05:30
parent c7a9f1fcf2
commit a72cc77007

View File

@ -921,6 +921,40 @@ export class TouchPadMenuComponent implements OnInit, OnDestroy {
return;
}
// Insert this block near the top of enterPadVal(), before the general updatePartial() for non-multi pools.
// It explicitly handles the TNP (non-boxed) incomplete case: if user types numbers and presses value
// without pressing shash (to advance groups), we auto-clear the row.
if (this.selectedLabel === 'TNP' && !this.isBoxed) {
// If TNP is not boxed, user must press shash enter to advance groups.
// If they're still in the initial group (tanGroupStage < 2) and haven't advanced
// (i.e. the other groups are empty), treat a pad-value press as an invalid/ incomplete entry.
const groupsFilled = this.tanGroups.map(g => Array.isArray(g) && g.length > 0);
const atLeastOneOtherGroupFilled = groupsFilled.slice(1).some(Boolean);
const currentGroupHasNumbers = (this.tanGroups[this.tanGroupStage] || []).length > 0;
// If only the first group has numbers and user pressed value without having advanced with shash,
// then we should clear the current row (same pattern you use elsewhere).
if (this.tanGroupStage < 2 && currentGroupHasNumbers && !atLeastOneOtherGroupFilled) {
console.log('[DEBUG] TNP unboxed: incomplete multi-group entry — auto-clearing current row');
this.selectionService.updatePartial({
label: '',
numbers: [],
value: 0,
total: 0,
isBoxed: false
});
// Reset state for TNP (mirror other clearing you already have)
this.selectedLabel = null;
this.selectedNumbers = [];
this.padValue = '';
this.isBoxed = false;
this.tanGroupStage = 0;
this.tanGroups = [[], [], []];
this.updateCanPrint();
return;
}
}
this.selectionService.updatePartial({
value,
isBoxed: this.isBoxed,