Move the '@' button next to main input
not really needed on the 10-key, so replace that with minus sign this also adds feature to select a line item, then click ITEM to re-ring the same item (and honor set quantity)
This commit is contained in:
parent
7b73438cf9
commit
d933a6acbc
|
@ -53,7 +53,7 @@ class WuttaTenkeyMenu(WuttaControl):
|
||||||
]
|
]
|
||||||
if not self.simple:
|
if not self.simple:
|
||||||
row1.extend([
|
row1.extend([
|
||||||
self.make_tenkey_button("@"),
|
self.make_tenkey_button("-"),
|
||||||
])
|
])
|
||||||
|
|
||||||
row2 = [
|
row2 = [
|
||||||
|
|
|
@ -78,8 +78,10 @@ class POSView(WuttaView):
|
||||||
"""
|
"""
|
||||||
# clear set (@) quantity
|
# clear set (@) quantity
|
||||||
if clear_quantity:
|
if clear_quantity:
|
||||||
|
if self.set_quantity.data:
|
||||||
self.set_quantity.data = None
|
self.set_quantity.data = None
|
||||||
self.set_quantity.value = None
|
self.set_quantity.value = None
|
||||||
|
self.set_quantity_button.visible = True
|
||||||
|
|
||||||
# clear/focus main input
|
# clear/focus main input
|
||||||
self.main_input.value = ''
|
self.main_input.value = ''
|
||||||
|
@ -114,6 +116,15 @@ class POSView(WuttaView):
|
||||||
if not self.attempt_add_product():
|
if not self.attempt_add_product():
|
||||||
self.item_lookup(value)
|
self.item_lookup(value)
|
||||||
|
|
||||||
|
elif self.selected_item:
|
||||||
|
row = self.selected_item.data['row']
|
||||||
|
if row.product_uuid:
|
||||||
|
if self.attempt_add_product(uuid=row.product_uuid):
|
||||||
|
self.clear_item_selection()
|
||||||
|
self.page.update()
|
||||||
|
else:
|
||||||
|
self.item_lookup()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.item_lookup()
|
self.item_lookup()
|
||||||
|
|
||||||
|
@ -504,34 +515,6 @@ class POSView(WuttaView):
|
||||||
self.customer_lookup()
|
self.customer_lookup()
|
||||||
|
|
||||||
def tenkey_char(self, key):
|
def tenkey_char(self, key):
|
||||||
|
|
||||||
if key == '@':
|
|
||||||
quantity = self.main_input.value
|
|
||||||
valid = False
|
|
||||||
|
|
||||||
if self.set_quantity.data is not None:
|
|
||||||
quantity = self.set_quantity.data
|
|
||||||
self.show_snackbar(f"QUANTITY ALREADY SET: {quantity}", bgcolor='yellow')
|
|
||||||
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
quantity = decimal.Decimal(quantity)
|
|
||||||
valid = True
|
|
||||||
except decimal.InvalidOperation:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if valid and quantity:
|
|
||||||
self.set_quantity.data = quantity
|
|
||||||
self.set_quantity.value = self.app.render_quantity(quantity) + " @ "
|
|
||||||
self.main_input.value = ""
|
|
||||||
self.main_input.focus()
|
|
||||||
|
|
||||||
else:
|
|
||||||
self.show_snackbar(f"INVALID @ QUANTITY: {quantity}", bgcolor='yellow')
|
|
||||||
|
|
||||||
self.page.update()
|
|
||||||
|
|
||||||
else: # normal char
|
|
||||||
self.main_input.value = f"{self.main_input.value or ''}{key}"
|
self.main_input.value = f"{self.main_input.value or ''}{key}"
|
||||||
self.main_input.focus()
|
self.main_input.focus()
|
||||||
self.page.update()
|
self.page.update()
|
||||||
|
@ -630,6 +613,7 @@ class POSView(WuttaView):
|
||||||
elif self.set_quantity.data is not None:
|
elif self.set_quantity.data is not None:
|
||||||
self.set_quantity.data = None
|
self.set_quantity.data = None
|
||||||
self.set_quantity.value = None
|
self.set_quantity.value = None
|
||||||
|
self.set_quantity_button.visible = True
|
||||||
elif self.selected_item:
|
elif self.selected_item:
|
||||||
self.clear_item_selection()
|
self.clear_item_selection()
|
||||||
self.main_input.focus()
|
self.main_input.focus()
|
||||||
|
@ -743,15 +727,27 @@ class POSView(WuttaView):
|
||||||
|
|
||||||
self.set_quantity = ft.Text(value=None, data=None, weight=ft.FontWeight.BOLD, size=40)
|
self.set_quantity = ft.Text(value=None, data=None, weight=ft.FontWeight.BOLD, size=40)
|
||||||
|
|
||||||
|
self.set_quantity_button = self.make_button("@",
|
||||||
|
font_size=40,
|
||||||
|
height=70,
|
||||||
|
width=70,
|
||||||
|
bgcolor='green',
|
||||||
|
on_click=self.set_quantity_click)
|
||||||
|
|
||||||
return [
|
return [
|
||||||
self.build_header(),
|
self.build_header(),
|
||||||
|
|
||||||
ft.Row(
|
ft.Row(
|
||||||
[
|
[
|
||||||
self.make_logo_image(height=80),
|
self.make_logo_image(height=80),
|
||||||
|
ft.Row(
|
||||||
|
[
|
||||||
ft.Row(
|
ft.Row(
|
||||||
[
|
[
|
||||||
self.set_quantity,
|
self.set_quantity,
|
||||||
|
self.set_quantity_button,
|
||||||
|
],
|
||||||
|
),
|
||||||
self.main_input,
|
self.main_input,
|
||||||
self.make_button("⌫", font_size=40, bgcolor='green',
|
self.make_button("⌫", font_size=40, bgcolor='green',
|
||||||
height=70, width=70,
|
height=70, width=70,
|
||||||
|
@ -799,6 +795,33 @@ class POSView(WuttaView):
|
||||||
kwargs.setdefault('size', 24)
|
kwargs.setdefault('size', 24)
|
||||||
return ft.Text(*args, **kwargs)
|
return ft.Text(*args, **kwargs)
|
||||||
|
|
||||||
|
def set_quantity_click(self, e):
|
||||||
|
quantity = self.main_input.value
|
||||||
|
valid = False
|
||||||
|
|
||||||
|
if self.set_quantity.data is not None:
|
||||||
|
quantity = self.set_quantity.data
|
||||||
|
self.show_snackbar(f"QUANTITY ALREADY SET: {quantity}", bgcolor='yellow')
|
||||||
|
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
quantity = decimal.Decimal(quantity)
|
||||||
|
valid = True
|
||||||
|
except decimal.InvalidOperation:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if valid and quantity:
|
||||||
|
self.set_quantity.data = quantity
|
||||||
|
self.set_quantity.value = self.app.render_quantity(quantity) + " @ "
|
||||||
|
self.set_quantity_button.visible = False
|
||||||
|
self.main_input.value = ""
|
||||||
|
self.main_input.focus()
|
||||||
|
|
||||||
|
else:
|
||||||
|
self.show_snackbar(f"INVALID @ QUANTITY: {quantity}", bgcolor='yellow')
|
||||||
|
|
||||||
|
self.page.update()
|
||||||
|
|
||||||
def make_tender_button(self, tender, **kwargs):
|
def make_tender_button(self, tender, **kwargs):
|
||||||
if isinstance(tender, self.model.Tender):
|
if isinstance(tender, self.model.Tender):
|
||||||
info = {'tender_code': tender.code,
|
info = {'tender_code': tender.code,
|
||||||
|
|
Loading…
Reference in a new issue