fix(wallet): use dynamic metal label in wallet balance subject
This commit is contained in:
@@ -593,6 +593,8 @@ class WalletBalanceService
|
||||
$product = $this->lineProduct($row);
|
||||
$fund = $this->lineFund($row);
|
||||
$cash = (float) ($this->lineValue($row, 'cash') ?? 0);
|
||||
$metalId = $this->resolveWalletLineMetalId($row, $mainWalletMetalId);
|
||||
$metalLabel = $this->balanceReportService->metalLabel($metalId);
|
||||
|
||||
if ($fundId !== null) {
|
||||
$kind = 'fund';
|
||||
@@ -602,7 +604,7 @@ class WalletBalanceService
|
||||
} elseif ($productId === null) {
|
||||
$kind = 'main';
|
||||
$kindLabel = 'کیف اصلی';
|
||||
$subject = 'کیف اصلی — ریال و طلای آبشده';
|
||||
$subject = 'کیف اصلی — ریال و ' . ($metalLabel !== '' ? $metalLabel : 'مس');
|
||||
} else {
|
||||
$kind = 'product';
|
||||
$kindLabel = 'کیف محصول';
|
||||
@@ -610,7 +612,6 @@ class WalletBalanceService
|
||||
$subject = $title !== '' ? "محصول «{$title}»" : "محصول کد {$productId}";
|
||||
}
|
||||
|
||||
$metalId = $this->resolveWalletLineMetalId($row, $mainWalletMetalId);
|
||||
$goldGrams = $this->walletLineGoldGrams($row);
|
||||
$goldToCash = $goldGrams > 0 ? (int) round($goldGrams * $this->livePricePerGram($metalId)) : 0;
|
||||
|
||||
@@ -624,7 +625,7 @@ class WalletBalanceService
|
||||
'product_amount' => $product?->amount ?? null,
|
||||
'fund_title' => $fund?->title ?? null,
|
||||
'wallet_metal_id' => $metalId,
|
||||
'wallet_metal_label' => $this->balanceReportService->metalLabel($metalId),
|
||||
'wallet_metal_label' => $metalLabel,
|
||||
'gold_to_cash' => $goldToCash,
|
||||
'gold_grams' => round($goldGrams, 3),
|
||||
'total_rial_value' => (int) round($cash + $goldToCash),
|
||||
|
||||
Reference in New Issue
Block a user