table_class
This commit is contained in:
@@ -2,7 +2,7 @@ import flet as ft
|
||||
from src.base_models.text_fuild import TextField
|
||||
from src.base_models.colour import color
|
||||
from src.base_models.button import Button
|
||||
from src.storage.user_data import user_login
|
||||
from src.storage.user_data import user_data
|
||||
import requests
|
||||
from requests.exceptions import RequestException
|
||||
|
||||
@@ -35,15 +35,16 @@ class LoginPage(ft.View):
|
||||
def button_login(self,e):
|
||||
|
||||
login_return = self.login_user(login=self.login.value,password=self.password.value)
|
||||
if login_return["id"] == 0:
|
||||
print(f"{login_return.get("id")=}")
|
||||
if login_return.get('id') == 0 or login_return.get('id') == None:
|
||||
self.page.open(ft.SnackBar(ft.Text(f"Неверный логин или пароль")))
|
||||
self.page.update
|
||||
else:
|
||||
user_login.load_user(
|
||||
id=login_return["id"],
|
||||
name_poo=login_return["name_poo"],
|
||||
inn=login_return["inn"],
|
||||
mail=login_return["mail"]
|
||||
user_data.load_data(
|
||||
id=login_return.get('id'),
|
||||
name_poo=login_return.get('name_poo'),
|
||||
inn=login_return.get('inn'),
|
||||
mail=login_return.get('mail')
|
||||
)
|
||||
self.page.go("/main")
|
||||
|
||||
|
||||
@@ -7,17 +7,71 @@ from requests.exceptions import RequestException
|
||||
|
||||
class MainPage(ft.View):
|
||||
|
||||
|
||||
|
||||
def __init__(self,page:ft.Page,route:str,bgcolor:str):
|
||||
self.page = page
|
||||
|
||||
table=ft.DataTable(
|
||||
|
||||
)
|
||||
|
||||
dd = ft.Dropdown(
|
||||
label="таблица",
|
||||
options=[
|
||||
ft.DropdownOption(text="Сollection_form_opk")
|
||||
]
|
||||
)
|
||||
|
||||
rail = ft.NavigationRail(
|
||||
selected_index=0,
|
||||
label_type=ft.NavigationRailLabelType.ALL,
|
||||
#extended=True,
|
||||
height=1000,
|
||||
min_width=100,
|
||||
min_extended_width=200,
|
||||
bgcolor=color[3],
|
||||
group_alignment=-0.4,
|
||||
destinations=[
|
||||
ft.NavigationRailDestination(
|
||||
icon=ft.Icons.HOME_OUTLINED,
|
||||
selected_icon=ft.Icons.HOME_SHARP,
|
||||
label="Home"
|
||||
),
|
||||
ft.NavigationRailDestination(
|
||||
icon=ft.Icon(ft.Icons.BOOKMARK_BORDER),
|
||||
selected_icon=ft.Icon(ft.Icons.BOOKMARK),
|
||||
label="Second",
|
||||
),
|
||||
ft.NavigationRailDestination(
|
||||
icon=ft.Icons.SETTINGS_OUTLINED,
|
||||
selected_icon=ft.Icon(ft.Icons.SETTINGS),
|
||||
label="Second",
|
||||
),
|
||||
|
||||
],
|
||||
|
||||
on_change=lambda e: print("Selected destination:", e.control.selected_index),
|
||||
)
|
||||
super().__init__(
|
||||
route=route,
|
||||
bgcolor=bgcolor,
|
||||
|
||||
vertical_alignment=ft.MainAxisAlignment.CENTER,
|
||||
horizontal_alignment=ft.CrossAxisAlignment.CENTER,
|
||||
controls=[
|
||||
|
||||
ft.Row(
|
||||
expand=True,
|
||||
controls=[
|
||||
rail,
|
||||
ft.VerticalDivider(width=1),
|
||||
ft.Column(
|
||||
alignment=ft.MainAxisAlignment.START,
|
||||
expand=True,
|
||||
controls=[
|
||||
ft.Text("Добро пожаловать!"),
|
||||
dd
|
||||
],
|
||||
),
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user