Compare commits
2 Commits
43ce42052e
...
2c18979b9c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c18979b9c | ||
|
|
0748d9fa76 |
@ -65,9 +65,6 @@ class CateringManagementOrderDisplay(Component):
|
|||||||
return PointerEventListener(
|
return PointerEventListener(
|
||||||
content=Card(
|
content=Card(
|
||||||
content=Column(
|
content=Column(
|
||||||
Row(
|
|
||||||
Text(f"ID: {self.order.order_id}", margin_left=0.3, margin_top=0.2, justify="center", style=TextStyle(font_size=1.2)),
|
|
||||||
),
|
|
||||||
Row(
|
Row(
|
||||||
Text(f"Status: ", margin_left=0.3, margin_top=0.2),
|
Text(f"Status: ", margin_left=0.3, margin_top=0.2),
|
||||||
self.format_order_status(self.order.status),
|
self.format_order_status(self.order.status),
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
import logging
|
import logging
|
||||||
from dataclasses import field, dataclass
|
from dataclasses import field, dataclass
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Optional, Callable
|
from typing import Optional
|
||||||
|
|
||||||
from rio import Column, Component, event, TextStyle, Text, Spacer, PointerEvent, Button, Popup, Card, Row
|
from rio import Column, Component, event, TextStyle, Text, Spacer, PointerEvent, Button
|
||||||
|
|
||||||
from src.ez_lan_manager import ConfigurationService, CateringService, SeatingService, AccountingService
|
from src.ez_lan_manager import ConfigurationService, CateringService, SeatingService
|
||||||
from src.ez_lan_manager.components.CateringManagementOrderDisplay import CateringManagementOrderDisplay
|
from src.ez_lan_manager.components.CateringManagementOrderDisplay import CateringManagementOrderDisplay
|
||||||
from src.ez_lan_manager.components.MainViewContentBox import MainViewContentBox
|
from src.ez_lan_manager.components.MainViewContentBox import MainViewContentBox
|
||||||
from src.ez_lan_manager.types.CateringOrder import CateringOrder, CateringOrderStatus
|
from src.ez_lan_manager.types.CateringOrder import CateringOrder, CateringOrderStatus
|
||||||
@ -13,49 +13,6 @@ from src.ez_lan_manager.types.Seat import Seat
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__.split(".")[-1])
|
logger = logging.getLogger(__name__.split(".")[-1])
|
||||||
|
|
||||||
class CateringOrderInfoPopup(Component):
|
|
||||||
order: Optional[CateringOrder] = None
|
|
||||||
close_cb: Optional[Callable] = None
|
|
||||||
|
|
||||||
def build(self) -> Component:
|
|
||||||
if not self.order:
|
|
||||||
return Card(
|
|
||||||
content=Text(""),
|
|
||||||
margin=1,
|
|
||||||
color=self.session.theme.hud_color,
|
|
||||||
min_width=40,
|
|
||||||
min_height=40,
|
|
||||||
on_press=self.close_cb
|
|
||||||
)
|
|
||||||
rows = []
|
|
||||||
is_contrast_line = True
|
|
||||||
for item, amount in self.order.items.items():
|
|
||||||
style = TextStyle(fill=self.session.theme.secondary_color if is_contrast_line else self.session.theme.neutral_color)
|
|
||||||
is_contrast_line = not is_contrast_line
|
|
||||||
rows.append(
|
|
||||||
Row(
|
|
||||||
Text(f"{amount}x", style=style),
|
|
||||||
Spacer(),
|
|
||||||
Text(f"{item.name}", style=style)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
return Card(
|
|
||||||
content=Column(
|
|
||||||
Text(f"Bestellung {self.order.order_id}", style=TextStyle(font_size=1.2), margin_bottom=1),
|
|
||||||
*rows,
|
|
||||||
Spacer(),
|
|
||||||
Row(Text("Gesamtpreis:"), Spacer(), Text(self.session[AccountingService].make_euro_string_from_int(self.order.price)))
|
|
||||||
),
|
|
||||||
margin=1,
|
|
||||||
color=self.session.theme.hud_color,
|
|
||||||
min_width=40,
|
|
||||||
min_height=40,
|
|
||||||
on_press=self.close_cb,
|
|
||||||
corner_radius=0.5,
|
|
||||||
elevate_on_hover=False,
|
|
||||||
colorize_on_hover=False
|
|
||||||
)
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class CateringOrderWithSeat:
|
class CateringOrderWithSeat:
|
||||||
catering_order: CateringOrder
|
catering_order: CateringOrder
|
||||||
@ -64,8 +21,6 @@ class CateringOrderWithSeat:
|
|||||||
class ManageCateringPage(Component):
|
class ManageCateringPage(Component):
|
||||||
all_orders: list[CateringOrderWithSeat] = field(default_factory=list)
|
all_orders: list[CateringOrderWithSeat] = field(default_factory=list)
|
||||||
last_updated: Optional[datetime] = None
|
last_updated: Optional[datetime] = None
|
||||||
order_popup_open: bool = False
|
|
||||||
order_popup_order: Optional[CateringOrder] = None
|
|
||||||
|
|
||||||
@event.on_populate
|
@event.on_populate
|
||||||
async def on_populate(self) -> None:
|
async def on_populate(self) -> None:
|
||||||
@ -98,33 +53,24 @@ class ManageCateringPage(Component):
|
|||||||
return sorted_list
|
return sorted_list
|
||||||
|
|
||||||
async def order_clicked(self, order: CateringOrder, _: PointerEvent) -> None:
|
async def order_clicked(self, order: CateringOrder, _: PointerEvent) -> None:
|
||||||
self.order_popup_order = order
|
pass
|
||||||
self.order_popup_open = True
|
|
||||||
|
|
||||||
async def close_cb(self) -> None:
|
|
||||||
self.order_popup_open = False
|
|
||||||
|
|
||||||
def build(self) -> Component:
|
def build(self) -> Component:
|
||||||
header_text = Text(
|
|
||||||
text="Catering Verwaltung",
|
|
||||||
style=TextStyle(
|
|
||||||
fill=self.session.theme.background_color,
|
|
||||||
font_size=1.2
|
|
||||||
),
|
|
||||||
margin_top=2,
|
|
||||||
margin_bottom=2,
|
|
||||||
align_x=0.5
|
|
||||||
)
|
|
||||||
popup = Popup(
|
|
||||||
anchor=header_text,
|
|
||||||
content=CateringOrderInfoPopup(order=self.order_popup_order, close_cb=self.close_cb),
|
|
||||||
is_open=self.order_popup_open,
|
|
||||||
position="bottom",
|
|
||||||
corner_radius=0.5
|
|
||||||
)
|
|
||||||
return Column(
|
return Column(
|
||||||
MainViewContentBox(
|
MainViewContentBox(
|
||||||
Column(popup)
|
Column(
|
||||||
|
Text(
|
||||||
|
text="Catering Verwaltung",
|
||||||
|
style=TextStyle(
|
||||||
|
fill=self.session.theme.background_color,
|
||||||
|
font_size=1.2
|
||||||
|
),
|
||||||
|
margin_top=2,
|
||||||
|
margin_bottom=2,
|
||||||
|
align_x=0.5
|
||||||
|
)
|
||||||
|
)
|
||||||
),
|
),
|
||||||
MainViewContentBox(
|
MainViewContentBox(
|
||||||
Column(
|
Column(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user