diff --git a/wuttapos/controls/header.py b/wuttapos/controls/header.py index e84a47b..d23370a 100644 --- a/wuttapos/controls/header.py +++ b/wuttapos/controls/header.py @@ -36,6 +36,10 @@ from .feedback import WuttaFeedback class WuttaHeader(WuttaControl): + def __init__(self, *args, **kwargs): + self.term_display = kwargs.pop('term_display', '??') + super().__init__(*args, **kwargs) + def build(self): self.txn_display = ft.Text("Txn: N", weight=ft.FontWeight.BOLD, size=20) self.cust_display = ft.Text("Cust: N", weight=ft.FontWeight.BOLD, size=20) @@ -55,6 +59,8 @@ class WuttaHeader(WuttaControl): ft.VerticalDivider(), self.logout_button, self.logout_divider, + ft.Text(f"Term: {self.term_display}", weight=ft.FontWeight.BOLD, size=20), + ft.VerticalDivider(), self.title_button, ] diff --git a/wuttapos/views/base.py b/wuttapos/views/base.py index b149da1..b90a050 100644 --- a/wuttapos/views/base.py +++ b/wuttapos/views/base.py @@ -27,6 +27,7 @@ WuttaPOS - flet views (base class) import flet as ft from wuttapos.controls.header import WuttaHeader +from wuttapos.util import get_pos_batch_handler class WuttaView(ft.View): @@ -53,9 +54,14 @@ class WuttaView(ft.View): return [self.build_header()] def build_header(self): - self.header = WuttaHeader(self.config, on_reset=self.reset) + handler = self.get_batch_handler() + self.header = WuttaHeader(self.config, on_reset=self.reset, + term_display=handler.get_terminal_id() or '??') return self.header + def get_batch_handler(self): + return get_pos_batch_handler(self.config) + def reset(self, *args, **kwargs): pass diff --git a/wuttapos/views/pos.py b/wuttapos/views/pos.py index 3c98308..097102c 100644 --- a/wuttapos/views/pos.py +++ b/wuttapos/views/pos.py @@ -33,7 +33,6 @@ import flet as ft from .base import WuttaView from wuttapos.controls.custlookup import WuttaCustomerLookup from wuttapos.controls.itemlookup import WuttaProductLookup -from wuttapos.util import get_pos_batch_handler log = logging.getLogger(__name__) @@ -64,9 +63,6 @@ class POSView(WuttaView): for control in self.informed_controls: control.informed_refresh() - def get_batch_handler(self): - return get_pos_batch_handler(self.config) - def reset(self, e=None, clear_quantity=True, update=True): """ This is a convenience method, meant only to clear the main