seats are now selectable. returns list of selected seats. colors might not work anymore. 😢😢
This commit is contained in:
30
src/app/selected-seats.service.ts
Normal file
30
src/app/selected-seats.service.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Sitzplatz} from '@infinimotion/model-frontend';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class SelectedSeatsService {
|
||||
private selectedSeatsList: Sitzplatz[] = [];
|
||||
|
||||
pushSelectedSeat(selectedSeat: Sitzplatz): void {
|
||||
this.selectedSeatsList.push(selectedSeat);
|
||||
//console.log("Added" + selectedSeat);
|
||||
//console.log(this.selectedSeatsList);
|
||||
}
|
||||
|
||||
removeSelectedSeat(selectedSeat: Sitzplatz): void {
|
||||
let removeId = this.selectedSeatsList.indexOf(selectedSeat);
|
||||
|
||||
if(removeId !== -1) {
|
||||
this.selectedSeatsList.splice(removeId, 1)
|
||||
}
|
||||
//console.log("Removed" + selectedSeat)
|
||||
//console.log(this.selectedSeatsList);
|
||||
}
|
||||
|
||||
getSelectedSeatsList(): Sitzplatz[] {
|
||||
return this.selectedSeatsList;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user