From de01c3f9d13a3c7b05c961395e1425e7b9eef1bc Mon Sep 17 00:00:00 2001 From: karthik Date: Thu, 31 Jul 2025 12:23:08 +0530 Subject: [PATCH] fix : added different logic to enter and print --- .../touch-pad-menu.component.html | 16 +++++++-- .../touch-pad-menu.component.ts | 36 ++++++++++++++++--- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.html b/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.html index d916233..f8e6d58 100755 --- a/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.html +++ b/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.html @@ -104,10 +104,22 @@
- +
- +
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 cea60ca..46234b5 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 @@ -299,9 +299,31 @@ export class TouchPadMenuComponent implements OnInit, OnDestroy { } onPadEnter() { - if (this.canPrint) { - this.print(); - } + // Only allows entry if less than 5 rows are filled + if (this.maxRowsReached) return; + + 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() { @@ -369,13 +391,19 @@ export class TouchPadMenuComponent implements OnInit, OnDestroy { } print() { + // Don't print if no rows + if (this.currentSelections.length === 0) return; + const selectionsTotal = this.currentSelections.reduce((sum, sel) => sum + sel.total, 0); if (selectionsTotal + this.currentTotal > 5000) { this.showLimitPopup = true; return; } + // Submit all rows this.selectionService.finalizeCurrentRow(); - this.resetSelections(); + + // Clear everything after print + this.erase(); } erase() {