add seating plan v2 (missing booking)

This commit is contained in:
David Rodenkirchen
2024-09-05 01:07:51 +02:00
parent acf458d629
commit c7c7cc7964
5 changed files with 136 additions and 50 deletions
@@ -0,0 +1,26 @@
from typing import Optional
from rio import Component, Column, Text, TextStyle, Button, Spacer
from src.ez_lan_manager import AccountingService
class SeatingPlanInfoBox(Component):
seat_id: Optional[str] = None
seat_occupant: Optional[str] = None
seat_price: int = 0
is_blocked: bool = False
def build(self) -> Component:
if self.is_blocked:
return Column(Text(f"Sitzplatz gesperrt", margin=1, style=TextStyle(fill=self.session.theme.neutral_color, font_size=1.4), wrap=True, justify="center"), min_height=10)
if self.seat_id is None and self.seat_occupant is None:
return Column(Text(f"Sitzplatz auswählen...", margin=1, style=TextStyle(fill=self.session.theme.neutral_color), wrap=True, justify="center"), min_height=10)
return Column(
Text(f"Dieser Sitzplatz ({self.seat_id}) ist gebucht von:", margin=1, style=TextStyle(fill=self.session.theme.neutral_color), wrap=True, justify="center"),
Text(f"{self.seat_occupant}", margin_bottom=1, style=TextStyle(fill=self.session.theme.neutral_color, font_size=1.4), wrap=True, justify="center"),
min_height=10
) if self.seat_id and self.seat_occupant else Column(
Text(f"Dieser Sitzplatz ({self.seat_id}) ist frei", margin=1, style=TextStyle(fill=self.session.theme.neutral_color), wrap=True, justify="center"),
Button(Text(f"Buchen ({AccountingService.make_euro_string_from_int(self.seat_price)})", margin=1, style=TextStyle(fill=self.session.theme.neutral_color, font_size=1.1), wrap=True, justify="center"), shape="rounded", style="major", color="secondary", margin=1, grow_y=False), min_height=10
)