add seatIsSelected to SelectedSeatService, so seats cannot be interacted with while cooking/reservation

This commit is contained in:
Marcel-Anker
2025-11-13 17:47:45 +01:00
parent a9e1d28f09
commit 769fb8b2cd
3 changed files with 15 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
<button (click)="updateSelectedSeats(this.seat())" [disabled]="state() == TheaterSeatState.BOOKED || state() == TheaterSeatState.RESERVED" class="mx-1 hover:opacity-50">
<button (click)="updateSelectedSeats(this.seat())" [disabled]="state() == TheaterSeatState.BOOKED || state() == TheaterSeatState.RESERVED || !seatService.getSeatIsSelected()" class="mx-1 hover:opacity-50">
<mat-icon [ngStyle]="{'opacity': selected ? '0.5' : '1', color: getSeatStateColor() }" style="font-size: 30px; width: 30px; height: 30px">
@if(this.seat().row.category.id ==1){
event_seat

View File

@@ -15,7 +15,7 @@ export class SeatComponent{
selected: boolean = false;
private seatService = inject(SelectedSeatsService)
protected seatService = inject(SelectedSeatsService)
getSeatStateColor(): any {
switch (this.state()) {

View File

@@ -6,6 +6,7 @@ import {Sitzplatz} from '@infinimotion/model-frontend';
})
export class SelectedSeatsService {
private selectedSeatsList: Sitzplatz[] = [];
private seatIsSelectable: boolean = true;
pushSelectedSeat(selectedSeat: Sitzplatz): void {
this.selectedSeatsList.push(selectedSeat);
@@ -35,4 +36,16 @@ export class SelectedSeatsService {
//}
}
getSeatIsSelected(): boolean{
return this.seatIsSelectable;
}
setSeatIsSelectableTrue(): void {
this.seatIsSelectable = true;
}
setSeatIsSelectableFalse(): void {
this.seatIsSelectable = false;
}
}