mirror of
https://github.com/koloideal/DutyLog.git
synced 2026-06-10 10:25:29 +03:00
update
This commit is contained in:
@@ -5,7 +5,7 @@ from aiogram_dialog.widgets.kbd import SwitchTo, Button, Select, ScrollingGroup,
|
||||
from dishka import FromDishka
|
||||
from dishka.integrations.aiogram_dialog import inject
|
||||
|
||||
from dutylog.application.bot.user_dialogs.states import CreatorMenuSG, AdminMenuSG
|
||||
from dutylog.application.bot.user_dialogs.states import AdminMenuSG
|
||||
from dutylog.infrastructure.database.repositories.users_repository import UsersRepository
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ async def on_admin_selected(
|
||||
item_id: str,
|
||||
) -> None:
|
||||
dialog_manager.dialog_data["selected_admin_id"] = int(item_id)
|
||||
await dialog_manager.switch_to(CreatorMenuSG.admin_info)
|
||||
await dialog_manager.switch_to(AdminMenuSG.admin_info)
|
||||
|
||||
|
||||
async def on_add_admin_click(
|
||||
@@ -60,7 +60,7 @@ async def on_add_admin_click(
|
||||
button: Button,
|
||||
dialog_manager: DialogManager,
|
||||
) -> None:
|
||||
await dialog_manager.switch_to(CreatorMenuSG.add_admin_select_user)
|
||||
await dialog_manager.switch_to(AdminMenuSG.add_admin_select_user)
|
||||
|
||||
|
||||
@inject
|
||||
@@ -101,7 +101,7 @@ async def on_remove_admin_click(
|
||||
button: Button,
|
||||
dialog_manager: DialogManager,
|
||||
) -> None:
|
||||
await dialog_manager.switch_to(CreatorMenuSG.remove_admin_confirm)
|
||||
await dialog_manager.switch_to(AdminMenuSG.remove_admin_confirm)
|
||||
|
||||
|
||||
@inject
|
||||
@@ -148,7 +148,7 @@ async def on_remove_admin_confirm(
|
||||
await users_repository.update_user(int(admin_id), is_admin=False)
|
||||
|
||||
await callback.answer("✅ Администратор удалён!")
|
||||
await dialog_manager.switch_to(CreatorMenuSG.admins_list)
|
||||
await dialog_manager.switch_to(AdminMenuSG.admins_list)
|
||||
|
||||
|
||||
async def on_remove_admin_cancel(
|
||||
@@ -156,7 +156,7 @@ async def on_remove_admin_cancel(
|
||||
button: Button,
|
||||
dialog_manager: DialogManager,
|
||||
) -> None:
|
||||
await dialog_manager.switch_to(CreatorMenuSG.admin_info)
|
||||
await dialog_manager.switch_to(AdminMenuSG.admin_info)
|
||||
|
||||
|
||||
@inject
|
||||
@@ -204,7 +204,7 @@ async def on_user_selected(
|
||||
item_id: str,
|
||||
) -> None:
|
||||
dialog_manager.dialog_data["selected_user_id"] = int(item_id)
|
||||
await dialog_manager.switch_to(CreatorMenuSG.add_admin_confirm)
|
||||
await dialog_manager.switch_to(AdminMenuSG.add_admin_confirm)
|
||||
|
||||
|
||||
@inject
|
||||
@@ -251,7 +251,7 @@ async def on_add_admin_confirm(
|
||||
await users_repository.update_user(int(user_id), is_admin=True)
|
||||
|
||||
await callback.answer("✅ Администратор добавлен!")
|
||||
await dialog_manager.switch_to(CreatorMenuSG.admins_list)
|
||||
await dialog_manager.switch_to(AdminMenuSG.admins_list)
|
||||
|
||||
|
||||
async def on_add_admin_cancel(
|
||||
@@ -259,7 +259,7 @@ async def on_add_admin_cancel(
|
||||
button: Button,
|
||||
dialog_manager: DialogManager,
|
||||
) -> None:
|
||||
await dialog_manager.switch_to(CreatorMenuSG.add_admin_select_user)
|
||||
await dialog_manager.switch_to(AdminMenuSG.add_admin_select_user)
|
||||
|
||||
|
||||
async def on_back_to_main(
|
||||
@@ -267,7 +267,7 @@ async def on_back_to_main(
|
||||
button: Button,
|
||||
dialog_manager: DialogManager,
|
||||
) -> None:
|
||||
await dialog_manager.done()
|
||||
await dialog_manager.switch_to(AdminMenuSG.main)
|
||||
|
||||
|
||||
admins_list_window = Window(
|
||||
@@ -289,32 +289,12 @@ admins_list_window = Window(
|
||||
id="add_admin_btn",
|
||||
on_click=on_add_admin_click,
|
||||
),
|
||||
Button(
|
||||
Const("──────────"),
|
||||
id="separator_btn",
|
||||
on_click=lambda c, b, m: None,
|
||||
),
|
||||
SwitchTo(
|
||||
Const("👨💼 Админы"),
|
||||
id="admins_btn",
|
||||
state=CreatorMenuSG.admins_list,
|
||||
),
|
||||
SwitchTo(
|
||||
Const("📜 История"),
|
||||
id="history_btn",
|
||||
state=CreatorMenuSG.transactions_history,
|
||||
),
|
||||
SwitchTo(
|
||||
Const("🏆 Топ"),
|
||||
id="top_btn",
|
||||
state=CreatorMenuSG.top_residents,
|
||||
),
|
||||
Button(
|
||||
Const("◀️ Назад"),
|
||||
id="back_to_main_from_admins",
|
||||
on_click=on_back_to_main,
|
||||
),
|
||||
state=CreatorMenuSG.admins_list,
|
||||
state=AdminMenuSG.admins_list,
|
||||
getter=get_admins_list_data,
|
||||
)
|
||||
|
||||
@@ -328,9 +308,9 @@ admin_info_window = Window(
|
||||
SwitchTo(
|
||||
Const("◀️ Назад"),
|
||||
id="back_to_admins_list",
|
||||
state=CreatorMenuSG.admins_list,
|
||||
state=AdminMenuSG.admins_list,
|
||||
),
|
||||
state=CreatorMenuSG.admin_info,
|
||||
state=AdminMenuSG.admin_info,
|
||||
getter=get_admin_info_data,
|
||||
)
|
||||
|
||||
@@ -348,7 +328,7 @@ remove_admin_confirm_window = Window(
|
||||
on_click=on_remove_admin_cancel,
|
||||
),
|
||||
),
|
||||
state=CreatorMenuSG.remove_admin_confirm,
|
||||
state=AdminMenuSG.remove_admin_confirm,
|
||||
getter=get_remove_admin_confirm_data,
|
||||
)
|
||||
|
||||
@@ -369,9 +349,9 @@ add_admin_select_user_window = Window(
|
||||
SwitchTo(
|
||||
Const("◀️ Назад"),
|
||||
id="back_to_admins_from_add",
|
||||
state=CreatorMenuSG.admins_list,
|
||||
state=AdminMenuSG.admins_list,
|
||||
),
|
||||
state=CreatorMenuSG.add_admin_select_user,
|
||||
state=AdminMenuSG.add_admin_select_user,
|
||||
getter=get_add_admin_select_user_data,
|
||||
)
|
||||
|
||||
@@ -389,6 +369,6 @@ add_admin_confirm_window = Window(
|
||||
on_click=on_add_admin_cancel,
|
||||
),
|
||||
),
|
||||
state=CreatorMenuSG.add_admin_confirm,
|
||||
state=AdminMenuSG.add_admin_confirm,
|
||||
getter=get_add_admin_confirm_data,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user