fix : disabled after adding to 5 rows
This commit is contained in:
parent
eae411d9b9
commit
69f14893d6
@ -24,15 +24,24 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row gx-2 gy-2 wrapper">
|
||||
<!-- Label Section -->
|
||||
<div class="col-3">
|
||||
<div class="p-2 rounded wrapper-pad" [ngStyle]="{ 'background-color': ticketingActive ? '#d0ddf5' : '#f1f1f1df', border: ticketingActive ? '3px solid #050505' : 'none' }">
|
||||
<div class="row gx-1 gy-1 custom-touchpad">
|
||||
<div class="col-4" *ngFor="let label of labelRowsFlat; let i = index">
|
||||
<button class="btn w-100 number-button" [ngClass]="'btn-color-' + i" [disabled]="!!selectedLabel" (click)="selectLabel(label)">{{ label }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="p-2 rounded wrapper-pad" [ngStyle]="{ 'background-color': ticketingActive ? '#d0ddf5' : '#f1f1f1df', border: ticketingActive ? '3px solid #050505' : 'none' }">
|
||||
<div class="row gx-1 gy-1 custom-touchpad">
|
||||
<div class="col-4" *ngFor="let label of labelRowsFlat; let i = index">
|
||||
<button
|
||||
class="btn w-100 number-button"
|
||||
[ngClass]="'btn-color-' + i"
|
||||
[disabled]="!!selectedLabel || maxRowsReached"
|
||||
(click)="selectLabel(label)"
|
||||
>
|
||||
{{ label }}
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Numbers 1 to 30 -->
|
||||
<div class="col-7">
|
||||
|
||||
@ -32,11 +32,18 @@ export class TouchPadMenuComponent implements OnInit {
|
||||
calculatorOpen = false;
|
||||
calcDisplay = '';
|
||||
|
||||
maxRowsReached: boolean = false;
|
||||
|
||||
constructor(private selectionService: SelectionService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.labelRowsFlat = this.labelRows.flat();
|
||||
this.numbersFlat = this.numberRows.flat();
|
||||
|
||||
// Watch filled rows count
|
||||
this.selectionService.selections$.subscribe(selections => {
|
||||
this.maxRowsReached = selections.length >= 5;
|
||||
});
|
||||
}
|
||||
|
||||
get labelRows() {
|
||||
@ -104,7 +111,9 @@ export class TouchPadMenuComponent implements OnInit {
|
||||
}
|
||||
|
||||
padEnter() {
|
||||
// Optional: can trigger print or do nothing
|
||||
if (this.canPrint) {
|
||||
this.print();
|
||||
}
|
||||
}
|
||||
|
||||
print() {
|
||||
@ -115,7 +124,7 @@ export class TouchPadMenuComponent implements OnInit {
|
||||
|
||||
erase() {
|
||||
this.selectionService.clearSelections();
|
||||
this.resetSelections(); // Clear local selections
|
||||
this.resetSelections();
|
||||
}
|
||||
|
||||
resetSelections() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user