feat: Implement Commission and Network Statistics Pages with DTOs and Services
- Added CommissionDashboardPage and CommissionHistoryPage for displaying commission payouts and history. - Implemented WeeklyBalancePage to show weekly balance details. - Created NetworkStatisticsPage to display network statistics and tree structure. - Developed corresponding services (CommissionService, NetworkMembershipService) for data retrieval. - Introduced DTOs for Commission and Network data structures (CommissionPayoutDto, WeeklyBalanceDto, NetworkStatisticsDto). - Added mock data generation for testing purposes in services. - Enhanced UI with MudBlazor components for better user experience.
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
namespace FrontOffice.Main.Utilities;
|
||||
|
||||
/// <summary>
|
||||
/// Service for Network Membership operations
|
||||
/// TODO: Connect to FrontOffice.BFF gRPC NetworkMembershipCQ
|
||||
/// </summary>
|
||||
public class NetworkMembershipService
|
||||
{
|
||||
// TODO: Inject gRPC client when FrontOffice connects to BFF
|
||||
// private readonly NetworkMembershipContract.NetworkMembershipContractClient _client;
|
||||
|
||||
public NetworkMembershipService()
|
||||
{
|
||||
// TODO: Initialize gRPC client
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get current user's network tree
|
||||
/// Maps to: NetworkMembershipCQ.GetMyNetworkTree
|
||||
/// </summary>
|
||||
public async Task<NetworkTreeDto> GetMyNetworkTreeAsync(int maxDepth = 3)
|
||||
{
|
||||
// TODO: Replace with actual gRPC call to BFF
|
||||
// var request = new GetMyNetworkTreeRequest { MaxDepth = maxDepth };
|
||||
// var response = await _client.GetMyNetworkTreeAsync(request);
|
||||
// return MapToDto(response);
|
||||
|
||||
await Task.Delay(500); // Simulate network delay
|
||||
|
||||
// Mock data with sample tree
|
||||
return new NetworkTreeDto
|
||||
{
|
||||
CurrentDepth = 2,
|
||||
TotalMembers = 5,
|
||||
RootNode = new NetworkNodeDto
|
||||
{
|
||||
UserId = 1,
|
||||
FullName = "شما",
|
||||
Mobile = "09121234567",
|
||||
Position = "Root",
|
||||
Level = 0,
|
||||
LeftChild = new NetworkNodeDto
|
||||
{
|
||||
UserId = 2,
|
||||
FullName = "علی محمدی",
|
||||
Mobile = "09121234568",
|
||||
Position = "Left",
|
||||
Level = 1,
|
||||
LeftChild = new NetworkNodeDto
|
||||
{
|
||||
UserId = 4,
|
||||
FullName = "رضا احمدی",
|
||||
Mobile = "09121234570",
|
||||
Position = "Left",
|
||||
Level = 2
|
||||
}
|
||||
},
|
||||
RightChild = new NetworkNodeDto
|
||||
{
|
||||
UserId = 3,
|
||||
FullName = "فاطمه حسینی",
|
||||
Mobile = "09121234569",
|
||||
Position = "Right",
|
||||
Level = 1,
|
||||
RightChild = new NetworkNodeDto
|
||||
{
|
||||
UserId = 5,
|
||||
FullName = "زهرا کریمی",
|
||||
Mobile = "09121234571",
|
||||
Position = "Right",
|
||||
Level = 2
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get current user's network statistics
|
||||
/// Maps to: NetworkMembershipCQ.GetMyNetworkStatistics
|
||||
/// </summary>
|
||||
public async Task<NetworkStatisticsDto> GetMyNetworkStatisticsAsync()
|
||||
{
|
||||
// TODO: Replace with actual gRPC call to BFF
|
||||
// var request = new GetMyNetworkStatisticsRequest();
|
||||
// var response = await _client.GetMyNetworkStatisticsAsync(request);
|
||||
// return MapToDto(response);
|
||||
|
||||
await Task.Delay(500); // Simulate network delay
|
||||
|
||||
// Mock statistics
|
||||
return new NetworkStatisticsDto
|
||||
{
|
||||
LeftLegCount = 15,
|
||||
RightLegCount = 12,
|
||||
TotalMembers = 27,
|
||||
TreeDepth = 4,
|
||||
WeakerLeg = "Right",
|
||||
LastMember = new LastMemberDto
|
||||
{
|
||||
UserId = 28,
|
||||
FullName = "محمد رضایی",
|
||||
Position = "Left",
|
||||
JoinedAt = DateTime.Now.AddHours(-2)
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user