added charge for all products
This commit is contained in:
@@ -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,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user