Добавлена ветка prod_prep
This commit is contained in:
@@ -1,14 +1,21 @@
|
||||
"""Masters keyboard with specialty filtering."""
|
||||
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
|
||||
from app.config import MASTERS
|
||||
|
||||
|
||||
from app.keyboards.back import get_back_button
|
||||
|
||||
|
||||
def get_masters_keyboard():
|
||||
buttons = [
|
||||
[InlineKeyboardButton(text=name, callback_data=key)]
|
||||
for key, name in MASTERS.items()
|
||||
]
|
||||
def get_masters_keyboard(service_key=None):
|
||||
buttons = []
|
||||
svc_cats = {
|
||||
"service_massage": "massage",
|
||||
"service_spa": "spa",
|
||||
"service_cosmetology": "cosmetology",
|
||||
}
|
||||
for key, master in MASTERS.items():
|
||||
if service_key and "specialty" in master:
|
||||
needed = svc_cats.get(service_key, "")
|
||||
if needed and needed not in master["specialty"]:
|
||||
continue
|
||||
buttons.append([InlineKeyboardButton(text=master["name"], callback_data=key)])
|
||||
buttons.append(get_back_button())
|
||||
return InlineKeyboardMarkup(inline_keyboard=buttons)
|
||||
|
||||
Reference in New Issue
Block a user