feat: enhance WithdrawalRequests page with payout selection and improved submission logic; add sorting options for products
Build and Deploy / build (push) Successful in 1m18s

This commit is contained in:
masoodafar-web
2025-12-27 06:22:41 +03:30
parent 43cdf7c897
commit e3521af071
10 changed files with 228 additions and 57 deletions
@@ -6,12 +6,15 @@ namespace FrontOffice.Main.Pages.Profile;
public partial class WithdrawalRequests : ComponentBase
{
[Inject] private CommissionService CommissionService { get; set; } = default!;
private long _minWithdrawalAmount = 1_000_000;
private List<WalletWithdrawal> _withdrawals = new();
private List<CommissionPayoutDto> _availablePayouts = new();
private string _statusFilter = "all";
private bool _isLoading = true;
private bool _isSubmittingWithdrawal;
private long _withdrawPayoutId;
private CommissionPayoutDto? _selectedPayout;
private WithdrawalMethodClient _withdrawMethod = WithdrawalMethodClient.Cash;
private string? _withdrawIban;
@@ -26,6 +29,7 @@ public partial class WithdrawalRequests : ComponentBase
try
{
_withdrawals = await WalletService.GetWithdrawalsAsync();
_availablePayouts = await CommissionService.GetWithdrawablePayoutsAsync();
var settings = await WalletService.GetWithdrawalSettingsAsync();
if (settings.MinWithdrawalAmount > 0)
_minWithdrawalAmount = settings.MinWithdrawalAmount;
@@ -40,9 +44,9 @@ public partial class WithdrawalRequests : ComponentBase
private async Task SubmitWithdrawal()
{
if (_withdrawPayoutId <= 0)
if (_selectedPayout == null)
{
Snackbar.Add("شناسه واریز (PayoutId) الزامی است.", Severity.Warning);
Snackbar.Add("لطفاً یک واریز را انتخاب کنید.", Severity.Warning);
return;
}
if (_withdrawMethod == WithdrawalMethodClient.Cash && string.IsNullOrWhiteSpace(_withdrawIban))
@@ -54,14 +58,14 @@ public partial class WithdrawalRequests : ComponentBase
try
{
_isSubmittingWithdrawal = true;
await WalletService.RequestWithdrawalAsync(_withdrawPayoutId, _withdrawMethod, _withdrawIban);
await WalletService.RequestWithdrawalAsync(_selectedPayout.Id, _withdrawMethod, _withdrawIban);
Snackbar.Add("درخواست برداشت ثبت شد.", Severity.Success);
// بروزرسانی لیست
await LoadData();
// ریست فرم
_withdrawPayoutId = 0;
_selectedPayout = null;
_withdrawIban = null;
}
catch (Exception ex)