More tweaks for training mode
make sure the TRAINING MODE sign in header stays put, instead of "wandering" as the timestamp is updated also make sure suspend/resume honors current training mode flag
This commit is contained in:
parent
0e5ad257c8
commit
95bf8ecfca
|
@ -44,14 +44,27 @@ class WuttaHeader(WuttaControl):
|
||||||
self.txn_display = ft.Text("Txn: N", weight=ft.FontWeight.BOLD, size=20)
|
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.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.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_button = ft.OutlinedButton("Logout", on_click=self.logout_click, visible=False)
|
||||||
self.logout_divider = ft.VerticalDivider(visible=False)
|
self.logout_divider = ft.VerticalDivider(visible=False)
|
||||||
self.title_button = ft.FilledButton(self.app.get_title(), on_click=self.title_click)
|
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(
|
||||||
[
|
[
|
||||||
ft.Row(
|
ft.Row(
|
||||||
[
|
[
|
||||||
|
@ -62,7 +75,6 @@ class WuttaHeader(WuttaControl):
|
||||||
WuttaTimestamp(self.config, weight=ft.FontWeight.BOLD, size=20),
|
WuttaTimestamp(self.config, weight=ft.FontWeight.BOLD, size=20),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
self.training_mode,
|
|
||||||
ft.Row(
|
ft.Row(
|
||||||
[
|
[
|
||||||
self.user_display,
|
self.user_display,
|
||||||
|
@ -76,6 +88,9 @@ class WuttaHeader(WuttaControl):
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
alignment=ft.MainAxisAlignment.SPACE_BETWEEN,
|
alignment=ft.MainAxisAlignment.SPACE_BETWEEN,
|
||||||
|
),
|
||||||
|
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
def did_mount(self):
|
def did_mount(self):
|
||||||
|
@ -102,7 +117,7 @@ class WuttaHeader(WuttaControl):
|
||||||
|
|
||||||
def update_training_display(self):
|
def update_training_display(self):
|
||||||
if self.page.session.get('training'):
|
if self.page.session.get('training'):
|
||||||
self.training_mode.value = "TRAINING MODE"
|
self.training_mode.value = " TRAINING MODE "
|
||||||
else:
|
else:
|
||||||
self.training_mode.value = ""
|
self.training_mode.value = ""
|
||||||
|
|
||||||
|
|
|
@ -60,9 +60,11 @@ class WuttaTransactionLookup(WuttaLookup):
|
||||||
|
|
||||||
# TODO: how to deal with 'modes'
|
# TODO: how to deal with 'modes'
|
||||||
assert self.mode == 'resume'
|
assert self.mode == 'resume'
|
||||||
|
training = bool(self.mypage.session.get('training'))
|
||||||
query = session.query(model.POSBatch)\
|
query = session.query(model.POSBatch)\
|
||||||
.filter(model.POSBatch.status_code == model.POSBatch.STATUS_SUSPENDED)\
|
.filter(model.POSBatch.status_code == model.POSBatch.STATUS_SUSPENDED)\
|
||||||
.filter(model.POSBatch.executed == None)\
|
.filter(model.POSBatch.executed == None)\
|
||||||
|
.filter(model.POSBatch.training_mode == training)\
|
||||||
.order_by(model.POSBatch.created.desc())
|
.order_by(model.POSBatch.created.desc())
|
||||||
|
|
||||||
transactions = []
|
transactions = []
|
||||||
|
|
|
@ -1000,7 +1000,7 @@ class POSView(WuttaView):
|
||||||
# prompt to choose txn
|
# prompt to choose txn
|
||||||
dlg = ft.AlertDialog(
|
dlg = ft.AlertDialog(
|
||||||
title=ft.Text("Resume Transaction"),
|
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),
|
on_select=select, on_cancel=cancel),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1410,6 +1410,7 @@ class POSView(WuttaView):
|
||||||
on_click=self.list_item_click,
|
on_click=self.list_item_click,
|
||||||
data={'row': row},
|
data={'row': row},
|
||||||
key=row.uuid,
|
key=row.uuid,
|
||||||
|
bgcolor='white',
|
||||||
))
|
))
|
||||||
|
|
||||||
if scroll:
|
if scroll:
|
||||||
|
|
Loading…
Reference in a new issue