Files
boursecu_admin/src/utils/walletDisplay.ts
T
2026-07-01 22:28:09 +03:30

26 lines
941 B
TypeScript

import type { Wallet, WalletKind } from '@/model/wallet'
export function walletKindTagStyle(kind?: WalletKind) {
switch (kind) {
case 'main':
return { textColor: '#1d4ed8', bgColor: '#dbeafe' }
case 'product':
return { textColor: '#15803d', bgColor: '#dcfce7' }
case 'fund':
return { textColor: '#7e22ce', bgColor: '#f3e8ff' }
default:
return { textColor: '#374151', bgColor: '#f3f4f6' }
}
}
export function walletSheetTitle(wallet: Wallet | null | undefined): string {
if (!wallet) return 'مشخصات کیف پول'
return wallet.wallet_subject || wallet.customer?.name || `کیف پول #${wallet.id ?? '-'}`
}
export function walletProductWeightLabel(wallet: Wallet | null | undefined): string {
if (!wallet?.product_amount && wallet?.product_amount !== 0) return '—'
const unit = wallet.product_unit ? ` ${wallet.product_unit}` : ''
return `${wallet.product_amount}${unit}`
}