diff --git a/src/app/order/order.component.html b/src/app/order/order.component.html index 4f31b79..951bfdc 100644 --- a/src/app/order/order.component.html +++ b/src/app/order/order.component.html @@ -25,9 +25,7 @@ @for (seatCategory of seatCategories(); track $index) {
- + } @empty { diff --git a/src/app/seat-selection/seat-selection.component.html b/src/app/seat-selection/seat-selection.component.html index 853700b..0531616 100644 --- a/src/app/seat-selection/seat-selection.component.html +++ b/src/app/seat-selection/seat-selection.component.html @@ -6,6 +6,6 @@

{{ getPriceDisplay(seatCategory().price) }}

-

× 2

-

25.00 €

+

× {{selectedSeatsByCategory()}}

+

{{ getPriceDisplay(totalPrice())}}

diff --git a/src/app/seat-selection/seat-selection.component.ts b/src/app/seat-selection/seat-selection.component.ts index e9f0f8d..07d4307 100644 --- a/src/app/seat-selection/seat-selection.component.ts +++ b/src/app/seat-selection/seat-selection.component.ts @@ -1,4 +1,5 @@ -import { Component, input } from '@angular/core'; +import { SelectedSeatsService } from './../selected-seats.service'; +import { Component, computed, inject, input } from '@angular/core'; import { Sitzkategorie } from '@infinimotion/model-frontend'; @Component({ @@ -9,10 +10,18 @@ import { Sitzkategorie } from '@infinimotion/model-frontend'; }) export class SeatSelectionComponent { seatCategory = input.required(); - amount: number = 1; + + SelectedSeatsService = inject(SelectedSeatsService); + + selectedSeatsByCategory = computed(() => + this.SelectedSeatsService.getSelectedSeatsByCategory(this.seatCategory().id).length + ); + + totalPrice = computed(() => + this.selectedSeatsByCategory() * this.seatCategory().price + ); getPriceDisplay(price: number): string { return `${(price / 100).toFixed(2)} €`; } } -