Show logo image on login, POS views
This commit is contained in:
parent
d8ff7dd944
commit
d83204495b
BIN
wuttapos/assets/header_logo.png
Normal file
BIN
wuttapos/assets/header_logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
"""
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue