hide payment btn
This commit is contained in:
@@ -209,19 +209,16 @@ class Cart:
|
|||||||
"Cost transport 17 lei.",
|
"Cost transport 17 lei.",
|
||||||
weight=ft.FontWeight.BOLD
|
weight=ft.FontWeight.BOLD
|
||||||
),
|
),
|
||||||
self.payment_message,
|
#self.payment_message,
|
||||||
ft.Row([self.payment_redirect_button],alignment=ft.MainAxisAlignment.CENTER),
|
|
||||||
ft.Row([self.error_message],alignment=ft.MainAxisAlignment.CENTER),
|
ft.Row([self.error_message],alignment=ft.MainAxisAlignment.CENTER),
|
||||||
ft.Row(
|
ft.Row(
|
||||||
[
|
[
|
||||||
ft.Button(
|
self.order_btn
|
||||||
"Comanda",
|
|
||||||
width=150,
|
|
||||||
on_click=self.open_confirm_dialog
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
alignment=ft.MainAxisAlignment.CENTER
|
alignment=ft.MainAxisAlignment.CENTER
|
||||||
)
|
),
|
||||||
|
ft.Row([self.payment_redirect_button],alignment=ft.MainAxisAlignment.CENTER),
|
||||||
],
|
],
|
||||||
expand=5,
|
expand=5,
|
||||||
alignment=ft.MainAxisAlignment.START
|
alignment=ft.MainAxisAlignment.START
|
||||||
@@ -259,6 +256,14 @@ class Cart:
|
|||||||
|
|
||||||
self.card_id = ft.Text(f"Card de reducere nr. {_card_id}" if _card_id else '', weight=ft.FontWeight.BOLD)
|
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):
|
def on_second_address_btn_click(self, e):
|
||||||
self.is_second_address = True
|
self.is_second_address = True
|
||||||
self.second_address_placeholder.controls.append(self.second_address)
|
self.second_address_placeholder.controls.append(self.second_address)
|
||||||
@@ -290,15 +295,32 @@ class Cart:
|
|||||||
name = item['name']
|
name = item['name']
|
||||||
if name not in all_products:
|
if name not in all_products:
|
||||||
all_products.append(name)
|
all_products.append(name)
|
||||||
try:
|
# try:
|
||||||
self.pret_total.value = f'Pret total: {total+17}'
|
# self.pret_total.value = f'Pret total: {total+17}'
|
||||||
self.pret_total.update()
|
# self.pret_total.update()
|
||||||
except:
|
# except:
|
||||||
pass
|
# pass
|
||||||
return ft.Text(
|
return ft.Text(
|
||||||
value=' '.join(all_products)
|
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):
|
def on_go_back_button_click(self, e):
|
||||||
self.page.go("/")
|
self.page.go("/")
|
||||||
@@ -688,6 +710,8 @@ class Cart:
|
|||||||
self.payment_message.value = "Pentru a finaliza plata, apasati butonul de mai jos."
|
self.payment_message.value = "Pentru a finaliza plata, apasati butonul de mai jos."
|
||||||
self.payment_message.update()
|
self.payment_message.update()
|
||||||
self.payment_redirect_button.update()
|
self.payment_redirect_button.update()
|
||||||
|
self.order_btn.visible = False
|
||||||
|
self.order_btn.update()
|
||||||
else:
|
else:
|
||||||
self.error_message.value = "Nu am primit URL-ul de plata."
|
self.error_message.value = "Nu am primit URL-ul de plata."
|
||||||
self.error_message.update()
|
self.error_message.update()
|
||||||
@@ -722,7 +746,7 @@ class Cart:
|
|||||||
#hiostory
|
#hiostory
|
||||||
self.create_history()
|
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.color = ft.Colors.GREEN
|
||||||
self.error_message.update()
|
self.error_message.update()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user