add about us
This commit is contained in:
@@ -8,6 +8,12 @@ from pages.profile.profilepage import ProfilePage
|
||||
from pages.shopping_cart.cart import Cart
|
||||
from pages.shopping_cart.peload_card import PreloadCard
|
||||
from pages.shopping_cart.payment_redirect import PaymentRedirect
|
||||
from pages.details.about_us import AboutUS
|
||||
from pages.details.terms_and_conditions import TermsAndConditions
|
||||
from pages.details.cancel_policy import CancelPolicy
|
||||
from pages.details.confidentialty_policy import ConfidentialtyPolicy
|
||||
from pages.details.delivery_policy import DeliveryPolicys
|
||||
from pages.details.gdpr_policy import GDPR
|
||||
|
||||
import os
|
||||
os.environ["FLET_SECRET_KEY"] = os.urandom(12).hex()
|
||||
@@ -83,6 +89,42 @@ def main(page: ft.Page):
|
||||
page.update()
|
||||
return
|
||||
|
||||
if route == '/about_us':
|
||||
about_us = AboutUS(page)
|
||||
page.add(about_us.build())
|
||||
page.update()
|
||||
return
|
||||
|
||||
if route == '/termeni_si_conditii':
|
||||
termeni_si_conditii = TermsAndConditions(page)
|
||||
page.add(termeni_si_conditii.build())
|
||||
page.update()
|
||||
return
|
||||
|
||||
if route == '/politica_de_anulare_comanda':
|
||||
politica_de_anulare_comanda = CancelPolicy(page)
|
||||
page.add(politica_de_anulare_comanda.build())
|
||||
page.update()
|
||||
return
|
||||
|
||||
if route == '/politica_de_confidentialitate':
|
||||
politica_de_confidentialitate = ConfidentialtyPolicy(page)
|
||||
page.add(politica_de_confidentialitate.build())
|
||||
page.update()
|
||||
return
|
||||
|
||||
if route == '/politica_de_livrare_comanda':
|
||||
politica_de_livrare_comanda = DeliveryPolicys(page)
|
||||
page.add(politica_de_livrare_comanda.build())
|
||||
page.update()
|
||||
return
|
||||
|
||||
if route == '/gdpr':
|
||||
gdpr = GDPR(page)
|
||||
page.add(gdpr.build())
|
||||
page.update()
|
||||
return
|
||||
|
||||
# 5) Fallback 404
|
||||
page.add(ft.Text("404: Page not found"))
|
||||
page.update()
|
||||
|
||||
BIN
UI_V2/pages/details/__pycache__/about_us.cpython-313.pyc
Normal file
BIN
UI_V2/pages/details/__pycache__/about_us.cpython-313.pyc
Normal file
Binary file not shown.
BIN
UI_V2/pages/details/__pycache__/cancel_policy.cpython-313.pyc
Normal file
BIN
UI_V2/pages/details/__pycache__/cancel_policy.cpython-313.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
UI_V2/pages/details/__pycache__/delivery_policy.cpython-313.pyc
Normal file
BIN
UI_V2/pages/details/__pycache__/delivery_policy.cpython-313.pyc
Normal file
Binary file not shown.
BIN
UI_V2/pages/details/__pycache__/gdpr_policy.cpython-313.pyc
Normal file
BIN
UI_V2/pages/details/__pycache__/gdpr_policy.cpython-313.pyc
Normal file
Binary file not shown.
Binary file not shown.
54
UI_V2/pages/details/about_us.py
Normal file
54
UI_V2/pages/details/about_us.py
Normal file
@@ -0,0 +1,54 @@
|
||||
import flet as ft
|
||||
import json
|
||||
|
||||
class AboutUS:
|
||||
def __init__(self, page:ft.Page):
|
||||
self.page = page
|
||||
self.data = self.load_data()
|
||||
self.company_name = ft.Text(value=self.data['company_name'])
|
||||
self.vat = ft.Text(value=self.data['vat'])
|
||||
self.register_number = ft.Text(value=self.data['register_number'])
|
||||
self.address = ft.Text(value=self.data['address'])
|
||||
|
||||
def load_data(self):
|
||||
try:
|
||||
with open('instance/company_data.json', 'r', encoding='utf-8') as f:
|
||||
data = json.load(f)
|
||||
return data
|
||||
except FileNotFoundError:
|
||||
return {
|
||||
'company_name': '',
|
||||
'vat': '',
|
||||
'register_number': '',
|
||||
'address': ''
|
||||
}
|
||||
except json.JSONDecodeError:
|
||||
self.page.snack_bar = ft.SnackBar(ft.Text('Eroare: fișierul company_data.json este corupt.'))
|
||||
self.page.snack_bar.open = True
|
||||
self.page.update()
|
||||
return None
|
||||
except Exception as ex:
|
||||
self.page.snack_bar = ft.SnackBar(ft.Text(f'Eroare la citirea datelor companiei: {ex}'))
|
||||
self.page.snack_bar.open = True
|
||||
self.page.update()
|
||||
return None
|
||||
|
||||
def build(self):
|
||||
return ft.Container(
|
||||
content=ft.Row(
|
||||
[
|
||||
ft.Image(src="images/tainagustului.png", width=150),
|
||||
ft.Column(
|
||||
[
|
||||
ft.Text("Despre noi", size=18, weight=ft.FontWeight.BOLD),
|
||||
self.company_name,
|
||||
self.vat,
|
||||
self.register_number,
|
||||
self.address
|
||||
]
|
||||
)
|
||||
],
|
||||
alignment=ft.MainAxisAlignment.CENTER,
|
||||
vertical_alignment=ft.CrossAxisAlignment.CENTER
|
||||
)
|
||||
)
|
||||
40
UI_V2/pages/details/cancel_policy.py
Normal file
40
UI_V2/pages/details/cancel_policy.py
Normal file
@@ -0,0 +1,40 @@
|
||||
import flet as ft
|
||||
import json
|
||||
|
||||
class CancelPolicy:
|
||||
def __init__(self, page: ft.Page):
|
||||
self.page = page
|
||||
|
||||
def load_data(self):
|
||||
try:
|
||||
with open('instance/policies.json', 'r', encoding='utf-8') as f:
|
||||
data = json.load(f)
|
||||
return data
|
||||
except FileNotFoundError:
|
||||
return {
|
||||
'confidentialty_policy': '',
|
||||
'delivery_policy': '',
|
||||
'cancel_policy': '',
|
||||
'gdpr': '',
|
||||
'terms_and_conditions': ''
|
||||
}
|
||||
except json.JSONDecodeError:
|
||||
self.page.snack_bar = ft.SnackBar(ft.Text('Eroare: fișierul policies.json este corupt.'))
|
||||
self.page.snack_bar.open = True
|
||||
self.page.update()
|
||||
return None
|
||||
except Exception as ex:
|
||||
self.page.snack_bar = ft.SnackBar(ft.Text(f'Eroare la citirea politicilor: {ex}'))
|
||||
self.page.snack_bar.open = True
|
||||
self.page.update()
|
||||
return None
|
||||
|
||||
def build(self):
|
||||
return ft.Container(
|
||||
content=ft.Column(
|
||||
[
|
||||
ft.Text("Politica de anulare comandă",size = 18, weight=ft.FontWeight.BOLD),
|
||||
ft.Text(value=self.load_data()['cancel_policy'])
|
||||
]
|
||||
)
|
||||
)
|
||||
40
UI_V2/pages/details/confidentialty_policy.py
Normal file
40
UI_V2/pages/details/confidentialty_policy.py
Normal file
@@ -0,0 +1,40 @@
|
||||
import flet as ft
|
||||
import json
|
||||
|
||||
class ConfidentialtyPolicy:
|
||||
def __init__(self, page: ft.Page):
|
||||
self.page = page
|
||||
|
||||
def load_data(self):
|
||||
try:
|
||||
with open('instance/policies.json', 'r', encoding='utf-8') as f:
|
||||
data = json.load(f)
|
||||
return data
|
||||
except FileNotFoundError:
|
||||
return {
|
||||
'confidentialty_policy': '',
|
||||
'delivery_policy': '',
|
||||
'cancel_policy': '',
|
||||
'gdpr': '',
|
||||
'terms_and_conditions': ''
|
||||
}
|
||||
except json.JSONDecodeError:
|
||||
self.page.snack_bar = ft.SnackBar(ft.Text('Eroare: fișierul policies.json este corupt.'))
|
||||
self.page.snack_bar.open = True
|
||||
self.page.update()
|
||||
return None
|
||||
except Exception as ex:
|
||||
self.page.snack_bar = ft.SnackBar(ft.Text(f'Eroare la citirea politicilor: {ex}'))
|
||||
self.page.snack_bar.open = True
|
||||
self.page.update()
|
||||
return None
|
||||
|
||||
def build(self):
|
||||
return ft.Container(
|
||||
content=ft.Column(
|
||||
[
|
||||
ft.Text("Termeni si conditii",size = 18, weight=ft.FontWeight.BOLD),
|
||||
ft.Text(value=self.load_data()['confidentialty_policy'])
|
||||
]
|
||||
)
|
||||
)
|
||||
40
UI_V2/pages/details/delivery_policy.py
Normal file
40
UI_V2/pages/details/delivery_policy.py
Normal file
@@ -0,0 +1,40 @@
|
||||
import flet as ft
|
||||
import json
|
||||
|
||||
class DeliveryPolicys:
|
||||
def __init__(self, page: ft.Page):
|
||||
self.page = page
|
||||
|
||||
def load_data(self):
|
||||
try:
|
||||
with open('instance/policies.json', 'r', encoding='utf-8') as f:
|
||||
data = json.load(f)
|
||||
return data
|
||||
except FileNotFoundError:
|
||||
return {
|
||||
'confidentialty_policy': '',
|
||||
'delivery_policy': '',
|
||||
'cancel_policy': '',
|
||||
'gdpr': '',
|
||||
'terms_and_conditions': ''
|
||||
}
|
||||
except json.JSONDecodeError:
|
||||
self.page.snack_bar = ft.SnackBar(ft.Text('Eroare: fișierul policies.json este corupt.'))
|
||||
self.page.snack_bar.open = True
|
||||
self.page.update()
|
||||
return None
|
||||
except Exception as ex:
|
||||
self.page.snack_bar = ft.SnackBar(ft.Text(f'Eroare la citirea politicilor: {ex}'))
|
||||
self.page.snack_bar.open = True
|
||||
self.page.update()
|
||||
return None
|
||||
|
||||
def build(self):
|
||||
return ft.Container(
|
||||
content=ft.Column(
|
||||
[
|
||||
ft.Text("Politica de livrare comandă",size = 18, weight=ft.FontWeight.BOLD),
|
||||
ft.Text(value=self.load_data()['delivery_policy'])
|
||||
]
|
||||
)
|
||||
)
|
||||
40
UI_V2/pages/details/gdpr_policy.py
Normal file
40
UI_V2/pages/details/gdpr_policy.py
Normal file
@@ -0,0 +1,40 @@
|
||||
import flet as ft
|
||||
import json
|
||||
|
||||
class GDPR:
|
||||
def __init__(self, page: ft.Page):
|
||||
self.page = page
|
||||
|
||||
def load_data(self):
|
||||
try:
|
||||
with open('instance/policies.json', 'r', encoding='utf-8') as f:
|
||||
data = json.load(f)
|
||||
return data
|
||||
except FileNotFoundError:
|
||||
return {
|
||||
'confidentialty_policy': '',
|
||||
'delivery_policy': '',
|
||||
'cancel_policy': '',
|
||||
'gdpr': '',
|
||||
'terms_and_conditions': ''
|
||||
}
|
||||
except json.JSONDecodeError:
|
||||
self.page.snack_bar = ft.SnackBar(ft.Text('Eroare: fișierul policies.json este corupt.'))
|
||||
self.page.snack_bar.open = True
|
||||
self.page.update()
|
||||
return None
|
||||
except Exception as ex:
|
||||
self.page.snack_bar = ft.SnackBar(ft.Text(f'Eroare la citirea politicilor: {ex}'))
|
||||
self.page.snack_bar.open = True
|
||||
self.page.update()
|
||||
return None
|
||||
|
||||
def build(self):
|
||||
return ft.Container(
|
||||
content=ft.Column(
|
||||
[
|
||||
ft.Text("Politica GDPR (siguranța datelor cu caracter personal)",size = 18, weight=ft.FontWeight.BOLD),
|
||||
ft.Text(value=self.load_data()['gdpr'])
|
||||
]
|
||||
)
|
||||
)
|
||||
40
UI_V2/pages/details/terms_and_conditions.py
Normal file
40
UI_V2/pages/details/terms_and_conditions.py
Normal file
@@ -0,0 +1,40 @@
|
||||
import flet as ft
|
||||
import json
|
||||
|
||||
class TermsAndConditions:
|
||||
def __init__(self, page: ft.Page):
|
||||
self.page = page
|
||||
|
||||
def load_data(self):
|
||||
try:
|
||||
with open('instance/policies.json', 'r', encoding='utf-8') as f:
|
||||
data = json.load(f)
|
||||
return data
|
||||
except FileNotFoundError:
|
||||
return {
|
||||
'confidentialty_policy': '',
|
||||
'delivery_policy': '',
|
||||
'cancel_policy': '',
|
||||
'gdpr': '',
|
||||
'terms_and_conditions': ''
|
||||
}
|
||||
except json.JSONDecodeError:
|
||||
self.page.snack_bar = ft.SnackBar(ft.Text('Eroare: fișierul policies.json este corupt.'))
|
||||
self.page.snack_bar.open = True
|
||||
self.page.update()
|
||||
return None
|
||||
except Exception as ex:
|
||||
self.page.snack_bar = ft.SnackBar(ft.Text(f'Eroare la citirea politicilor: {ex}'))
|
||||
self.page.snack_bar.open = True
|
||||
self.page.update()
|
||||
return None
|
||||
|
||||
def build(self):
|
||||
return ft.Container(
|
||||
content=ft.Column(
|
||||
[
|
||||
ft.Text("Termeni si conditii",size = 18, weight=ft.FontWeight.BOLD),
|
||||
ft.Text(value=self.load_data()['terms_and_conditions'])
|
||||
]
|
||||
)
|
||||
)
|
||||
@@ -168,6 +168,24 @@ class Home:
|
||||
self.searchbar.value = ''
|
||||
self.searchbar.update()
|
||||
|
||||
def on_about_us_btn_click(self, e):
|
||||
self.page.go('/about_us')
|
||||
|
||||
def on_terms_and_cond_btn_click(self, e):
|
||||
self.page.go("/termeni_si_conditii")
|
||||
|
||||
def on_cancel_policy_btn_click(self, e):
|
||||
self.page.go("/politica_de_anulare_comanda")
|
||||
|
||||
def on_confidentiality_policy_btn_click(self, e):
|
||||
self.page.go('/politica_de_confidentialitate')
|
||||
|
||||
def on_delivery_policy_btn_click(self, e):
|
||||
self.page.go("/politica_de_livrare_comanda")
|
||||
|
||||
def on_gdpr_btn_click(self, e):
|
||||
self.page.go("/gdpr")
|
||||
|
||||
def build(self):
|
||||
return ft.Container(
|
||||
content=ft.Column(
|
||||
@@ -204,10 +222,33 @@ class Home:
|
||||
alignment=ft.MainAxisAlignment.CENTER,
|
||||
width=1000
|
||||
),
|
||||
self.products_group
|
||||
self.products_group,
|
||||
ft.Divider(height=1),
|
||||
ft.Row(
|
||||
[
|
||||
ft.Column(
|
||||
[
|
||||
ft.TextButton("Despre noi", on_click=self.on_about_us_btn_click, icon=ft.Icons.INFO),
|
||||
ft.TextButton("Termeni si conditii", on_click=self.on_terms_and_cond_btn_click, icon=ft.Icons.INFO),
|
||||
ft.TextButton("Politica de anulare comanda",on_click=self.on_cancel_policy_btn_click, icon=ft.Icons.INFO),
|
||||
ft.TextButton("Politica de confidentialitate",on_click=self.on_confidentiality_policy_btn_click, icon=ft.Icons.INFO),
|
||||
ft.TextButton("Politica de livrare comanda",on_click=self.on_delivery_policy_btn_click, icon=ft.Icons.INFO),
|
||||
ft.TextButton("Politica GDPR (siguranța datelor cu caracter personal)",on_click=self.on_gdpr_btn_click, icon=ft.Icons.INFO)
|
||||
]
|
||||
),
|
||||
ft.Column(
|
||||
[
|
||||
ft.TextButton("TainaGustului", icon=ft.Icons.FACEBOOK)
|
||||
]
|
||||
)
|
||||
],
|
||||
alignment=ft.MainAxisAlignment.SPACE_AROUND,
|
||||
vertical_alignment=ft.CrossAxisAlignment.START
|
||||
)
|
||||
],
|
||||
horizontal_alignment=ft.CrossAxisAlignment.CENTER,
|
||||
expand=True
|
||||
expand=True,
|
||||
width=1000
|
||||
)
|
||||
],
|
||||
scroll=ft.ScrollMode.ADAPTIVE,
|
||||
|
||||
Reference in New Issue
Block a user