added charge for all products

This commit is contained in:
2026-07-11 17:59:50 +03:30
parent 47a2f8e6bf
commit 0d78bcb750
3 changed files with 15 additions and 9 deletions
@@ -167,7 +167,7 @@ class CustomerController extends SuperController
$customer = Customer::findOrFail($customerId);
return response()->json(
$assetSummaryService->buildForCustomer((int) $customer->id, (int) $customer->type)
$assetSummaryService->buildForCustomer((int) $customer->id, (int) $customer->type, true)
);
}
@@ -234,7 +234,7 @@ class WalletController extends Controller
return response()->json(true);
}
/** گزینه‌های شارژ کیف پول — نقدی + محصولات فعال */
/** گزینه‌های شارژ کیف پول — نقدی + همهٔ محصولات (فعال و غیرفعال) */
public function chargeTargets()
{
$configService = app(ConfigService::class);
@@ -247,14 +247,15 @@ class WalletController extends Controller
'kind' => 'money',
'label' => 'نقدی (ریال)',
'unit' => 'ریال',
'active' => true,
],
];
$products = Product::query()
->where('active', 1)
->orderByDesc('active')
->orderBy('metal_id')
->orderBy('id')
->get(['id', 'title', 'unit', 'metal_id', 'group_type', 'trade_by_quantity', 'amount', 'direct_price']);
->get(['id', 'title', 'unit', 'metal_id', 'group_type', 'trade_by_quantity', 'amount', 'direct_price', 'active']);
foreach ($products as $product) {
$usesMainWallet = in_array((int) $product->id, $mainWalletProductIds, true);
@@ -262,6 +263,9 @@ class WalletController extends Controller
if ($usesMainWallet) {
$label .= ' (کیف اصلی)';
}
if (!(bool) $product->active) {
$label .= ' (غیرفعال)';
}
$targets[] = [
'key' => 'product:' . $product->id,
@@ -273,6 +277,7 @@ class WalletController extends Controller
'uses_main_wallet' => $usesMainWallet,
'trade_by_quantity' => (bool) $product->trade_by_quantity,
'group_type' => (string) ($product->group_type ?? ''),
'active' => (bool) $product->active,
];
}