mirror of
https://github.com/koloideal/DutyLog.git
synced 2026-06-10 10:25:29 +03:00
update
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
from dutylog.application.bot.admin_dialogs.admin_menu_dialog import (
|
||||
admin_menu_dialog,
|
||||
)
|
||||
|
||||
__all__ = ["admin_menu_dialog"]
|
||||
+8
-8
@@ -1,10 +1,10 @@
|
||||
from aiogram_dialog import Dialog
|
||||
|
||||
from dutylog.application.bot.user_dialogs.admin_dialogs.main_menu import (
|
||||
from dutylog.application.bot.admin_dialogs.main_menu import (
|
||||
main_menu_window,
|
||||
statistics_window,
|
||||
)
|
||||
from dutylog.application.bot.user_dialogs.admin_dialogs.residents_management import (
|
||||
from dutylog.application.bot.admin_dialogs.residents_management import (
|
||||
residents_list_window,
|
||||
resident_info_window,
|
||||
resident_logout_confirm_window,
|
||||
@@ -16,18 +16,18 @@ from dutylog.application.bot.user_dialogs.admin_dialogs.residents_management imp
|
||||
search_input_window,
|
||||
search_results_window,
|
||||
)
|
||||
from dutylog.application.bot.user_dialogs.admin_dialogs.residents_filter import (
|
||||
from dutylog.application.bot.admin_dialogs.residents_filter import (
|
||||
filter_select_window,
|
||||
filter_hours_input_window,
|
||||
filtered_results_window,
|
||||
)
|
||||
from dutylog.application.bot.user_dialogs.admin_dialogs.floors_management import (
|
||||
from dutylog.application.bot.admin_dialogs.floors_management import (
|
||||
floors_list_window,
|
||||
floor_delete_confirm_window,
|
||||
create_floor_input_window,
|
||||
create_floor_confirm_window,
|
||||
)
|
||||
from dutylog.application.bot.user_dialogs.admin_dialogs.rooms_management import (
|
||||
from dutylog.application.bot.admin_dialogs.rooms_management import (
|
||||
rooms_select_floor_window,
|
||||
rooms_list_window,
|
||||
room_delete_confirm_window,
|
||||
@@ -35,13 +35,13 @@ from dutylog.application.bot.user_dialogs.admin_dialogs.rooms_management import
|
||||
create_room_input_window,
|
||||
create_room_confirm_window,
|
||||
)
|
||||
from dutylog.application.bot.user_dialogs.admin_dialogs.reporting_period_management import (
|
||||
from dutylog.application.bot.admin_dialogs.reporting_period_management import (
|
||||
reporting_period_window,
|
||||
next_period_confirm_window,
|
||||
generate_report_select_period_window,
|
||||
generate_report_confirm_window,
|
||||
)
|
||||
from dutylog.application.bot.user_dialogs.admin_dialogs.hours_management import (
|
||||
from dutylog.application.bot.admin_dialogs.hours_management import (
|
||||
add_hours_select_window,
|
||||
remove_hours_select_window,
|
||||
add_hours_custom_window,
|
||||
@@ -51,7 +51,7 @@ from dutylog.application.bot.user_dialogs.admin_dialogs.hours_management import
|
||||
add_hours_confirm_window,
|
||||
remove_hours_confirm_window,
|
||||
)
|
||||
from dutylog.application.bot.user_dialogs.admin_dialogs.broadcast import (
|
||||
from dutylog.application.bot.admin_dialogs.broadcast import (
|
||||
broadcast_window,
|
||||
broadcast_confirm_window,
|
||||
)
|
||||
+13
-14
@@ -35,7 +35,7 @@ async def on_reporting_period_click(
|
||||
callback: CallbackQuery,
|
||||
button: Button,
|
||||
dialog_manager: DialogManager,
|
||||
):
|
||||
) -> None:
|
||||
await dialog_manager.switch_to(AdminMenuSG.reporting_period)
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ async def on_reporting_period_click(
|
||||
async def get_reporting_period_data(
|
||||
reporting_periods_repository: FromDishka[ReportingPeriodsRepository],
|
||||
**kwargs,
|
||||
):
|
||||
) -> dict[str, bool | str]:
|
||||
active_period = await reporting_periods_repository.get_active_period()
|
||||
|
||||
if active_period:
|
||||
@@ -90,7 +90,7 @@ async def on_next_period_click(
|
||||
callback: CallbackQuery,
|
||||
button: Button,
|
||||
dialog_manager: DialogManager,
|
||||
):
|
||||
) -> None:
|
||||
await dialog_manager.switch_to(AdminMenuSG.next_period_confirm)
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ async def on_make_report_click(
|
||||
callback: CallbackQuery,
|
||||
button: Button,
|
||||
dialog_manager: DialogManager,
|
||||
):
|
||||
) -> None:
|
||||
await dialog_manager.switch_to(AdminMenuSG.generate_report_select_period)
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ async def on_make_report_click(
|
||||
async def get_next_period_confirm_data(
|
||||
reporting_periods_repository: FromDishka[ReportingPeriodsRepository],
|
||||
**kwargs,
|
||||
):
|
||||
) -> dict[str, str]:
|
||||
active_period = await reporting_periods_repository.get_active_period()
|
||||
|
||||
if active_period:
|
||||
@@ -144,7 +144,7 @@ async def on_next_period_confirm(
|
||||
button: Button,
|
||||
dialog_manager: DialogManager,
|
||||
reporting_periods_repository: FromDishka[ReportingPeriodsRepository],
|
||||
):
|
||||
) -> None:
|
||||
active_period = await reporting_periods_repository.get_active_period()
|
||||
current_date = datetime.now().date()
|
||||
|
||||
@@ -161,7 +161,7 @@ async def on_next_period_cancel(
|
||||
callback: CallbackQuery,
|
||||
button: Button,
|
||||
dialog_manager: DialogManager,
|
||||
):
|
||||
) -> None:
|
||||
await dialog_manager.switch_to(AdminMenuSG.reporting_period)
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ next_period_confirm_window = Window(
|
||||
async def get_generate_report_data(
|
||||
reporting_periods_repository: FromDishka[ReportingPeriodsRepository],
|
||||
**kwargs,
|
||||
):
|
||||
) -> dict[str, bool | str | list[tuple[str, int]]]:
|
||||
all_periods = await reporting_periods_repository.get_all()
|
||||
completed_periods = [p for p in all_periods if p.end_date is not None]
|
||||
active_period = await reporting_periods_repository.get_active_period()
|
||||
@@ -268,7 +268,7 @@ async def on_period_selected(
|
||||
widget,
|
||||
dialog_manager: DialogManager,
|
||||
item_id: str,
|
||||
):
|
||||
) -> None:
|
||||
dialog_manager.dialog_data["selected_period_id"] = int(item_id)
|
||||
await dialog_manager.switch_to(AdminMenuSG.generate_report_confirm)
|
||||
|
||||
@@ -278,7 +278,7 @@ async def get_generate_report_confirm_data(
|
||||
reporting_periods_repository: FromDishka[ReportingPeriodsRepository],
|
||||
dialog_manager: DialogManager,
|
||||
**kwargs,
|
||||
):
|
||||
) -> dict[str, str]:
|
||||
period_id = dialog_manager.dialog_data.get("selected_period_id")
|
||||
if not period_id:
|
||||
return {"content": "⚠️ Период не выбран"}
|
||||
@@ -321,7 +321,7 @@ async def on_generate_report_confirm(
|
||||
dialog_manager: DialogManager,
|
||||
reporting_periods_repository: FromDishka[ReportingPeriodsRepository],
|
||||
report_service: FromDishka[ReportService],
|
||||
):
|
||||
) -> None:
|
||||
period_id = dialog_manager.dialog_data.get("selected_period_id")
|
||||
if not period_id:
|
||||
await callback.answer("⚠️ Период не выбран", show_alert=True)
|
||||
@@ -335,8 +335,7 @@ async def on_generate_report_confirm(
|
||||
|
||||
await callback.answer("⏳ Генерирую отчёт...")
|
||||
|
||||
end_date = period.end_date if period.end_date else msk_now()
|
||||
print(end_date)
|
||||
end_date = period.end_date if period.end_date else msk_now().date()
|
||||
|
||||
report_file = await report_service.generate_period_report(
|
||||
period.start_date, end_date
|
||||
@@ -362,7 +361,7 @@ async def on_generate_report_cancel(
|
||||
callback: CallbackQuery,
|
||||
button: Button,
|
||||
dialog_manager: DialogManager,
|
||||
):
|
||||
) -> None:
|
||||
await dialog_manager.switch_to(AdminMenuSG.generate_report_select_period)
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
from dutylog.application.bot.user_dialogs.admin_dialogs.admin_menu_dialog import (
|
||||
admin_menu_dialog,
|
||||
)
|
||||
|
||||
__all__ = ["admin_menu_dialog"]
|
||||
Reference in New Issue
Block a user