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

@ -24,15 +24,24 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="row gx-2 gy-2 wrapper"> <div class="row gx-2 gy-2 wrapper">
<!-- Label Section --> <!-- Label Section -->
<div class="col-3"> <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="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="row gx-1 gy-1 custom-touchpad">
<div class="col-4" *ngFor="let label of labelRowsFlat; let i = index"> <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
</div> class="btn w-100 number-button"
</div> [ngClass]="'btn-color-' + i"
</div> [disabled]="!!selectedLabel || maxRowsReached"
(click)="selectLabel(label)"
>
{{ label }}
</button>
</div> </div>
</div>
</div>
</div>
<!-- Numbers 1 to 30 --> <!-- Numbers 1 to 30 -->
<div class="col-7"> <div class="col-7">

View File

@ -32,11 +32,18 @@ export class TouchPadMenuComponent implements OnInit {
calculatorOpen = false; calculatorOpen = false;
calcDisplay = ''; calcDisplay = '';
maxRowsReached: boolean = false;
constructor(private selectionService: SelectionService) {} constructor(private selectionService: SelectionService) {}
ngOnInit() { ngOnInit() {
this.labelRowsFlat = this.labelRows.flat(); this.labelRowsFlat = this.labelRows.flat();
this.numbersFlat = this.numberRows.flat(); this.numbersFlat = this.numberRows.flat();
// Watch filled rows count
this.selectionService.selections$.subscribe(selections => {
this.maxRowsReached = selections.length >= 5;
});
} }
get labelRows() { get labelRows() {
@ -104,7 +111,9 @@ export class TouchPadMenuComponent implements OnInit {
} }
padEnter() { padEnter() {
// Optional: can trigger print or do nothing if (this.canPrint) {
this.print();
}
} }
print() { print() {
@ -115,7 +124,7 @@ export class TouchPadMenuComponent implements OnInit {
erase() { erase() {
this.selectionService.clearSelections(); this.selectionService.clearSelections();
this.resetSelections(); // Clear local selections this.resetSelections();
} }
resetSelections() { resetSelections() {