add seat booking
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user