Files
shveitechbot/misc/texts.py

27 lines
838 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from db.models import Product
from dto.cart import CartDTO
product_editing_mapping = {
"name": "новое название",
"description": "новое описание",
"price": "новую цену",
}
def get_product_description(product: Product) -> str:
output = f"📦 <b>{product.name}</b>\n\n<b>🏷️ {product.price}₽</b>"
if product.description:
output += f"\n\n📜 <b><i>{product.description}</i></b>"
return output
def get_order_item_list(cart: CartDTO):
text = "🛍 Состав заказа:\n"
for i, product in enumerate(cart.items):
text += f"\n{i+1}. <b>{product.name}</b>\n\t<i>{product.quantity} × {product.price} = {product.total}₽</i>\n"
text += f"\n━━━━━━━━━━━━━━\n💰 Итого: {cart.total}"
return text