- SERVICES, MASTERS, TIME_SLOTS в config.py - Клавиатуры services.py, masters.py, time_slots.py берут данные из config - booking.py импортирует services/masters из config вместо хардкода - time_slots отображает занятые слоты как ❌, свободные как ✅
20 lines
564 B
Python
20 lines
564 B
Python
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
|
from app.config import TIME_SLOTS
|
|
|
|
|
|
def get_time_keyboard(busy_times):
|
|
buttons = []
|
|
row = []
|
|
for slot in TIME_SLOTS:
|
|
if slot in busy_times:
|
|
label = f❌ {slot}
|
|
else:
|
|
label = f✅ {slot}
|
|
row.append(InlineKeyboardButton(text=label, callback_data=ftime_{slot}))
|
|
if len(row) == 3:
|
|
buttons.append(row)
|
|
row = []
|
|
if row:
|
|
buttons.append(row)
|
|
return InlineKeyboardMarkup(inline_keyboard=buttons)
|