from aiogram_dialog import Dialog, Window from aiogram_dialog.widgets.input import TextInput from aiogram_dialog.widgets.kbd import Back, Button, Calendar, Cancel from aiogram_dialog.widgets.text import Const, Jinja from app.bot.dialogs.templates import event_template from .getters import event_data_getter from .handlers import ( confirm_creation, input_description, input_end_date, input_start_date, input_title, ) from .states import NewEventSG new_event_dialog = Dialog( Window( Const("Введите название:"), TextInput(id="title", on_success=input_title), Cancel(Const("❌ Отмена")), state=NewEventSG.input_title, ), Window( Const("Введите описание:"), TextInput(id="description", on_success=input_description), Back(Const("◀️ Назад")), state=NewEventSG.input_description, ), Window( Const("Выберите дату начала:"), Calendar(id="start_date", on_click=input_start_date), Back(Const("◀️ Назад")), state=NewEventSG.input_start_date, ), Window( Const("Выберите дату окончания:"), Calendar(id="end_date", on_click=input_end_date), Back(Const("◀️ Назад")), state=NewEventSG.input_end_date, ), Window( Jinja(event_template), Back(Const("◀️ Назад")), Cancel(Const("❌ Отмена")), Button(Const("✅ Создать"), id="cancel", on_click=confirm_creation), state=NewEventSG.confirm_creation, getter=event_data_getter, parse_mode="HTML", ), )