add seat booking

This commit is contained in:
David Rodenkirchen
2024-09-06 14:12:33 +02:00
parent 871d8d6a3d
commit 3c3fd878c5
4 changed files with 183 additions and 17 deletions
@@ -1,18 +1,21 @@
from typing import Optional
from typing import Optional, Callable
from rio import Component, Column, Text, TextStyle, Button, Spacer
from src.ez_lan_manager import AccountingService
class SeatingPlanInfoBox(Component):
show: bool
purchase_cb: Callable
is_booking_blocked: bool
seat_id: Optional[str] = None
seat_occupant: Optional[str] = None
seat_price: int = 0
is_blocked: bool = False
user_has_seat: bool = False
def build(self) -> Component:
if not self.show:
return Spacer()
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:
@@ -25,7 +28,7 @@ class SeatingPlanInfoBox(Component):
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)})",
f"Buchen",
margin=1,
style=TextStyle(fill=self.session.theme.neutral_color, font_size=1.1),
wrap=True,
@@ -36,7 +39,8 @@ class SeatingPlanInfoBox(Component):
color="secondary",
margin=1,
grow_y=False,
is_sensitive=not self.user_has_seat
is_sensitive=not self.is_booking_blocked,
on_press=self.purchase_cb
),
min_height=10
)