separated clients handlers, cart->checkout ppline
This commit is contained in:
@@ -6,6 +6,10 @@ from aiogram.utils.keyboard import InlineKeyboardBuilder
|
||||
from db.models import Category, Product
|
||||
from dto.cart import CartItemDTO
|
||||
|
||||
return_menu = InlineKeyboardBuilder(
|
||||
[[InlineKeyboardButton(text="⬅️ В меню", callback_data="menu:main")]]
|
||||
).as_markup()
|
||||
|
||||
|
||||
def pagination_row(
|
||||
*,
|
||||
@@ -15,6 +19,9 @@ def pagination_row(
|
||||
) -> list[InlineKeyboardButton]:
|
||||
row = []
|
||||
|
||||
if not (prev_cb or next_cb):
|
||||
return row
|
||||
|
||||
if prev_cb:
|
||||
row.append(InlineKeyboardButton(text="⬅️", callback_data=prev_cb))
|
||||
|
||||
@@ -161,7 +168,7 @@ def render_cart(
|
||||
) -> InlineKeyboardMarkup:
|
||||
btns = [
|
||||
InlineKeyboardButton(
|
||||
text=f"{cart_item.quantity} | {cart_item.name} | {cart_item.total}₽",
|
||||
text=f"🛒 {cart_item.quantity} | {cart_item.name} | {cart_item.total}₽",
|
||||
callback_data=f"product:{cart_item.product_id}",
|
||||
)
|
||||
for cart_item in cart_items
|
||||
@@ -184,4 +191,33 @@ def render_cart(
|
||||
]
|
||||
+ [btns[i : i + 2] for i in range(0, len(cart_items), 2)]
|
||||
+ [nav]
|
||||
+ [[InlineKeyboardButton(text="🔷 Оформить заказ", callback_data="checkout")]]
|
||||
).as_markup()
|
||||
|
||||
|
||||
def order_confirmation(order_id: int) -> InlineKeyboardMarkup:
|
||||
return InlineKeyboardBuilder(
|
||||
[
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
text="🟢 Подтвердить заказ",
|
||||
callback_data=f"confirm_order:{order_id}",
|
||||
)
|
||||
],
|
||||
[InlineKeyboardButton(text="❌ Отменить", callback_data="menu:main")],
|
||||
]
|
||||
).as_markup()
|
||||
|
||||
|
||||
def order_specs_confirmation(order_id: int) -> InlineKeyboardMarkup:
|
||||
return InlineKeyboardBuilder(
|
||||
[
|
||||
[
|
||||
InlineKeyboardButton(
|
||||
text="🟢 Перейти к оплате",
|
||||
callback_data=f"payment:{order_id}",
|
||||
)
|
||||
],
|
||||
[InlineKeyboardButton(text="❌", callback_data="menu:main")],
|
||||
]
|
||||
).as_markup()
|
||||
|
||||
Reference in New Issue
Block a user