Files
FrontOffice/src/FrontOffice.Main/Pages/Profile/Wallet.razor.cs
T
masoodafar-web 025e8d3c3e
Build and Deploy / build (push) Successful in 1m25s
feat: add withdrawal requests feature and update VAT loading mechanism
2025-12-20 04:03:11 +03:30

39 lines
1.2 KiB
C#

using FrontOffice.Main.Utilities;
using Microsoft.AspNetCore.Components;
using MudBlazor;
namespace FrontOffice.Main.Pages.Profile;
public partial class Wallet : ComponentBase
{
private (string Credit, string Discount, string Network) _balances = ("-", "-", "-");
private List<WalletTransaction> _txs = new();
private string? _filterReferenceId;
private string _filterType = "all";
protected override async Task OnInitializedAsync()
{
var b = await WalletService.GetBalancesAsync();
_balances = (FormatPrice(b.CreditBalance), FormatPrice(b.DiscountBalance), FormatPrice(b.NetworkBalance));
_txs = await WalletService.GetTransactionsAsync();
}
private static string FormatPrice(long price) => string.Format("{0:N0} تومان", price);
private async Task ApplyFilters()
{
long? refId = null;
if (long.TryParse(_filterReferenceId, out var parsed) && parsed > 0)
{
refId = parsed;
}
bool? isIncrease = _filterType switch
{
"in" => true,
"out" => false,
_ => null
};
_txs = await WalletService.GetTransactionsAsync(refId, isIncrease);
}
}