fix wallet ui
This commit is contained in:
@@ -16,6 +16,7 @@ use Rooyesh\Wallet\interfaces\WalletInterface;
|
||||
use Rooyesh\Wallet\models\Transaction;
|
||||
use Rooyesh\Wallet\models\Wallet;
|
||||
use App\Models\Setting;
|
||||
use App\Services\AssetSummaryService;
|
||||
use App\Services\BalanceReportService;
|
||||
use App\Services\ConfigService;
|
||||
use App\Services\WalletBalanceService;
|
||||
@@ -23,6 +24,11 @@ use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
|
||||
|
||||
class CustomerController extends SuperController
|
||||
{
|
||||
/** فیلدهای محصول لازم برای محاسبهٔ صحیح وزن موجودی */
|
||||
private const WALLET_PRODUCT_COLUMNS = [
|
||||
'id', 'metal_id', 'unit', 'amount', 'group_type', 'trade_by_quantity', 'direct_price', 'title',
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->with = [];
|
||||
@@ -134,7 +140,8 @@ class CustomerController extends SuperController
|
||||
return response()->json(true);
|
||||
}
|
||||
public function tableWallets(Request $request){
|
||||
$query_table = Customer::with(['wallet.product:id,metal_id', 'referral'])->where("is_archive",false)/*->where('type',1)*/;
|
||||
$productSelect = 'product:'.implode(',', self::WALLET_PRODUCT_COLUMNS);
|
||||
$query_table = Customer::with(['wallet.'.$productSelect, 'referral'])->where('is_archive', false);
|
||||
TableEngine::create($query_table, $request)
|
||||
->initSearch($this->search)
|
||||
->select(['*',Customer::$SELECT_TYPE_STR])
|
||||
@@ -163,6 +170,15 @@ class CustomerController extends SuperController
|
||||
return response()->json($query_table);
|
||||
}
|
||||
|
||||
public function assetsSummary($customerId, AssetSummaryService $assetSummaryService)
|
||||
{
|
||||
$customer = Customer::findOrFail($customerId);
|
||||
|
||||
return response()->json(
|
||||
$assetSummaryService->buildForCustomer((int) $customer->id, (int) $customer->type)
|
||||
);
|
||||
}
|
||||
|
||||
public function archiveTable(Request $request)
|
||||
{
|
||||
$query_table = Customer::with($this->with)->where("is_archive",true)/*->where('type',1)*/;
|
||||
|
||||
Reference in New Issue
Block a user