fix amount 4

This commit is contained in:
2026-06-09 11:17:07 +03:30
parent ca7177d21b
commit a8dd0071e2
3 changed files with 49 additions and 7 deletions
@@ -113,7 +113,11 @@ class WalletController extends Controller
} else {
$record->title = ($record->gold > 0 ? self::productBuyTitle($wallet->product->title) : self::productSellTitle($wallet->product->title));
}
$record->unit = "عدد";
$record->unit = self::productQuantityUnit([
'unit' => $wallet->product->unit ?? null,
'direct_price' => $wallet->product->direct_price ?? null,
'group_type' => $wallet->product->group_type ?? null,
]);
} else {
$record->title = $this->resolveMainWalletTransactionTitle($record);
}
@@ -400,8 +404,10 @@ class WalletController extends Controller
$expectedBuy = self::productBuyTitle($productTitle);
$expectedSell = self::productSellTitle($productTitle);
$metalBuy = self::mainMetalBuyTitle();
$metalSell = self::mainMetalSellTitle();
if ($record->title === $expectedBuy || $record->title === $expectedSell) {
if (in_array($record->title, [$expectedBuy, $expectedSell, $metalBuy, $metalSell], true)) {
return;
}
@@ -470,6 +476,10 @@ class WalletController extends Controller
{
$product = $record->wallet->product ?? $record->product ?? null;
if (!$product) {
if (!empty($record->gold) && empty($record->wallet?->product)) {
$record->unit = self::tradeWeightUnit();
}
return;
}