fix : disabled some keys in label
This commit is contained in:
parent
1cb49f2dc4
commit
e135911c5e
@ -25,23 +25,31 @@ export class SelectionService {
|
||||
|
||||
// ✅ Update only part of the current row (label / numbers / value)
|
||||
updatePartial(update: Partial<SelectionData>) {
|
||||
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;
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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 = [];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user