fix some bug
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
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}`
|
||||
}
|
||||
Reference in New Issue
Block a user