Refactor commission-related pages and terminology to enhance clarity and consistency
Build and Deploy / build (push) Successful in 1m22s
Build and Deploy / build (push) Successful in 1m22s
- Updated CommissionDashboardPage to reflect new terminology for rewards instead of commissions. - Removed CommissionHistoryPage as its functionality has been integrated into the dashboard. - Adjusted WeeklyBalancePage to align with new reward terminology and improved layout. - Modified Index, NetworkStatisticsPage, MyPackages, Packages, Profile, and Wallet pages to use consistent terms related to team and rewards. - Updated ClubMembershipContractDialog to clarify user invitation terms. - Enhanced footer description to reflect the focus on sales teams.
This commit is contained in:
@@ -1,32 +1,33 @@
|
||||
@attribute [Route(RouteConstants.Commission.Dashboard)]
|
||||
@attribute [Route(RouteConstants.Commission.History)]
|
||||
@using FrontOffice.Main.Utilities
|
||||
@using FrontOffice.Main.Shared
|
||||
@using MudBlazor
|
||||
|
||||
<PageTitle>داشبورد کمیسیون</PageTitle>
|
||||
<PageTitle>پاداشهای من</PageTitle>
|
||||
|
||||
<MudContainer MaxWidth="MaxWidth.Large" Class="py-6">
|
||||
<MudStack Spacing="3">
|
||||
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
||||
<MudText Typo="Typo.h5">داشبورد کمیسیون</MudText>
|
||||
<MudText Typo="Typo.h5">پاداشهای من</MudText>
|
||||
<MudButton Variant="Variant.Text" StartIcon="@Icons.Material.Filled.ArrowBack" Href="@RouteConstants.Profile.Index">بازگشت</MudButton>
|
||||
</MudStack>
|
||||
|
||||
@if (_isLoading)
|
||||
{
|
||||
<MudProgressLinear Color="Color.Primary" Indeterminate="true" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<!-- فیلترها -->
|
||||
<MudPaper Elevation="2" Class="pa-3 rounded-lg">
|
||||
<MudStack Row="true" Spacing="2" AlignItems="AlignItems.End">
|
||||
<MudNumericField @bind-Value="_filterWeekNumber"
|
||||
Label="شماره هفته"
|
||||
Variant="Variant.Outlined"
|
||||
Min="1"
|
||||
Clearable="true"
|
||||
Style="max-width: 150px;" />
|
||||
<MudSelect T="string" @bind-Value="_filterStatus" Label="وضعیت" Variant="Variant.Outlined" Style="max-width: 200px;">
|
||||
<!-- فیلترها -->
|
||||
<MudPaper Elevation="2" Class="pa-3 rounded-lg">
|
||||
<MudGrid Spacing="2">
|
||||
<MudItem xs="12" sm="6" md="4">
|
||||
<WeekSelector @ref="_weekSelector"
|
||||
@bind-Value="_selectedWeekDefinition"
|
||||
Label="انتخاب هفته"
|
||||
Placeholder="جستجوی هفته..."
|
||||
Variant="Variant.Outlined"
|
||||
Dense="false"
|
||||
Clearable="true"
|
||||
OnlyActive="false" />
|
||||
</MudItem>
|
||||
<MudItem xs="12" sm="6" md="4">
|
||||
<MudSelect T="string" @bind-Value="_filterStatus" Label="وضعیت" Variant="Variant.Outlined">
|
||||
<MudSelectItem T="string" Value="@string.Empty">همه</MudSelectItem>
|
||||
<MudSelectItem T="string" Value="@("Pending")">در انتظار</MudSelectItem>
|
||||
<MudSelectItem T="string" Value="@("Paid")">پرداخت شده</MudSelectItem>
|
||||
@@ -35,78 +36,114 @@
|
||||
<MudSelectItem T="string" Value="@("PaymentFailed")">شکست خورده</MudSelectItem>
|
||||
<MudSelectItem T="string" Value="@("Cancelled")">لغو شده</MudSelectItem>
|
||||
</MudSelect>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="ApplyFiltersAsync" StartIcon="@Icons.Material.Filled.FilterList">
|
||||
اعمال فیلتر
|
||||
</MudButton>
|
||||
<MudButton Variant="Variant.Outlined" OnClick="ClearFiltersAsync" StartIcon="@Icons.Material.Filled.Clear">
|
||||
پاک کردن
|
||||
</MudButton>
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
<MudItem xs="12" sm="12" md="4">
|
||||
<MudStack Row="true" Spacing="2" Style="height: 100%;" AlignItems="AlignItems.End">
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="ApplyFiltersAsync" StartIcon="@Icons.Material.Filled.FilterList" FullWidth="true">
|
||||
اعمال فیلتر
|
||||
</MudButton>
|
||||
<MudButton Variant="Variant.Outlined" OnClick="ClearFiltersAsync" StartIcon="@Icons.Material.Filled.Clear" FullWidth="true">
|
||||
پاک کردن
|
||||
</MudButton>
|
||||
</MudStack>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudPaper>
|
||||
|
||||
<!-- لیست کمیسیونها -->
|
||||
@if (_isLoading)
|
||||
{
|
||||
<MudProgressLinear Color="Color.Primary" Indeterminate="true" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<!-- آمار خلاصه -->
|
||||
@if (_payouts.Any())
|
||||
{
|
||||
<MudHidden Breakpoint="Breakpoint.MdAndUp" Invert="true">
|
||||
<MudTable Items="_payouts" Hover="true" Striped="true" Dense="true">
|
||||
<HeaderContent>
|
||||
<MudTh>هفته</MudTh>
|
||||
<MudTh>تعداد تعادل</MudTh>
|
||||
<MudTh>مبلغ کل</MudTh>
|
||||
<MudTh>وضعیت</MudTh>
|
||||
<MudTh>تاریخ</MudTh>
|
||||
<MudTh>عملیات</MudTh>
|
||||
</HeaderContent>
|
||||
<RowTemplate>
|
||||
<MudTd>
|
||||
<MudChip T="string" Color="Color.Default" Size="Size.Small">@context.WeekDisplayName</MudChip>
|
||||
</MudTd>
|
||||
<MudTd>@context.BalancesEarned</MudTd>
|
||||
<MudTd>
|
||||
<MudText Color="Color.Success"><strong>@context.AmountFormatted</strong></MudText>
|
||||
</MudTd>
|
||||
<MudTd>
|
||||
<MudChip T="string" Color="@GetStatusColor(context.StatusColor)" Size="Size.Small" Variant="Variant.Outlined">
|
||||
@context.StatusText
|
||||
</MudChip>
|
||||
</MudTd>
|
||||
<MudTd>@context.DatePersian</MudTd>
|
||||
<MudTd>
|
||||
<MudButton Size="Size.Small"
|
||||
Variant="Variant.Text"
|
||||
Color="Color.Info"
|
||||
StartIcon="@Icons.Material.Filled.Info"
|
||||
Href="@($"{RouteConstants.Commission.WeeklyBalance}?week={context.WeekDefinitionId}")">
|
||||
جزئیات
|
||||
</MudButton>
|
||||
</MudTd>
|
||||
</RowTemplate>
|
||||
</MudTable>
|
||||
<MudGrid Spacing="2">
|
||||
<MudItem xs="6" sm="4">
|
||||
<MudPaper Elevation="2" Class="pa-3 rounded-lg text-center">
|
||||
<MudText Typo="Typo.caption" Class="mud-text-secondary">کل پاداش</MudText>
|
||||
<MudText Typo="Typo.h6" Color="Color.Success">@GetTotalEarnings()</MudText>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
<MudItem xs="6" sm="4">
|
||||
<MudPaper Elevation="2" Class="pa-3 rounded-lg text-center">
|
||||
<MudText Typo="Typo.caption" Class="mud-text-secondary">تعداد</MudText>
|
||||
<MudText Typo="Typo.h6" Color="Color.Primary">@_totalCount</MudText>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
<MudItem xs="12" sm="4">
|
||||
<MudPaper Elevation="2" Class="pa-3 rounded-lg text-center">
|
||||
<MudText Typo="Typo.caption" Class="mud-text-secondary">میانگین هفتگی</MudText>
|
||||
<MudText Typo="Typo.h6" Color="Color.Info">@GetAverageWeekly()</MudText>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
}
|
||||
|
||||
<!-- لیست پاداشها -->
|
||||
@if (_payouts.Any())
|
||||
{
|
||||
<!-- جدول - دسکتاپ -->
|
||||
<MudHidden Breakpoint="Breakpoint.SmAndDown">
|
||||
<MudPaper Elevation="2" Class="pa-0 rounded-lg">
|
||||
<MudTable Items="_payouts" Hover="true" Striped="true" Dense="true" FixedHeader="true" Height="400px">
|
||||
<HeaderContent>
|
||||
<MudTh>هفته</MudTh>
|
||||
<MudTh>امتیاز</MudTh>
|
||||
<MudTh>مبلغ (تومان)</MudTh>
|
||||
<MudTh>وضعیت</MudTh>
|
||||
<MudTh>تاریخ</MudTh>
|
||||
<MudTh>جزئیات</MudTh>
|
||||
</HeaderContent>
|
||||
<RowTemplate>
|
||||
<MudTd DataLabel="هفته">
|
||||
<MudChip T="string" Color="Color.Primary" Size="Size.Small" Variant="Variant.Outlined">@context.WeekDisplayName</MudChip>
|
||||
</MudTd>
|
||||
<MudTd DataLabel="امتیاز">@context.BalancesEarned</MudTd>
|
||||
<MudTd DataLabel="مبلغ">
|
||||
<MudText Color="Color.Success"><strong>@context.AmountFormatted</strong></MudText>
|
||||
</MudTd>
|
||||
<MudTd DataLabel="وضعیت">
|
||||
<MudChip T="string" Color="@GetStatusColor(context.StatusColor)" Size="Size.Small">@context.StatusText</MudChip>
|
||||
</MudTd>
|
||||
<MudTd DataLabel="تاریخ">@context.DatePersian</MudTd>
|
||||
<MudTd DataLabel="جزئیات">
|
||||
<MudIconButton Size="Size.Small"
|
||||
Icon="@Icons.Material.Filled.Visibility"
|
||||
Color="Color.Info"
|
||||
Href="@($"{RouteConstants.Commission.WeeklyBalance}?week={context.WeekDefinitionId}")" />
|
||||
</MudTd>
|
||||
</RowTemplate>
|
||||
</MudTable>
|
||||
</MudPaper>
|
||||
</MudHidden>
|
||||
|
||||
<MudHidden Breakpoint="Breakpoint.MdAndUp">
|
||||
<!-- کارتها - موبایل -->
|
||||
<MudHidden Breakpoint="Breakpoint.SmAndDown" Invert="true">
|
||||
<MudStack Spacing="2">
|
||||
@foreach (var payout in _payouts)
|
||||
{
|
||||
<MudPaper Class="pa-3 rounded-lg" Outlined="true">
|
||||
<MudStack Spacing="1">
|
||||
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
||||
<MudChip T="string" Color="Color.Default" Size="Size.Small">@payout.WeekDisplayName</MudChip>
|
||||
<MudChip T="string" Color="@GetStatusColor(payout.StatusColor)" Size="Size.Small" Variant="Variant.Outlined">
|
||||
@payout.StatusText
|
||||
</MudChip>
|
||||
<MudChip T="string" Color="Color.Primary" Size="Size.Small" Variant="Variant.Outlined">@payout.WeekDisplayName</MudChip>
|
||||
<MudChip T="string" Color="@GetStatusColor(payout.StatusColor)" Size="Size.Small">@payout.StatusText</MudChip>
|
||||
</MudStack>
|
||||
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
||||
<MudText Typo="Typo.h6" Color="Color.Success">@payout.AmountFormatted</MudText>
|
||||
<MudText Typo="Typo.caption" Class="mud-text-secondary">امتیاز: @payout.BalancesEarned</MudText>
|
||||
</MudStack>
|
||||
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
||||
<MudText Typo="Typo.caption" Class="mud-text-secondary">@payout.DatePersian</MudText>
|
||||
<MudButton Size="Size.Small"
|
||||
Variant="Variant.Text"
|
||||
Color="Color.Info"
|
||||
EndIcon="@Icons.Material.Filled.ChevronLeft"
|
||||
Href="@($"{RouteConstants.Commission.WeeklyBalance}?week={payout.WeekDefinitionId}")">
|
||||
جزئیات
|
||||
</MudButton>
|
||||
</MudStack>
|
||||
<MudText Typo="Typo.h6" Color="Color.Success">@payout.AmountFormatted</MudText>
|
||||
<MudText Typo="Typo.caption" Class="mud-text-secondary">تعداد تعادل: @payout.BalancesEarned</MudText>
|
||||
<MudText Typo="Typo.caption" Class="mud-text-secondary">@payout.DatePersian</MudText>
|
||||
<MudButton Size="Size.Small"
|
||||
Variant="Variant.Outlined"
|
||||
Color="Color.Info"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Filled.Info"
|
||||
Href="@($"{RouteConstants.Commission.WeeklyBalance}?week={payout.WeekDefinitionId}")">
|
||||
مشاهده جزئیات هفته
|
||||
</MudButton>
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
}
|
||||
@@ -114,37 +151,27 @@
|
||||
</MudHidden>
|
||||
|
||||
<!-- Pagination -->
|
||||
<MudPaper Elevation="0" Class="pa-3">
|
||||
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
||||
<MudText Typo="Typo.body2">کل: @_totalCount کمیسیون</MudText>
|
||||
<MudPagination Count="@GetTotalPages()" Selected="_pageNumber" SelectedChanged="OnPageChangedAsync" Color="Color.Primary" />
|
||||
<MudPaper Elevation="0" Class="pa-2">
|
||||
<MudStack Row="true" Justify="Justify.Center" AlignItems="AlignItems.Center">
|
||||
<MudPagination Count="@GetTotalPages()" Selected="_pageNumber" SelectedChanged="OnPageChangedAsync" Color="Color.Primary" Size="Size.Small" />
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudAlert Severity="Severity.Info" Variant="Variant.Outlined">
|
||||
کمیسیونی برای نمایش وجود ندارد.
|
||||
پاداشی برای نمایش وجود ندارد.
|
||||
</MudAlert>
|
||||
}
|
||||
|
||||
<!-- دکمههای بیشتر -->
|
||||
<MudStack Row="true" Spacing="2">
|
||||
<MudButton Variant="Variant.Outlined"
|
||||
Color="Color.Secondary"
|
||||
StartIcon="@Icons.Material.Filled.History"
|
||||
Href="@RouteConstants.Commission.History"
|
||||
FullWidth="true">
|
||||
تاریخچه کامل
|
||||
</MudButton>
|
||||
<MudButton Variant="Variant.Outlined"
|
||||
Color="Color.Info"
|
||||
StartIcon="@Icons.Material.Filled.BarChart"
|
||||
Href="@RouteConstants.Commission.WeeklyBalance"
|
||||
FullWidth="true">
|
||||
تعادل هفتگی
|
||||
</MudButton>
|
||||
</MudStack>
|
||||
<!-- دکمه گزارش هفتگی -->
|
||||
<MudButton Variant="Variant.Outlined"
|
||||
Color="Color.Info"
|
||||
StartIcon="@Icons.Material.Filled.BarChart"
|
||||
Href="@RouteConstants.Commission.WeeklyBalance"
|
||||
FullWidth="true">
|
||||
مشاهده گزارش هفتگی
|
||||
</MudButton>
|
||||
}
|
||||
</MudStack>
|
||||
</MudContainer>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using FrontOffice.Main.Shared;
|
||||
using FrontOffice.Main.Utilities;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
@@ -10,11 +11,13 @@ public partial class CommissionDashboardPage : ComponentBase
|
||||
|
||||
private List<CommissionPayoutDto> _payouts = new();
|
||||
private int _totalCount;
|
||||
private long _totalAmount;
|
||||
private int _pageNumber = 1;
|
||||
private int _pageSize = 10;
|
||||
private bool _isLoading = true;
|
||||
|
||||
private int? _filterWeekNumber;
|
||||
private WeekSelector? _weekSelector;
|
||||
private WeekDefinitionDto? _selectedWeekDefinition;
|
||||
private string _filterStatus = string.Empty;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
@@ -27,18 +30,20 @@ public partial class CommissionDashboardPage : ComponentBase
|
||||
try
|
||||
{
|
||||
_isLoading = true;
|
||||
var weekDefinitionId = _selectedWeekDefinition?.Id;
|
||||
var result = await CommissionService.GetMyCommissionPayoutsAsync(
|
||||
_filterWeekNumber,
|
||||
weekDefinitionId,
|
||||
_filterStatus,
|
||||
_pageNumber,
|
||||
_pageSize
|
||||
);
|
||||
_payouts = result.Payouts;
|
||||
_totalCount = result.TotalCount;
|
||||
_totalAmount = _payouts.Sum(p => p.TotalAmount);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Snackbar.Add($"خطا در دریافت کمیسیونها: {ex.Message}", Severity.Error);
|
||||
Snackbar.Add($"خطا در دریافت پاداشها: {ex.Message}", Severity.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -54,7 +59,7 @@ public partial class CommissionDashboardPage : ComponentBase
|
||||
|
||||
private async Task ClearFiltersAsync()
|
||||
{
|
||||
_filterWeekNumber = null;
|
||||
_selectedWeekDefinition = null;
|
||||
_filterStatus = string.Empty;
|
||||
_pageNumber = 1;
|
||||
await LoadPayoutsAsync();
|
||||
@@ -73,6 +78,19 @@ public partial class CommissionDashboardPage : ComponentBase
|
||||
return (int)Math.Ceiling(_totalCount / (double)_pageSize);
|
||||
}
|
||||
|
||||
private string GetTotalEarnings()
|
||||
{
|
||||
return $"{_totalAmount:N0} تومان";
|
||||
}
|
||||
|
||||
private string GetAverageWeekly()
|
||||
{
|
||||
if (_totalCount == 0)
|
||||
return "0 تومان";
|
||||
var avg = _totalAmount / _totalCount;
|
||||
return $"{avg:N0} تومان";
|
||||
}
|
||||
|
||||
private Color GetStatusColor(string statusColor) => statusColor.ToLower() switch
|
||||
{
|
||||
"success" => Color.Success,
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
@attribute [Route(RouteConstants.Commission.History)]
|
||||
@using FrontOffice.Main.Utilities
|
||||
@using MudBlazor
|
||||
|
||||
<PageTitle>تاریخچه کمیسیون</PageTitle>
|
||||
|
||||
<MudContainer MaxWidth="MaxWidth.ExtraLarge" Class="py-6">
|
||||
<MudStack Spacing="3">
|
||||
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
||||
<MudText Typo="Typo.h5">تاریخچه کامل کمیسیون</MudText>
|
||||
<MudButton Variant="Variant.Text" StartIcon="@Icons.Material.Filled.ArrowBack" Href="@RouteConstants.Commission.Dashboard">بازگشت</MudButton>
|
||||
</MudStack>
|
||||
|
||||
@if (_isLoading)
|
||||
{
|
||||
<MudProgressLinear Color="Color.Primary" Indeterminate="true" />
|
||||
}
|
||||
else if (_payouts.Any())
|
||||
{
|
||||
<!-- آمار خلاصه -->
|
||||
<MudGrid Spacing="2">
|
||||
<MudItem xs="12" sm="4">
|
||||
<MudPaper Elevation="2" Class="pa-4 rounded-lg">
|
||||
<MudText Typo="Typo.subtitle2" Class="mud-text-secondary">کل کمیسیون دریافتی</MudText>
|
||||
<MudText Typo="Typo.h5" Color="Color.Success">@GetTotalEarnings()</MudText>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
<MudItem xs="12" sm="4">
|
||||
<MudPaper Elevation="2" Class="pa-4 rounded-lg">
|
||||
<MudText Typo="Typo.subtitle2" Class="mud-text-secondary">تعداد هفتهها</MudText>
|
||||
<MudText Typo="Typo.h5" Color="Color.Primary">@_payouts.Count</MudText>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
<MudItem xs="12" sm="4">
|
||||
<MudPaper Elevation="2" Class="pa-4 rounded-lg">
|
||||
<MudText Typo="Typo.subtitle2" Class="mud-text-secondary">میانگین هفتگی</MudText>
|
||||
<MudText Typo="Typo.h5" Color="Color.Info">@GetAverageWeekly()</MudText>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
|
||||
<!-- جدول کامل -->
|
||||
<MudPaper Elevation="2" Class="pa-0 rounded-lg">
|
||||
<MudTable Items="_payouts" Hover="true" Striped="true" Dense="false" FixedHeader="true" Height="600px">
|
||||
<HeaderContent>
|
||||
<MudTh>هفته</MudTh>
|
||||
<MudTh>تعادلها</MudTh>
|
||||
<MudTh>مبلغ (تومان)</MudTh>
|
||||
<MudTh>وضعیت</MudTh>
|
||||
<MudTh>تاریخ</MudTh>
|
||||
<MudTh>جزئیات</MudTh>
|
||||
</HeaderContent>
|
||||
<RowTemplate>
|
||||
<MudTd DataLabel="هفته">
|
||||
<MudChip T="string" Color="Color.Primary" Size="Size.Small" Variant="Variant.Outlined">@context.WeekDisplayName</MudChip>
|
||||
</MudTd>
|
||||
<MudTd DataLabel="تعادلها">
|
||||
<MudText>@context.BalancesEarned</MudText>
|
||||
</MudTd>
|
||||
<MudTd DataLabel="مبلغ">
|
||||
<MudText Color="Color.Success" Typo="Typo.body1"><strong>@context.AmountFormatted</strong></MudText>
|
||||
</MudTd>
|
||||
<MudTd DataLabel="وضعیت">
|
||||
<MudChip T="string" Color="@GetStatusColor(context.StatusColor)" Size="Size.Small">
|
||||
@context.StatusText
|
||||
</MudChip>
|
||||
</MudTd>
|
||||
<MudTd DataLabel="تاریخ">
|
||||
<MudText Typo="Typo.caption">@context.DatePersian</MudText>
|
||||
</MudTd>
|
||||
<MudTd DataLabel="جزئیات">
|
||||
<MudButton Size="Size.Small"
|
||||
Variant="Variant.Text"
|
||||
Color="Color.Info"
|
||||
StartIcon="@Icons.Material.Filled.Visibility"
|
||||
Href="@($"{RouteConstants.Commission.WeeklyBalance}?week={context.WeekDefinitionId}")">
|
||||
مشاهده
|
||||
</MudButton>
|
||||
</MudTd>
|
||||
</RowTemplate>
|
||||
</MudTable>
|
||||
</MudPaper>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudAlert Severity="Severity.Info" Variant="Variant.Filled">
|
||||
هنوز کمیسیونی دریافت نکردهاید.
|
||||
</MudAlert>
|
||||
}
|
||||
</MudStack>
|
||||
</MudContainer>
|
||||
@@ -1,65 +0,0 @@
|
||||
using FrontOffice.Main.Utilities;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MudBlazor;
|
||||
|
||||
namespace FrontOffice.Main.Pages.Commission;
|
||||
|
||||
public partial class CommissionHistoryPage : ComponentBase
|
||||
{
|
||||
[Inject] private CommissionService CommissionService { get; set; } = default!;
|
||||
|
||||
private List<CommissionPayoutDto> _payouts = new();
|
||||
private bool _isLoading = true;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await LoadAllPayoutsAsync();
|
||||
}
|
||||
|
||||
private async Task LoadAllPayoutsAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
_isLoading = true;
|
||||
// Load all payouts (large page size to get everything)
|
||||
var result = await CommissionService.GetMyCommissionPayoutsAsync(
|
||||
null,
|
||||
string.Empty,
|
||||
1,
|
||||
1000
|
||||
);
|
||||
_payouts = result.Payouts;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Snackbar.Add($"خطا در دریافت تاریخچه: {ex.Message}", Severity.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
private string GetTotalEarnings()
|
||||
{
|
||||
var total = _payouts.Sum(p => p.TotalAmount);
|
||||
return $"{total:N0} تومان";
|
||||
}
|
||||
|
||||
private string GetAverageWeekly()
|
||||
{
|
||||
if (!_payouts.Any())
|
||||
return "0 تومان";
|
||||
var avg = _payouts.Average(p => p.TotalAmount);
|
||||
return $"{avg:N0} تومان";
|
||||
}
|
||||
|
||||
private Color GetStatusColor(string statusColor) => statusColor.ToLower() switch
|
||||
{
|
||||
"success" => Color.Success,
|
||||
"warning" => Color.Warning,
|
||||
"error" => Color.Error,
|
||||
"info" => Color.Info,
|
||||
_ => Color.Default
|
||||
};
|
||||
}
|
||||
@@ -3,12 +3,12 @@
|
||||
@using FrontOffice.Main.Shared
|
||||
@using MudBlazor
|
||||
|
||||
<PageTitle>تعادل هفتگی</PageTitle>
|
||||
<PageTitle>گزارش هفتگی</PageTitle>
|
||||
|
||||
<MudContainer MaxWidth="MaxWidth.Large" Class="py-6">
|
||||
<MudStack Spacing="3">
|
||||
<MudStack Row="true" Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center">
|
||||
<MudText Typo="Typo.h5">تعادل هفتگی کمیسیون</MudText>
|
||||
<MudText Typo="Typo.h5">گزارش هفتگی پاداش</MudText>
|
||||
<MudButton Variant="Variant.Text" StartIcon="@Icons.Material.Filled.ArrowBack" Href="@RouteConstants.Commission.Dashboard">بازگشت</MudButton>
|
||||
</MudStack>
|
||||
|
||||
@@ -72,19 +72,37 @@
|
||||
</MudGrid>
|
||||
</MudPaper>
|
||||
|
||||
<!-- تعادل چپ و راست - کارتهای بزرگ -->
|
||||
<!-- امتیاز فروش تیم اول و دوم - کارتهای بزرگ -->
|
||||
<MudGrid Spacing="2">
|
||||
|
||||
<MudItem xs="6">
|
||||
<MudPaper Elevation="3" Class="pa-4 rounded-lg text-center" Style="background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);">
|
||||
<MudStack Spacing="1" AlignItems="AlignItems.Center">
|
||||
<MudIcon Icon="@Icons.Material.Filled.ChevronRight" Color="Color.Success" Size="Size.Large" />
|
||||
<MudText Typo="Typo.subtitle2" Color="Color.Success">تیم دوم</MudText>
|
||||
<MudText Typo="Typo.h5" Color="Color.Success" Style="font-weight: bold;">@_weeklyBalance.RightBalanceFormatted</MudText>
|
||||
<MudProgressLinear Color="Color.Success"
|
||||
Value="@GetRightPercentage()"
|
||||
Size="Size.Medium"
|
||||
Class="rounded-lg mt-2"
|
||||
Style="width: 100%;" />
|
||||
<MudText Typo="Typo.caption" Class="mud-text-secondary">
|
||||
@GetRightPercentage().ToString("F1")% از کل
|
||||
</MudText>
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
<MudItem xs="6">
|
||||
<MudPaper Elevation="3" Class="pa-4 rounded-lg text-center" Style="background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);">
|
||||
<MudStack Spacing="1" AlignItems="AlignItems.Center">
|
||||
<MudIcon Icon="@Icons.Material.Filled.ChevronLeft" Color="Color.Info" Size="Size.Large" />
|
||||
<MudText Typo="Typo.subtitle2" Color="Color.Info">شاخه چپ</MudText>
|
||||
<MudIcon Icon="@Icons.Material.Filled.ChevronLeft" Color="Color.Info" Size="Size.Large"/>
|
||||
<MudText Typo="Typo.subtitle2" Color="Color.Info">تیم اول</MudText>
|
||||
<MudText Typo="Typo.h5" Color="Color.Info" Style="font-weight: bold;">@_weeklyBalance.LeftBalanceFormatted</MudText>
|
||||
<MudProgressLinear Color="Color.Info"
|
||||
Value="@GetLeftPercentage()"
|
||||
Size="Size.Medium"
|
||||
Class="rounded-lg mt-2"
|
||||
Style="width: 100%;" />
|
||||
<MudProgressLinear Color="Color.Info"
|
||||
Value="@GetLeftPercentage()"
|
||||
Size="Size.Medium"
|
||||
Class="rounded-lg mt-2"
|
||||
Style="width: 100%;"/>
|
||||
<MudText Typo="Typo.caption" Class="mud-text-secondary">
|
||||
@GetLeftPercentage().ToString("F1")% از کل
|
||||
</MudText>
|
||||
@@ -92,54 +110,37 @@
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
|
||||
<MudItem xs="6">
|
||||
<MudPaper Elevation="3" Class="pa-4 rounded-lg text-center" Style="background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);">
|
||||
<MudStack Spacing="1" AlignItems="AlignItems.Center">
|
||||
<MudIcon Icon="@Icons.Material.Filled.ChevronRight" Color="Color.Success" Size="Size.Large" />
|
||||
<MudText Typo="Typo.subtitle2" Color="Color.Success">شاخه راست</MudText>
|
||||
<MudText Typo="Typo.h5" Color="Color.Success" Style="font-weight: bold;">@_weeklyBalance.RightBalanceFormatted</MudText>
|
||||
<MudProgressLinear Color="Color.Success"
|
||||
Value="@GetRightPercentage()"
|
||||
Size="Size.Medium"
|
||||
Class="rounded-lg mt-2"
|
||||
Style="width: 100%;" />
|
||||
<MudText Typo="Typo.caption" Class="mud-text-secondary">
|
||||
@GetRightPercentage().ToString("F1")% از کل
|
||||
</MudText>
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
|
||||
<!-- محاسبات کمیسیون - فشردهتر -->
|
||||
<!-- محاسبات پاداش - فشردهتر -->
|
||||
<MudPaper Elevation="2" Class="pa-4 rounded-lg">
|
||||
<MudText Typo="Typo.subtitle1" Class="mb-2" Style="font-weight: bold;">محاسبات کمیسیون</MudText>
|
||||
<MudText Typo="Typo.subtitle1" Class="mb-2" Style="font-weight: bold;">محاسبات پاداش</MudText>
|
||||
<MudSimpleTable Dense="true" Hover="true" Style="background: transparent;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><MudText Typo="Typo.body2">اعضای جدید چپ:</MudText></td>
|
||||
<td><MudText Typo="Typo.body2">اعضای جدید تیم اول:</MudText></td>
|
||||
<td class="text-end"><MudText Typo="Typo.body1" Color="Color.Info"><strong>@_weeklyBalance.LeftNewMembersFormatted</strong></MudText></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><MudText Typo="Typo.body2">اعضای جدید راست:</MudText></td>
|
||||
<td><MudText Typo="Typo.body2">اعضای جدید تیم دوم:</MudText></td>
|
||||
<td class="text-end"><MudText Typo="Typo.body1" Color="Color.Success"><strong>@_weeklyBalance.RightNewMembersFormatted</strong></MudText></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><MudText Typo="Typo.body2">انتقال از هفته قبل (چپ):</MudText></td>
|
||||
<td><MudText Typo="Typo.body2">انتقال از هفته قبل (تیم اول):</MudText></td>
|
||||
<td class="text-end"><MudText Typo="Typo.body1" Color="Color.Info"><strong>@_weeklyBalance.LeftCarryoverFormatted</strong></MudText></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><MudText Typo="Typo.body2">انتقال از هفته قبل (راست):</MudText></td>
|
||||
<td><MudText Typo="Typo.body2">انتقال از هفته قبل (تیم دوم):</MudText></td>
|
||||
<td class="text-end"><MudText Typo="Typo.body1" Color="Color.Success"><strong>@_weeklyBalance.RightCarryoverFormatted</strong></MudText></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><MudText Typo="Typo.body2">حداقل تعادل (پایه کمیسیون):</MudText></td>
|
||||
<td class="text-end"><MudText Typo="Typo.body1" Color="Color.Warning"><strong>@_weeklyBalance.MinBalanceFormatted</strong></MudText></td>
|
||||
</tr>
|
||||
<tr style="background-color: var(--mud-palette-primary-lighten);">
|
||||
<td><MudText Typo="Typo.subtitle1"><strong>کمیسیون محاسبه شده:</strong></MudText></td>
|
||||
<td class="text-end"><MudText Typo="Typo.h6" Color="Color.Primary"><strong>@_weeklyBalance.CalculatedCommissionFormatted</strong></MudText></td>
|
||||
<td><MudText Typo="Typo.body2" Color="Color.Error"> امتیاز فروش کل (پایه):</MudText></td>
|
||||
<td class="text-end"><MudText Typo="Typo.body1" Color="Color.Error"><strong>@_weeklyBalance.MinBalanceFormatted</strong></MudText></td>
|
||||
</tr>
|
||||
@* <tr style="background-color: var(--mud-palette-primary-lighten);"> *@
|
||||
@* <td><MudText Typo="Typo.subtitle1"><strong>کمیسیون محاسبه شده:</strong></MudText></td> *@
|
||||
@* <td class="text-end"><MudText Typo="Typo.h6" Color="Color.Primary"><strong>@_weeklyBalance.CalculatedCommissionFormatted</strong></MudText></td> *@
|
||||
@* </tr> *@
|
||||
</tbody>
|
||||
</MudSimpleTable>
|
||||
</MudPaper>
|
||||
|
||||
Reference in New Issue
Block a user