fix : disabled some keys in label

This commit is contained in:
karthik 2025-07-24 17:21:21 +05:30
parent 1cb49f2dc4
commit e135911c5e
3 changed files with 30 additions and 11 deletions

View File

@ -32,15 +32,23 @@ export class SelectionService {
...update
};
// Recalculate total only if both value and numbers exist
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 {
// 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
}
} else {
updated.total = 0;
}
this.currentRow.next(updated);
}
}
// ✅ Finalize the current row and push it to the finalized list
finalizeCurrentRow() {

View File

@ -9,10 +9,12 @@
<button class="btn btn-dark two" (click)="erase()">ERASE</button>
<button class="btn btn-secondary three">BOX</button>
<button class="btn btn-secondary four">FIELD</button>
<!-- <button class="btn btn-secondary four">Enter</button> -->
</div>
<!-- Right Group: COPY, CLEAR, PR -->
<div class="d-flex flex-wrap justify-content-center gap-2 second">
<button class="btn btn-dark">Enter</button>
<button class="btn btn-dark">COPY</button>
<button class="btn btn-dark">CLEAR</button>
<button class="btn btn-dark">PR</button>
@ -31,12 +33,13 @@
<button
class="btn w-100 number-button"
[ngClass]="'btn-color-' + i"
[disabled]="!ticketingActive || !!selectedLabel || maxRowsReached"
[disabled]="!ticketingActive || !!selectedLabel || maxRowsReached || isLabelDisabled(label)"
(click)="selectLabel(label)"
>
{{ label }}
</button>
</div>
</div>
</div>

View File

@ -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 = [];