2022-06-04 22:02:51 +03:00
|
|
|
from aiogram.types.inline_keyboard import InlineKeyboardMarkup, InlineKeyboardButton
|
|
|
|
|
|
|
|
from load import messages
|
|
|
|
|
|
|
|
|
2022-06-05 15:02:41 +03:00
|
|
|
def item_list(item: int = 0, items: int = 1, user_count: int = 1) -> InlineKeyboardMarkup:
|
2022-06-04 22:02:51 +03:00
|
|
|
markup = InlineKeyboardMarkup()
|
|
|
|
default = [
|
2022-06-05 15:02:41 +03:00
|
|
|
InlineKeyboardButton(str(user_count), callback_data='null')
|
2022-06-04 22:02:51 +03:00
|
|
|
]
|
|
|
|
back = ['⬅️', f"prev|{item-1}|{user_count-1}"]
|
|
|
|
next = ['➡️', f"next|{item+1}|{user_count+1}"]
|
|
|
|
|
|
|
|
if items < 1 or item >= items:
|
|
|
|
next = [" ", "null"]
|
|
|
|
|
|
|
|
if item == 0:
|
|
|
|
back = [" ", "null"]
|
|
|
|
|
|
|
|
default.append(InlineKeyboardButton(next[0], callback_data=next[1]))
|
|
|
|
|
|
|
|
markup.add(InlineKeyboardButton(back[0], callback_data=back[1]), *default)
|
|
|
|
markup.row(InlineKeyboardButton(messages.add_to_cart, callback_data=f"add_to_cart|{item}"))
|
2022-06-05 15:02:41 +03:00
|
|
|
return markup
|