fix(tv): show board prices from tv_price instead of list price

The monitor uses the TV formula field so the catalog list price stays unchanged.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-06 21:35:54 +03:30
co-authored by Cursor
parent 4104235546
commit 065a0b3178
4 changed files with 46 additions and 9 deletions
+36
View File
@@ -249,6 +249,42 @@ export function isProductPriceInactive(product?: Product | null): boolean {
return getProductBaseBuyPrice(product) <= 0
}
function tvUnitPrice(product: Product): number {
return Number(product.tv_price ?? 0)
}
export function getTvProductBuyPrice(product?: Product | null): number {
if (!product) {
return 0
}
const unit = tvUnitPrice(product)
if (unit > 0) {
return unit + resolveProductCashFeeBuyRial(product, unit)
}
return getProductBuyPrice(product)
}
export function getTvProductSellPrice(product?: Product | null): number {
if (!product) {
return 0
}
const unit = tvUnitPrice(product)
if (unit > 0) {
return unit - resolveProductCashFeeSellRial(product, unit)
}
return getProductSellPrice(product)
}
export function isTvProductPriceInactive(product?: Product | null): boolean {
if (!product) {
return true
}
if (tvUnitPrice(product) > 0) {
return false
}
return isProductPriceInactive(product)
}
/**
* نمایش محصول در فروشگاه — اولویت با `show` سرور.
* آبشدهٔ قیمت‌اپ با مظنه زنده حتی اگر show هنوز false باشد.