add about us
This commit is contained in:
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'])
|
||||
]
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user