feat: update commission status handling and UI; enhance status representation with computed properties and improve filtering logic
Build and Deploy / build (push) Successful in 2m20s

This commit is contained in:
masoodafar-web
2025-12-27 07:31:31 +03:30
parent e3521af071
commit 3fdaa2c22a
6 changed files with 48 additions and 23 deletions
@@ -98,10 +98,12 @@ public class CommissionService
{
request.Status = status switch
{
"Pending" or "ایجاد شده" => 0,
"Calculated" or "محاسبه شده" => 1,
"Paid" or "پرداخت شده" => 2,
"Pending" or "در انتظار" or "Created" or "ایجاد شده" => 0,
"Paid" or "پرداخت شده" => 1,
"WithdrawalRequested" or "درخواست برداشت" => 2,
"Withdrawn" or "برداشت شده" => 3,
"PaymentFailed" or "شکست خورده" => 4,
"Cancelled" or "لغو شده" => 5,
_ => null
};
}
@@ -119,7 +121,6 @@ public class CommissionService
TotalAmount = p.TotalAmount,
AmountFormatted = p.AmountFormatted,
Status = p.Status,
StatusBadgeColor = p.StatusBadgeColor,
DatePersian = p.DatePersian
}).ToList(),
TotalCount = (int)(response.MetaData?.TotalCount ?? 0),
@@ -209,9 +210,9 @@ public class CommissionService
var response = await _client.GetMyCommissionPayoutsAsync(request);
// Filter: exclude already withdrawn (status text contains "برداشت" or status=3)
// Filter: exclude already withdrawn (status=3) and withdrawal requested (status=2)
return response.Payouts
.Where(p => !p.Status.Contains("برداشت") && p.Status != "Withdrawn")
.Where(p => p.Status != 2 && p.Status != 3)
.Select(p => new CommissionPayoutDto
{
Id = p.Id,
@@ -221,7 +222,6 @@ public class CommissionService
TotalAmount = p.TotalAmount,
AmountFormatted = p.AmountFormatted,
Status = p.Status,
StatusBadgeColor = p.StatusBadgeColor,
DatePersian = p.DatePersian
}).ToList();
}