fix : going back to previous commit

This commit is contained in:
karthik 2025-07-31 13:48:13 +05:30
parent de01c3f9d1
commit 2acb5d7b35
2 changed files with 6 additions and 46 deletions

View File

@ -104,22 +104,10 @@
</ng-container> </ng-container>
<div class="col-6"> <div class="col-6">
<button <button class="btn btn-secondary w-100 number-button" [disabled]="!numericPadEnabled" (click)="onPadEnter()">Enter</button>
class="btn btn-secondary w-100 number-button"
[disabled]="!numericPadEnabled || maxRowsReached"
(click)="onPadEnter()"
>
Enter
</button>
</div> </div>
<div class="col-6"> <div class="col-6">
<button <button class="btn btn-secondary w-100 number-button" [disabled]="!canPrint" (click)="print()">Print</button>
class="btn btn-secondary w-100 number-button"
[disabled]="!canPrint || currentSelections.length === 0"
(click)="print()"
>
Print
</button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -299,31 +299,9 @@ export class TouchPadMenuComponent implements OnInit, OnDestroy {
} }
onPadEnter() { onPadEnter() {
// Only allows entry if less than 5 rows are filled if (this.canPrint) {
if (this.maxRowsReached) return; this.print();
}
const value = parseFloat(this.padValue) || 0;
if (!this.selectedLabel || !this.selectedNumbers.length || value === 0) return; // Basic validation
// Finalize current row selection
this.selectionService.finalizeCurrentRow();
// Clear current row selection, but do NOT clear the existing rows,
// so user can keep filling rows up to 5
this.selectedLabel = null;
this.selectedNumbers = [];
this.padValue = '';
this.canPrint = false;
this.isBoxed = false;
// Reset all group stages
this.tanGroupStage = 0;
this.tanGroups = [[], [], []];
this.isFirstGroupComplete = false;
this.firstGroup = [];
this.secondGroup = [];
this.multiLegStage = 0;
this.multiLegGroups = [[], [], [], [], []];
} }
onShashEnter() { onShashEnter() {
@ -391,19 +369,13 @@ export class TouchPadMenuComponent implements OnInit, OnDestroy {
} }
print() { print() {
// Don't print if no rows
if (this.currentSelections.length === 0) return;
const selectionsTotal = this.currentSelections.reduce((sum, sel) => sum + sel.total, 0); const selectionsTotal = this.currentSelections.reduce((sum, sel) => sum + sel.total, 0);
if (selectionsTotal + this.currentTotal > 5000) { if (selectionsTotal + this.currentTotal > 5000) {
this.showLimitPopup = true; this.showLimitPopup = true;
return; return;
} }
// Submit all rows
this.selectionService.finalizeCurrentRow(); this.selectionService.finalizeCurrentRow();
this.resetSelections();
// Clear everything after print
this.erase();
} }
erase() { erase() {