From e135911c5e0ffdaabafabc5482835da1843e04d8 Mon Sep 17 00:00:00 2001 From: karthik Date: Thu, 24 Jul 2025 17:21:21 +0530 Subject: [PATCH] fix : disabled some keys in label --- .../selection.service/selection.service.ts | 28 ++++++++++++------- .../touch-pad-menu.component.html | 5 +++- .../touch-pad-menu.component.ts | 8 ++++++ 3 files changed, 30 insertions(+), 11 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 030be3d..e1fdbc1 100644 --- a/btc-UI/src/app/components/selection.service/selection.service.ts +++ b/btc-UI/src/app/components/selection.service/selection.service.ts @@ -25,23 +25,31 @@ export class SelectionService { // ✅ Update only part of the current row (label / numbers / value) updatePartial(update: Partial) { - const current = this.currentRow.value; + const current = this.currentRow.value; - const updated: SelectionData = { - ...current, - ...update - }; + const updated: SelectionData = { + ...current, + ...update + }; - // Recalculate total only if both value and numbers exist - if (updated.numbers.length > 0 && updated.value > 0) { + + const multiplyByTenLabels = ['WIN', 'SHP', 'THP', 'PLC']; + + if (updated.numbers.length > 0 && updated.value > 0) { + if (multiplyByTenLabels.includes(updated.label)) { updated.total = updated.numbers.length * updated.value * 10; } else { - updated.total = 0; + // For other labels, define your logic e.g. no multiply by 10 or another multiplier + updated.total = updated.numbers.length * updated.value; + // Or whatever logic you need here } - - this.currentRow.next(updated); + } else { + updated.total = 0; } + this.currentRow.next(updated); +} + // ✅ Finalize the current row and push it to the finalized list finalizeCurrentRow() { const completed = this.currentRow.value; 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 045640c..06ab210 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 @@ -9,10 +9,12 @@ +
+ @@ -31,12 +33,13 @@ +
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 2808f11..49c0355 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 @@ -34,6 +34,9 @@ export class TouchPadMenuComponent implements OnInit { maxRowsReached: boolean = false; + // ✅ Disabled labels list + disabledLabels: string[] = ['SHW', 'SJP']; + constructor(private selectionService: SelectionService) {} ngOnInit() { @@ -64,6 +67,11 @@ export class TouchPadMenuComponent implements OnInit { ); } + // ✅ Check if label is disabled + isLabelDisabled(label: string): boolean { + return this.disabledLabels.includes(label); + } + selectLabel(label: string) { this.selectedLabel = label; this.selectedNumbers = [];