fix : disabled after adding to 5 rows

This commit is contained in:
karthik 2025-07-23 15:24:13 +05:30
parent eae411d9b9
commit 69f14893d6
2 changed files with 28 additions and 10 deletions

View File

@ -28,12 +28,21 @@
<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>
<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">
<div class="p-2 rounded wrapper-pad" style="background-color: #f1f1f1df">

View File

@ -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() {