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:
masoodafar-web
2025-12-04 17:29:16 +03:30
parent a8e6693c70
commit 95c6bf5efa
25 changed files with 1882 additions and 26 deletions
@@ -0,0 +1,72 @@
@using FrontOffice.Main.Utilities
@using MudBlazor
<MudPaper Elevation="2" Class="pa-4 rounded-lg">
<MudText Typo="Typo.h6" Class="mb-3">فعال‌سازی یا تمدید عضویت</MudText>
<MudForm @ref="_form" @bind-IsValid="_formIsValid">
<MudGrid Spacing="2">
<MudItem xs="12" sm="6">
<MudNumericField @bind-Value="_packageId"
Label="شناسه بسته"
Variant="Variant.Outlined"
Required="true"
RequiredError="شناسه بسته الزامی است"
Min="1"
HelperText="شناسه بسته باشگاه را وارد کنید" />
</MudItem>
<MudItem xs="12" sm="6">
<MudNumericField @bind-Value="_durationMonths"
Label="مدت زمان (ماه)"
Variant="Variant.Outlined"
Required="true"
RequiredError="مدت زمان الزامی است"
Min="1"
Max="12"
HelperText="از 1 تا 12 ماه" />
</MudItem>
<MudItem xs="12">
<MudTextField @bind-Value="_activationCode"
Label="کد فعال‌سازی (اختیاری)"
Variant="Variant.Outlined"
HelperText="در صورت داشتن کد تخفیف یا کد فعال‌سازی، وارد کنید" />
</MudItem>
<!-- پیش‌نمایش هزینه -->
<MudItem xs="12">
<MudAlert Severity="Severity.Info" Variant="Variant.Outlined">
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
<MudText Typo="Typo.body1">هزینه تقریبی:</MudText>
<MudText Typo="Typo.h6" Color="Color.Primary">@GetEstimatedCost()</MudText>
</MudStack>
</MudAlert>
</MudItem>
<MudItem xs="12">
<MudButton Variant="Variant.Filled"
Color="Color.Primary"
FullWidth="true"
Disabled="@(!_formIsValid || _isSubmitting)"
OnClick="HandleActivateAsync"
StartIcon="@Icons.Material.Filled.CheckCircle">
@if (_isSubmitting)
{
<MudProgressCircular Size="Size.Small" Indeterminate="true" />
<span class="ms-2">در حال پردازش...</span>
}
else
{
<span>پرداخت و فعال‌سازی</span>
}
</MudButton>
</MudItem>
</MudGrid>
</MudForm>
@if (!string.IsNullOrEmpty(_errorMessage))
{
<MudAlert Severity="Severity.Error" Class="mt-3" Variant="Variant.Filled">
@_errorMessage
</MudAlert>
}
</MudPaper>
@@ -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} تومان";
}
}