hide payment btn
This commit is contained in:
@@ -209,19 +209,16 @@ class Cart:
|
||||
"Cost transport 17 lei.",
|
||||
weight=ft.FontWeight.BOLD
|
||||
),
|
||||
self.payment_message,
|
||||
ft.Row([self.payment_redirect_button],alignment=ft.MainAxisAlignment.CENTER),
|
||||
#self.payment_message,
|
||||
|
||||
ft.Row([self.error_message],alignment=ft.MainAxisAlignment.CENTER),
|
||||
ft.Row(
|
||||
[
|
||||
ft.Button(
|
||||
"Comanda",
|
||||
width=150,
|
||||
on_click=self.open_confirm_dialog
|
||||
)
|
||||
self.order_btn
|
||||
],
|
||||
alignment=ft.MainAxisAlignment.CENTER
|
||||
)
|
||||
),
|
||||
ft.Row([self.payment_redirect_button],alignment=ft.MainAxisAlignment.CENTER),
|
||||
],
|
||||
expand=5,
|
||||
alignment=ft.MainAxisAlignment.START
|
||||
@@ -258,6 +255,14 @@ class Cart:
|
||||
break
|
||||
|
||||
self.card_id = ft.Text(f"Card de reducere nr. {_card_id}" if _card_id else '', weight=ft.FontWeight.BOLD)
|
||||
|
||||
self.update_cart_total()
|
||||
|
||||
self.order_btn = ft.FilledButton(
|
||||
"Comanda",
|
||||
width=150,
|
||||
on_click=self.open_confirm_dialog
|
||||
)
|
||||
|
||||
def on_second_address_btn_click(self, e):
|
||||
self.is_second_address = True
|
||||
@@ -290,14 +295,31 @@ class Cart:
|
||||
name = item['name']
|
||||
if name not in all_products:
|
||||
all_products.append(name)
|
||||
try:
|
||||
self.pret_total.value = f'Pret total: {total+17}'
|
||||
self.pret_total.update()
|
||||
except:
|
||||
pass
|
||||
# try:
|
||||
# self.pret_total.value = f'Pret total: {total+17}'
|
||||
# self.pret_total.update()
|
||||
# except:
|
||||
# pass
|
||||
return ft.Text(
|
||||
value=' '.join(all_products)
|
||||
)
|
||||
|
||||
def update_cart_total(self):
|
||||
"""Recalculate and update cart total (products + transport)."""
|
||||
if not self.on_hold_orders:
|
||||
self.pret_total.value = "Pret total: 0"
|
||||
self.pret_total.update()
|
||||
return
|
||||
|
||||
products = self.orders_manager.get_order_products(self.on_hold_orders['id'])
|
||||
total = 0
|
||||
for product in products:
|
||||
item = self.productsDB.get(product['prdouct_id'])
|
||||
total += item['price']
|
||||
|
||||
shipping_cost = 17
|
||||
self.pret_total.value = f"Pret total: {total + shipping_cost}"
|
||||
self.pret_total.update()
|
||||
|
||||
|
||||
def on_go_back_button_click(self, e):
|
||||
@@ -688,6 +710,8 @@ class Cart:
|
||||
self.payment_message.value = "Pentru a finaliza plata, apasati butonul de mai jos."
|
||||
self.payment_message.update()
|
||||
self.payment_redirect_button.update()
|
||||
self.order_btn.visible = False
|
||||
self.order_btn.update()
|
||||
else:
|
||||
self.error_message.value = "Nu am primit URL-ul de plata."
|
||||
self.error_message.update()
|
||||
@@ -722,7 +746,7 @@ class Cart:
|
||||
#hiostory
|
||||
self.create_history()
|
||||
|
||||
self.error_message.value = "Comanda a fost trimisa cu success!"
|
||||
self.error_message.value = "Generam linul de plata, va rugam asteptati!"
|
||||
self.error_message.color = ft.Colors.GREEN
|
||||
self.error_message.update()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user