25 lines
777 B
Python
25 lines
777 B
Python
from aiogram.types.inline_keyboard import InlineKeyboardMarkup, InlineKeyboardButton
|
|
|
|
from load import messages
|
|
|
|
|
|
def cart_list(item:int = 0, items: int = 1) -> InlineKeyboardMarkup:
|
|
markup = InlineKeyboardMarkup()
|
|
default = [
|
|
InlineKeyboardButton(str(item+1), callback_data='null')
|
|
]
|
|
back = ['⬅️', f"cart_prev|{item-1}"]
|
|
next = ['➡️', f"cart_next|{item+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.delete, callback_data=f"del_from_cart|{item}"))
|
|
return markup
|