23 lines
691 B
Python
23 lines
691 B
Python
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
|
from app.config import TIME_SLOTS
|
|
from app.keyboards.back import get_back_button
|
|
|
|
|
|
def get_time_keyboard(busy_times):
|
|
buttons = []
|
|
row = []
|
|
for slot in TIME_SLOTS:
|
|
busy = slot in busy_times
|
|
if busy:
|
|
label = "\u274c" + " " + slot
|
|
else:
|
|
label = "\u2705" + " " + slot
|
|
row.append(InlineKeyboardButton(text=label, callback_data="time_" + slot))
|
|
if len(row) == 3:
|
|
buttons.append(row)
|
|
row = []
|
|
if row:
|
|
buttons.append(row)
|
|
buttons.append(get_back_button())
|
|
return InlineKeyboardMarkup(inline_keyboard=buttons)
|