From 8586ed0780a4b3a5500b3cfb9300fc545c8c7049 Mon Sep 17 00:00:00 2001 From: karthik Date: Tue, 29 Jul 2025 02:28:45 +0530 Subject: [PATCH] fix : added ' F 'logic for 1st 5 --- .../selection.service/selection.service.ts | 10 +++++-- .../touch-pad-menu.component.html | 28 ++++++++++--------- .../touch-pad-menu.component.ts | 27 ++++++++++++------ 3 files changed, 41 insertions(+), 24 deletions(-) diff --git a/btc-UI/src/app/components/selection.service/selection.service.ts b/btc-UI/src/app/components/selection.service/selection.service.ts index efc7161..08a5ca8 100644 --- a/btc-UI/src/app/components/selection.service/selection.service.ts +++ b/btc-UI/src/app/components/selection.service/selection.service.ts @@ -34,14 +34,20 @@ export class SelectionService { updated.total = 0; - if (numbers.length > 0 && value > 0 && label) { + if ((numbers.length > 0 || updated.numbers.includes('F')) && value > 0 && label) { switch (label) { case 'WIN': case 'SHP': case 'THP': case 'PLC': - updated.total = numbers.length * value * 10; + case 'SHW': { + if (updated.numbers.includes('F')) { + updated.total = 12 * value * 10; // 'F' represents 12 runners + } else { + updated.total = numbers.length * value * 10; + } break; + } case 'FOR': { const dashIndex = updated.numbers.indexOf('-'); 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 701dc71..b04639f 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 @@ -16,18 +16,18 @@
- + - + @@ -42,8 +42,10 @@
-
+
+
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 d25b28a..314d5d0 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 @@ -14,6 +14,7 @@ export class TouchPadMenuComponent implements OnInit { public twoGroupLabels = ['FOR', 'QUI']; public multiLegLabels = ['TRE', 'MJP', 'JKP']; + public allowedFieldLabels = ['WIN', 'SHP', 'THP', 'PLC', 'SHW']; labels: string[] = [ 'WIN', 'SHP', 'THP', 'PLC', 'SHW', 'FOR', @@ -74,7 +75,7 @@ export class TouchPadMenuComponent implements OnInit { } get numericPadEnabled() { - return this.selectedLabel !== null && this.selectedNumbers.length > 0; + return this.selectedLabel !== null && (this.selectedNumbers.length > 0 || this.selectedNumbers.includes('F')); } get showShashEnter(): boolean { @@ -105,7 +106,7 @@ export class TouchPadMenuComponent implements OnInit { get showBackspace(): boolean { return this.selectedLabel !== null && - this.selectedNumbers.length > 0 && + (this.selectedNumbers.length > 0 || this.selectedNumbers.includes('F')) && this.padValue.length === 0; } @@ -286,9 +287,9 @@ export class TouchPadMenuComponent implements OnInit { if (!this.numericPadEnabled) return; if (key === 'X') { - this.padValue = ''; // Clear the pad value + this.padValue = ''; } else if (/[0-9]/.test(key)) { - this.padValue += key; // Append numeric key + this.padValue += key; } this.updateCanPrint(); @@ -357,9 +358,18 @@ export class TouchPadMenuComponent implements OnInit { } removeLastNumber() { - if (!this.selectedLabel || this.selectedNumbers.length === 0) return; + if (!this.selectedLabel || (this.selectedNumbers.length === 0 && !this.selectedNumbers.includes('F'))) return; + + if (this.selectedNumbers.includes('F') && this.allowedFieldLabels.includes(this.selectedLabel || '')) { + this.selectedNumbers = []; + this.selectionService.updatePartial({ + numbers: [], + isBoxed: false, + label: this.selectedLabel || '' + }); + return; + } - // TAN Box mode: remove last number and rebuild dash-separated format if (this.selectedLabel === 'TAN' && this.isBoxed) { const currentNumbers = this.selectedNumbers.filter(n => typeof n === 'number') as number[]; if (currentNumbers.length > 0) { @@ -448,8 +458,7 @@ export class TouchPadMenuComponent implements OnInit { } canUseField(): boolean { - const allowedLabels = ['WIN', 'SHP', 'THP', 'PLC', 'SHW']; - return this.selectedLabel !== null && allowedLabels.includes(this.selectedLabel) && this.selectedNumbers.length === 0; + return this.selectedLabel !== null && this.allowedFieldLabels.includes(this.selectedLabel) && this.selectedNumbers.length === 0; } openFieldModal() { this.fieldModalOpen = true; this.fieldInput = ''; this.fieldFEntered = false; } @@ -463,7 +472,7 @@ export class TouchPadMenuComponent implements OnInit { if (key === 'F') { if (!this.fieldFEntered) { this.fieldFEntered = true; - this.fieldInput += 'F'; + this.fieldInput = 'F'; } } else { this.fieldInput += key;