fix showing amount of wallet

This commit is contained in:
2026-06-23 23:31:08 +03:30
parent 69a39ff371
commit 6c89375370
4 changed files with 18 additions and 9 deletions
+9 -5
View File
@@ -1,5 +1,5 @@
import type { Product } from '@/models/products'
import { usePriceWithoutType } from '@/utils/usePrice'
import { formatWeightAmount, usePriceWithoutType } from '@/utils/usePrice'
import type { UserWalletLine } from '@/models/wallet'
import type { ProductFile } from '@/utils/file'
import type { WalletInventoryCard, WalletMetalTotal } from '@/models/walletAssets'
@@ -198,7 +198,7 @@ function findMetalTotalById(metalTotals: WalletMetalTotal[], metalId: number) {
}
function formatBoursecuMetalRowValue(metal: WalletMetalTotal): string {
const amount = usePriceWithoutType(Number(metal.total_weight ?? 0), false)
const amount = formatWeightAmount(Number(metal.total_weight ?? 0))
if (metal.metal_id === METAL_GOLD) {
return `${amount} عدد`
}
@@ -266,7 +266,7 @@ function buildBoursecuCopperPopupLines(summary: {
},
{
label: 'مجموع کل دارایی مس',
value: `${usePriceWithoutType(totalWeight, false)} ${weightUnit}`,
value: `${formatWeightAmount(totalWeight)} ${weightUnit}`,
},
]
}
@@ -343,7 +343,7 @@ export function buildBoursecuHomeAssetRows(
{
id: 'copper-total',
label: 'کل دارایی مسی',
value: `${usePriceWithoutType(totalCopperWeight, false)} ${weightUnit}`,
value: `${formatWeightAmount(totalCopperWeight)} ${weightUnit}`,
popupLines: buildBoursecuCopperPopupLines(summary),
},
{
@@ -448,7 +448,11 @@ export function formatInventoryCardValue(card: {
}): string {
const quantity = Number(card.quantity ?? 0)
const unit = card.unit ?? (card.display_type === 'count' ? 'عدد' : 'گرم')
return `${usePriceWithoutType(quantity, false)} ${unit}`
const formatted =
card.display_type === 'count'
? usePriceWithoutType(quantity, false)
: formatWeightAmount(quantity)
return `${formatted} ${unit}`
}
export function findProductInventoryCard(