From 8d95ad393147fa6452bc3afa2604313302a6f920 Mon Sep 17 00:00:00 2001 From: grigorij Date: Sat, 13 Jun 2026 20:01:26 +0400 Subject: [PATCH] =?UTF-8?q?-=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B2=D1=8B=D0=B1=D0=BE=D1=80=20=D0=BC=D0=B0=D1=81=D1=82=D0=B5?= =?UTF-8?q?=D1=80=D0=B0;=20-=D1=80=D0=B0=D1=81=D1=88=D0=B8=D1=80=D0=B8?= =?UTF-8?q?=D0=BB=20FSM=20=D0=BD=D0=BE=D0=B2=D1=8B=D0=BC=20=D1=81=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D0=BE=D1=8F=D0=BD=D0=B8=D0=B5=D0=BC=20master;=20-?= =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D1=83=D1=8E=20=D0=BA=D0=BB=D0=B0=D0=B2=D0=B8=D0=B0=D1=82=D1=83?= =?UTF-8?q?=D1=80=D1=83=20masters.py;=20-=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=81=D1=86=D0=B5=D0=BD=D0=B0=D1=80=D0=B8=D0=B9?= =?UTF-8?q?=20=D0=B7=D0=B0=D0=BF=D0=B8=D1=81=D0=B8;=20-=D0=B4=D0=BE=D1=80?= =?UTF-8?q?=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D0=BB=20=D0=BE=D0=BA=D0=BD=D0=BE?= =?UTF-8?q?=20=D0=BF=D0=BE=D0=B4=D1=82=D0=B2=D0=B5=D1=80=D0=B6=D0=B4=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=B7=D0=B0=D0=BF=D0=B8=D1=81=D0=B8;=20-?= =?UTF-8?q?=D1=80=D0=B0=D1=81=D1=88=D0=B8=D1=80=D0=B8=D0=BB=20=D1=81=D1=82?= =?UTF-8?q?=D1=80=D1=83=D0=BA=D1=82=D1=83=D1=80=D1=83=20=D1=85=D1=80=D0=B0?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B1=D1=80=D0=BE=D0=BD=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/handlers/booking.py | 37 ++++++++++++++++++++++++++++++++- app/keyboards/masters.py | 28 +++++++++++++++++++++++++ app/services/booking_service.py | 2 ++ app/states/booking.py | 1 + 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 app/keyboards/masters.py diff --git a/app/handlers/booking.py b/app/handlers/booking.py index cc08d39..eae1d1f 100644 --- a/app/handlers/booking.py +++ b/app/handlers/booking.py @@ -5,7 +5,7 @@ from aiogram.fsm.context import FSMContext from aiogram.filters import StateFilter from aiogram.types import Message, CallbackQuery from app.keyboards.services import get_services_keyboard - +from app.keyboards.masters import get_masters_keyboard from app.states.booking import BookingState from app.services.booking_service import create_booking from app.keyboards.menu import menu, cancel_menu @@ -59,9 +59,42 @@ async def choose_service( service=service_name ) + await state.set_state( + BookingState.master + ) + await callback.message.edit_text( + "👤 Выберите специалиста:", + reply_markup=get_masters_keyboard() + ) + + await callback.answer() + +#выбор мастера +@router.callback_query( + StateFilter(BookingState.master), + F.data.startswith("master_") +) +async def choose_master( + callback: CallbackQuery, + state: FSMContext +): + + masters = { + "master_anna": "Анна", + "master_maria": "Мария", + "master_alex": "Алексей" + } + + master_name = masters[callback.data] + + await state.update_data( + master=master_name + ) + await state.set_state( BookingState.date ) + await callback.message.edit_text( "📅 Выберите дату:", reply_markup=get_dates_keyboard() @@ -127,6 +160,7 @@ async def choose_time( f"📋 Проверьте запись:\n\n" f"💆 Услуга: {data['service']}\n" f"📅 Дата: {data['date']}\n" + f"👤 Мастер:{data['master']}\n" f"🕒 Время: {selected_time}", reply_markup=get_confirm_booking_keyboard() ) @@ -149,6 +183,7 @@ async def confirm_booking_callback( user_id=callback.from_user.id, service=data["service"], date=data["date"], + master=data["master"], time=data["time"] ) diff --git a/app/keyboards/masters.py b/app/keyboards/masters.py new file mode 100644 index 0000000..94272f2 --- /dev/null +++ b/app/keyboards/masters.py @@ -0,0 +1,28 @@ +from aiogram.types import InlineKeyboardMarkup +from aiogram.types import InlineKeyboardButton + + +def get_masters_keyboard(): + + return InlineKeyboardMarkup( + inline_keyboard=[ + [ + InlineKeyboardButton( + text="👩 Анна", + callback_data="master_anna" + ) + ], + [ + InlineKeyboardButton( + text="👩 Мария", + callback_data="master_maria" + ) + ], + [ + InlineKeyboardButton( + text="👨 Алексей", + callback_data="master_alex" + ) + ] + ] + ) \ No newline at end of file diff --git a/app/services/booking_service.py b/app/services/booking_service.py index 938ace9..6dbee9a 100644 --- a/app/services/booking_service.py +++ b/app/services/booking_service.py @@ -5,12 +5,14 @@ def create_booking( user_id: int, service: str, date: str, + master:str, time: str ): booking = { "user_id": user_id, "service": service, "date": date, + "master": master, "time": time, "status": "active" } diff --git a/app/states/booking.py b/app/states/booking.py index 9b31367..6b5a03a 100644 --- a/app/states/booking.py +++ b/app/states/booking.py @@ -2,6 +2,7 @@ from aiogram.fsm.state import StatesGroup, State class BookingState(StatesGroup): service = State() + master = State() date = State() time = State() confirm = State() \ No newline at end of file