96 lines
2.3 KiB
C#
96 lines
2.3 KiB
C#
using BackOffice.Common.BaseComponents;
|
|
using MudBlazor;
|
|
|
|
namespace BackOffice.Pages.Payment;
|
|
|
|
public partial class Transactions
|
|
{
|
|
private BasePageComponent? _basePage;
|
|
private MudDataGrid<TransactionModel>? _dataGrid;
|
|
|
|
private DateTime? _fromDate;
|
|
private DateTime? _toDate;
|
|
private int? _statusFilter;
|
|
private int? _typeFilter;
|
|
|
|
private async Task<GridData<TransactionModel>> LoadData(GridState<TransactionModel> state)
|
|
{
|
|
// TODO: Connect to BackOffice.BFF Transactions when API is ready
|
|
await Task.CompletedTask;
|
|
|
|
return new GridData<TransactionModel>
|
|
{
|
|
Items = Array.Empty<TransactionModel>(),
|
|
TotalItems = 0
|
|
};
|
|
}
|
|
|
|
private async Task OnFilterSubmit()
|
|
{
|
|
if (_dataGrid != null)
|
|
await _dataGrid.ReloadServerData();
|
|
}
|
|
|
|
private async Task OnFilterCleared()
|
|
{
|
|
_fromDate = null;
|
|
_toDate = null;
|
|
_statusFilter = null;
|
|
_typeFilter = null;
|
|
if (_dataGrid != null)
|
|
await _dataGrid.ReloadServerData();
|
|
}
|
|
|
|
private void OpenDetails(TransactionModel model)
|
|
{
|
|
// TODO: Open TransactionDetailsDialog with model
|
|
}
|
|
|
|
private static string GetStatusText(int status)
|
|
{
|
|
return status switch
|
|
{
|
|
0 => "در انتظار",
|
|
1 => "موفق",
|
|
2 => "ناموفق",
|
|
3 => "بازگشت وجه",
|
|
_ => "نامشخص"
|
|
};
|
|
}
|
|
|
|
private static Color GetStatusColor(int status)
|
|
{
|
|
return status switch
|
|
{
|
|
0 => Color.Warning,
|
|
1 => Color.Success,
|
|
2 => Color.Error,
|
|
3 => Color.Info,
|
|
_ => Color.Default
|
|
};
|
|
}
|
|
|
|
private static string GetTypeText(int type)
|
|
{
|
|
return type switch
|
|
{
|
|
1 => "خرید پکیج",
|
|
2 => "پرداخت دستی",
|
|
3 => "شارژ کیفپول",
|
|
4 => "بازگشت وجه",
|
|
_ => "نامشخص"
|
|
};
|
|
}
|
|
|
|
private class TransactionModel
|
|
{
|
|
public long Id { get; set; }
|
|
public string? RefId { get; set; }
|
|
public long Amount { get; set; }
|
|
public int PaymentStatus { get; set; }
|
|
public DateTime PaymentDate { get; set; }
|
|
public int Type { get; set; }
|
|
}
|
|
}
|
|
|