Loading seat prices from api, layout changes not final
This commit is contained in:
@@ -6,7 +6,8 @@ import {
|
||||
OmdbSearch,
|
||||
Bestellung,
|
||||
Eintrittskarte,
|
||||
StatisticsFilm, StatisticsVorstellung
|
||||
StatisticsFilm, StatisticsVorstellung,
|
||||
Sitzkategorie
|
||||
} from '@infinimotion/model-frontend';
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
import { inject, Injectable } from "@angular/core";
|
||||
@@ -204,4 +205,12 @@ export class HttpService {
|
||||
getShowStatistics(): Observable<StatisticsVorstellung[]> {
|
||||
return this.http.get<StatisticsVorstellung[]>(`${this.baseUrl}statistics/shows`)
|
||||
}
|
||||
|
||||
|
||||
/* Sitzkategorie APIs */
|
||||
|
||||
/* GET /api/sitzkategorie */
|
||||
getSeatCategories(): Observable<Sitzkategorie[]> {
|
||||
return this.http.get<Sitzkategorie[]>(`${this.baseUrl}sitzkategorie`)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
h1 {
|
||||
text-align: center;
|
||||
margin-bottom: 40px;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
|
||||
.menu-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
||||
gap: 30px;
|
||||
max-width: 1000px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: #faf8ff;
|
||||
padding: 20px;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 0 8px rgba(0, 0, 0, 0.15);
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.card h2 {
|
||||
margin-top: 0;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.5);
|
||||
padding-bottom: 10px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 8px 0;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
@@ -1,65 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Kino Preisliste</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background: #ffffff;
|
||||
color: #000000;
|
||||
margin: 0;
|
||||
padding: 40px;
|
||||
}
|
||||
<app-menu-header label="Preislisten" icon="euro_symbol"></app-menu-header>
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
margin-bottom: 40px;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
|
||||
.menu-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
||||
gap: 30px;
|
||||
max-width: 1000px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: #faf8ff;
|
||||
padding: 20px;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 0 8px rgba(0, 0, 0, 0.15);
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.card h2 {
|
||||
margin-top: 0;
|
||||
border-bottom: 1px solid rgba(255, 215, 0, 0.5);
|
||||
padding-bottom: 10px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 8px 0;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Kino Preisliste</h1>
|
||||
|
||||
<div class="menu-container">
|
||||
<div class="menu-container my-20">
|
||||
<!-- Popcorn -->
|
||||
<div class="card">
|
||||
<h2>🍿 Popcorn</h2>
|
||||
@@ -94,6 +35,17 @@
|
||||
<div class="item"><span>Gummibärchen</span><span>2,20 €</span></div>
|
||||
<div class="item"><span>Kindertüte</span><span>3,00 €</span></div>
|
||||
</div>
|
||||
|
||||
|
||||
@if (seatCategories.length > 0) {
|
||||
<!-- Sitze -->
|
||||
<div class="card">
|
||||
<h2>🪑 Sitzplätze</h2>
|
||||
@for (seatCategory of seatCategories; track seatCategory.id) {
|
||||
<div class="item"><span> <mat-icon style="font-size: 20px; width: 20px; height: 20px">
|
||||
{{ seatCategory.icon }}
|
||||
</mat-icon></span><span>{{seatCategory.name}}</span><span>{{getPriceDisplay(seatCategory.price)}}</span></div>
|
||||
}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Component, inject, OnInit } from '@angular/core';
|
||||
import { Sitzkategorie } from '@infinimotion/model-frontend';
|
||||
import { HttpService } from '../http.service';
|
||||
import { LoadingService } from '../loading.service';
|
||||
import { catchError, of, tap } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pricelist',
|
||||
@@ -6,6 +10,32 @@ import { Component } from '@angular/core';
|
||||
templateUrl: './pricelist.component.html',
|
||||
styleUrl: './pricelist.component.css'
|
||||
})
|
||||
export class PricelistComponent {
|
||||
export class PricelistComponent implements OnInit{
|
||||
seatCategories: Sitzkategorie[] = [];
|
||||
|
||||
private http=inject(HttpService);
|
||||
private loading=inject(LoadingService);
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loadSeatCategories();
|
||||
}
|
||||
|
||||
private loadSeatCategories() : void {
|
||||
this.loading.show();
|
||||
this.http.getSeatCategories().pipe(
|
||||
tap(seatCategories => {
|
||||
this.seatCategories = seatCategories.sort((a, b) => a.id - b.id);
|
||||
this.loading.hide();
|
||||
}),
|
||||
catchError(err => {
|
||||
this.loading.showError(err);
|
||||
console.error('Fehler beim Laden der Sitzkategorien', err);
|
||||
return of([]);
|
||||
})
|
||||
).subscribe();
|
||||
}
|
||||
|
||||
getPriceDisplay(price: number): string {
|
||||
return `${(price / 100).toFixed(2)} €`;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user