diff --git a/wuttapos/assets/header_logo.png b/wuttapos/assets/header_logo.png new file mode 100644 index 0000000..96fae96 Binary files /dev/null and b/wuttapos/assets/header_logo.png differ diff --git a/wuttapos/controls/header.py b/wuttapos/controls/header.py index d23370a..bc52c24 100644 --- a/wuttapos/controls/header.py +++ b/wuttapos/controls/header.py @@ -109,9 +109,15 @@ class WuttaHeader(WuttaControl): def title_click(self, e): title = self.app.get_title() - license = """\ + year = self.app.today().year + if year > 2023: + year_range = f'2023 - {year}' + else: + year_range = year + + license = f"""\ WuttaPOS -- Pythonic Point of Sale System -Copyright © 2023 Lance Edgar +Copyright © {year_range} Lance Edgar WuttaPOS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software diff --git a/wuttapos/views/base.py b/wuttapos/views/base.py index 766dd36..827970e 100644 --- a/wuttapos/views/base.py +++ b/wuttapos/views/base.py @@ -65,6 +65,13 @@ class WuttaView(ft.View): def reset(self, *args, **kwargs): pass + def make_logo_image(self, **kwargs): + logo = self.config.get('wuttapos', 'header.logo') + if not logo: + logo = '/header_logo.png' + kwargs.setdefault('height', 100) + return ft.Image(src=logo, **kwargs) + class WuttaViewContainer(ft.Container): """ diff --git a/wuttapos/views/login.py b/wuttapos/views/login.py index 9bc7e75..814502f 100644 --- a/wuttapos/views/login.py +++ b/wuttapos/views/login.py @@ -48,6 +48,10 @@ class LoginView(WuttaView): def build_controls(self): title = self.app.get_title() controls = [ + ft.Row( + [self.make_logo_image(height=200)], + alignment=ft.MainAxisAlignment.CENTER, + ), ft.Row( [ft.Text(value=f"Welcome to {title}", weight=ft.FontWeight.BOLD, size=28)], alignment=ft.MainAxisAlignment.CENTER, diff --git a/wuttapos/views/pos.py b/wuttapos/views/pos.py index f6cad59..4370789 100644 --- a/wuttapos/views/pos.py +++ b/wuttapos/views/pos.py @@ -681,7 +681,7 @@ class POSView(WuttaView): ft.Row( [ meta_button("CUST", bgcolor='blue', on_click=self.customer_click), - meta_button("MGR", bgcolor='blue', on_click=self.not_supported), + meta_button("MGR", bgcolor='yellow', on_click=self.not_supported), ], spacing=0, ), @@ -742,6 +742,7 @@ class POSView(WuttaView): ft.Row( [ + self.make_logo_image(height=80), ft.Row( [ self.set_quantity, @@ -985,6 +986,8 @@ class POSView(WuttaView): handler = self.get_batch_handler() user = self.get_current_user(session) batch = self.get_current_batch(session, user=user, create=False) + code = e.control.data['tender_code'] + tender = handler.get_tender(session, code) # nothing to do if no transaction if not batch: @@ -1040,9 +1043,20 @@ class POSView(WuttaView): self.reset() return + # do nothing if @ quantity present + if self.set_quantity.data: + session.close() + self.page.snack_bar = ft.SnackBar(ft.Text(f"QUANTITY NOT ALLOWED FOR TENDER: {self.set_quantity.value}", + color='black', + size=20, + weight=ft.FontWeight.BOLD), + bgcolor='yellow', + duration=1500) + self.page.snack_bar.open = True + self.reset() + return + # tender / execute batch - code = e.control.data['tender_code'] - tender = handler.get_tender(session, code) try: # TODO: still need support for the following: