fix(wallet): use kilogram as default unit for copper exchange

This commit is contained in:
2026-11-18 10:14:04 +03:30
parent 3e053b65c9
commit 73a1124c88
5 changed files with 8 additions and 8 deletions
@@ -1458,7 +1458,7 @@ class WalletController extends Controller
'allows_decimal' => !$isCountBased, 'allows_decimal' => !$isCountBased,
'unit' => $product 'unit' => $product
? self::productQuantityUnit(self::productUnitPayload($product)) ? self::productQuantityUnit(self::productUnitPayload($product))
: 'گرم', : 'کیلوگرم',
]; ];
})->values(); })->values();
+1 -1
View File
@@ -546,7 +546,7 @@ class Controller extends BaseController
return $unit; return $unit;
} }
return 'گرم'; return 'کیلوگرم';
} }
public static function productLineWeightToGrams($product, $quantity): float public static function productLineWeightToGrams($product, $quantity): float
@@ -183,14 +183,14 @@ class WalletController extends Controller
if (empty($record->title) || $record->title == "تعریف نشده") { if (empty($record->title) || $record->title == "تعریف نشده") {
$record->title = $record->type_str; $record->title = $record->type_str;
$record->unit = "گرم"; $record->unit = "کیلوگرم";
if ((int) ($record->type ?? 0) === 22) { if ((int) ($record->type ?? 0) === 22) {
$record->title = 'تعدیل حسابداری پرگار'; $record->title = 'تعدیل حسابداری پرگار';
$record->unit = 'گرم'; $record->unit = 'کیلوگرم';
} elseif ((int) ($record->type ?? 0) === 23) { } elseif ((int) ($record->type ?? 0) === 23) {
$record->title = 'تعدیل حسابداری ته‌حساب'; $record->title = 'تعدیل حسابداری ته‌حساب';
$record->unit = 'گرم'; $record->unit = 'کیلوگرم';
} elseif ((int) ($record->type ?? 0) === 12) { } elseif ((int) ($record->type ?? 0) === 12) {
$record->title = 'برداشت وجه نقد'; $record->title = 'برداشت وجه نقد';
$record->unit = 'ریال'; $record->unit = 'ریال';
@@ -157,7 +157,7 @@ class AutomationCatalog
'name' => 'موجودی طلا کیف اصلی', 'name' => 'موجودی طلا کیف اصلی',
'inputs' => [ 'inputs' => [
['key' => 'op', 'type' => 'operator', 'label' => 'مقایسه'], ['key' => 'op', 'type' => 'operator', 'label' => 'مقایسه'],
['key' => 'value', 'type' => 'number', 'label' => 'مقدار (گرم)'], ['key' => 'value', 'type' => 'number', 'label' => 'مقدار (کیلوگرم)'],
], ],
], ],
[ [
+2 -2
View File
@@ -39,10 +39,10 @@ class BalanceReportService
return self::METAL_LABELS[$metalId] ?? "فلز {$metalId}"; return self::METAL_LABELS[$metalId] ?? "فلز {$metalId}";
} }
/** واحد نمایش موجودی/تراز هر فلز در ادمین — مس کیلوگرم، بقیه گرم */ /** واحد نمایش موجودی/تراز هر فلز در ادمین — کیلوگرم */
public function metalDisplayUnit(int $metalId): string public function metalDisplayUnit(int $metalId): string
{ {
return (int) $metalId === 3 ? 'کیلوگرم' : 'گرم'; return 'کیلوگرم';
} }
public function gramsToMetalDisplay(float $grams, int $metalId): float public function gramsToMetalDisplay(float $grams, int $metalId): float