diff --git a/wuttapos/controls/header.py b/wuttapos/controls/header.py index 74e3918..545fa34 100644 --- a/wuttapos/controls/header.py +++ b/wuttapos/controls/header.py @@ -44,38 +44,53 @@ class WuttaHeader(WuttaControl): 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) - self.training_mode = ft.Text(size=40, weight=ft.FontWeight.BOLD, bgcolor='yellow') + self.training_mode = ft.Text(size=40, weight=ft.FontWeight.BOLD) self.user_display = ft.Text("User: N", weight=ft.FontWeight.BOLD, size=20) self.logout_button = ft.OutlinedButton("Logout", on_click=self.logout_click, visible=False) self.logout_divider = ft.VerticalDivider(visible=False) self.title_button = ft.FilledButton(self.app.get_title(), on_click=self.title_click) - return ft.Row( - [ + return ft.Stack( + controls=[ + ft.Container( + content=ft.Row( + [ + ft.Container( + content=self.training_mode, + bgcolor='yellow', + ), + ], + alignment=ft.MainAxisAlignment.CENTER, + ), + ), ft.Row( [ - self.txn_display, - ft.VerticalDivider(), - self.cust_display, - ft.VerticalDivider(), - WuttaTimestamp(self.config, weight=ft.FontWeight.BOLD, size=20), - ], - ), - self.training_mode, - ft.Row( - [ - self.user_display, - 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, + ft.Row( + [ + self.txn_display, + ft.VerticalDivider(), + self.cust_display, + ft.VerticalDivider(), + WuttaTimestamp(self.config, weight=ft.FontWeight.BOLD, size=20), + ], + ), + ft.Row( + [ + self.user_display, + 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, + ], + ), ], + alignment=ft.MainAxisAlignment.SPACE_BETWEEN, ), + ], - alignment=ft.MainAxisAlignment.SPACE_BETWEEN, ) def did_mount(self): @@ -102,7 +117,7 @@ class WuttaHeader(WuttaControl): def update_training_display(self): if self.page.session.get('training'): - self.training_mode.value = "TRAINING MODE" + self.training_mode.value = " TRAINING MODE " else: self.training_mode.value = "" diff --git a/wuttapos/controls/txnlookup.py b/wuttapos/controls/txnlookup.py index 8315465..ffefef0 100644 --- a/wuttapos/controls/txnlookup.py +++ b/wuttapos/controls/txnlookup.py @@ -60,9 +60,11 @@ class WuttaTransactionLookup(WuttaLookup): # TODO: how to deal with 'modes' assert self.mode == 'resume' + training = bool(self.mypage.session.get('training')) query = session.query(model.POSBatch)\ .filter(model.POSBatch.status_code == model.POSBatch.STATUS_SUSPENDED)\ .filter(model.POSBatch.executed == None)\ + .filter(model.POSBatch.training_mode == training)\ .order_by(model.POSBatch.created.desc()) transactions = [] diff --git a/wuttapos/views/pos.py b/wuttapos/views/pos.py index a204353..e2f9e8f 100644 --- a/wuttapos/views/pos.py +++ b/wuttapos/views/pos.py @@ -1000,7 +1000,7 @@ class POSView(WuttaView): # prompt to choose txn dlg = ft.AlertDialog( title=ft.Text("Resume Transaction"), - content=WuttaTransactionLookup(self.config, mode='resume', + content=WuttaTransactionLookup(self.config, page=self.page, mode='resume', on_select=select, on_cancel=cancel), ) @@ -1410,6 +1410,7 @@ class POSView(WuttaView): on_click=self.list_item_click, data={'row': row}, key=row.uuid, + bgcolor='white', )) if scroll: