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
@@ -191,6 +191,46 @@ public class CommissionService
#region Helper Methods
/// <summary>
/// Get payouts that are eligible for withdrawal (all statuses except Withdrawn=3)
/// </summary>
public async Task<List<CommissionPayoutDto>> GetWithdrawablePayoutsAsync()
{
try
{
// Get all payouts that are not yet withdrawn
// We'll get all and filter out Withdrawn (status=3) on client side
var request = new GetMyCommissionPayoutsRequest
{
PageNumber = 1,
PageSize = 100
// No status filter - get all
};
var response = await _client.GetMyCommissionPayoutsAsync(request);
// Filter: exclude already withdrawn (status text contains "برداشت" or status=3)
return response.Payouts
.Where(p => !p.Status.Contains("برداشت") && p.Status != "Withdrawn")
.Select(p => new CommissionPayoutDto
{
Id = p.Id,
WeekDefinitionId = p.WeekDefinitionId,
WeekDisplayName = p.WeekDisplayName,
BalancesEarned = p.BalancesEarned,
TotalAmount = p.TotalAmount,
AmountFormatted = p.AmountFormatted,
Status = p.Status,
StatusBadgeColor = p.StatusBadgeColor,
DatePersian = p.DatePersian
}).ToList();
}
catch
{
return new List<CommissionPayoutDto>();
}
}
private static WeeklyBalanceDto CreateEmptyWeeklyBalance()
{
return new WeeklyBalanceDto