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,67 @@
|
||||
using FrontOffice.Main.Utilities;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
|
||||
namespace FrontOffice.Main.Pages.Club.Components;
|
||||
|
||||
public partial class ActivationSection : ComponentBase
|
||||
{
|
||||
[Inject] private ClubMembershipService ClubService { get; set; } = default!;
|
||||
|
||||
[Parameter] public EventCallback OnActivationSuccess { get; set; }
|
||||
|
||||
private MudForm _form = default!;
|
||||
private bool _formIsValid;
|
||||
private bool _isSubmitting;
|
||||
private string? _errorMessage;
|
||||
|
||||
private long _packageId = 1;
|
||||
private int _durationMonths = 1;
|
||||
private string? _activationCode;
|
||||
|
||||
private async Task HandleActivateAsync()
|
||||
{
|
||||
await _form.Validate();
|
||||
if (!_formIsValid)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
_isSubmitting = true;
|
||||
_errorMessage = null;
|
||||
|
||||
var result = await ClubService.ActivateMembershipAsync(
|
||||
_packageId,
|
||||
_activationCode,
|
||||
_durationMonths
|
||||
);
|
||||
|
||||
if (result.Success)
|
||||
{
|
||||
Snackbar.Add($"عضویت فعال شد! مبلغ پرداختی: {result.AmountPaid:N0} تومان", Severity.Success);
|
||||
await OnActivationSuccess.InvokeAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
_errorMessage = result.Message ?? "خطا در فعالسازی عضویت";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_errorMessage = $"خطا: {ex.Message}";
|
||||
Snackbar.Add(_errorMessage, Severity.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isSubmitting = false;
|
||||
}
|
||||
}
|
||||
|
||||
private string GetEstimatedCost()
|
||||
{
|
||||
// فرمول تقریبی: 56M per month (base amount from BFF implementation)
|
||||
var baseAmount = 56_000_000;
|
||||
var total = baseAmount * _durationMonths;
|
||||
return $"{total:N0} تومان";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user