add names suggestions
This commit is contained in:
@@ -10,7 +10,8 @@ class GoodsReception:
|
||||
self.provider_manager = Providers()
|
||||
self.bulk_products_manager = BulkProducts()
|
||||
|
||||
self.product_name = ft.TextField(label="Denumire")
|
||||
self.product_suggestions = ft.Text(size=12)
|
||||
self.product_name = ft.TextField(label="Denumire", on_change=self.search_for_product_name)
|
||||
self.product_mesure_unit = ft.Dropdown(
|
||||
label="Unitate de masura",
|
||||
options=[
|
||||
@@ -88,7 +89,7 @@ class GoodsReception:
|
||||
width=400
|
||||
)
|
||||
|
||||
self.search_bar = ft.TextField(label="Cauta", expand=True, on_submit=self.on_search_btn_click)
|
||||
self.search_bar = ft.TextField(label="Cauta factura", expand=True, on_submit=self.on_search_btn_click)
|
||||
self.search_btn = ft.IconButton(
|
||||
icon=ft.Icons.SEARCH,
|
||||
bgcolor=ft.Colors.BROWN,
|
||||
@@ -112,6 +113,7 @@ class GoodsReception:
|
||||
title=ft.Text("Adauga produs"),
|
||||
content=ft.Column(
|
||||
[
|
||||
self.product_suggestions,
|
||||
self.product_name,
|
||||
self.product_quantity,
|
||||
self.product_mesure_unit,
|
||||
@@ -151,6 +153,17 @@ class GoodsReception:
|
||||
)
|
||||
|
||||
self.placeholder = ft.Column([self.products_table], width=900, scroll=ft.ScrollMode.ADAPTIVE)
|
||||
self.all_procuts = None
|
||||
|
||||
def search_for_product_name(self, e):
|
||||
produts_names = []
|
||||
for product in self.all_procuts:
|
||||
if len(self.product_name.value) >= 4:
|
||||
if self.product_name.value in product['name']:
|
||||
print('Suggested name', product['name'])
|
||||
produts_names.append(product['name'])
|
||||
self.product_suggestions.value = produts_names
|
||||
self.product_suggestions.update()
|
||||
|
||||
def show_bill_products(self):
|
||||
all_products = self.bulk_products_manager.get_products_by_bill_id(self.selected_bill['id'])[::-1]
|
||||
@@ -225,6 +238,7 @@ class GoodsReception:
|
||||
|
||||
def on_add_product_btn_click(self, item):
|
||||
self.selected_bill = item
|
||||
self.all_procuts = self.bulk_products_manager.get_all()
|
||||
self.page.open(self.add_product_dialog)
|
||||
|
||||
def on_view_list_btn_click(self, item):
|
||||
|
||||
Reference in New Issue
Block a user