Prevent sending empty feedback

technically can still send just a bunch of spaces, but whatever
This commit is contained in:
Lance Edgar 2023-09-25 22:43:01 -05:00
parent a7ab1b5882
commit 0767b81d0b

View file

@ -410,21 +410,28 @@ class POSView(WuttaView):
autofocus=True) autofocus=True)
def send_feedback(e): def send_feedback(e):
self.app.send_email('pos_feedback', data={
'user_name': self.page.session.get('user_display'),
'message': message.value,
})
dlg.open = False if message.value:
self.page.snack_bar = ft.SnackBar(ft.Text(f"MESSAGE WAS SENT", self.app.send_email('pos_feedback', data={
color='black', 'user_name': self.page.session.get('user_display'),
weight=ft.FontWeight.BOLD), 'message': message.value,
bgcolor='green', })
duration=1500)
self.page.snack_bar.open = True dlg.open = False
self.page.snack_bar = ft.SnackBar(ft.Text(f"MESSAGE WAS SENT",
color='black',
weight=ft.FontWeight.BOLD),
bgcolor='green',
duration=1500)
self.page.snack_bar.open = True
self.main_input.focus()
else:
message.focus()
self.main_input.focus()
self.page.update() self.page.update()
def cancel(e): def cancel(e):