Files
FrontOffice/src/FrontOffice.Main/Pages/Profile/MagicWallet.razor
T
masoodafar-web d8289237e9
Build and Deploy to Kubernetes / build-and-deploy (push) Successful in 5m46s
fix: update terminology for sales organization and rewards
Replaced instances of "شجره‌نامه" with "سازمان فروش" across multiple files to ensure consistent terminology. Additionally, updated references to "پاداش تیمی" to "پاداش های دریافتی" for clarity in user-facing text.

Affected files:
- FAQ.razor.cs
- Index.razor
- Index.razor.cs
- Profile/Index.razor
- Profile/Index.razor.cs
- Profile/MagicWallet.razor
- Profile/Tree.razor
- Profile/Wallet.razor
- Utilities/WalletService.cs
2026-05-29 19:58:48 +03:30

215 lines
13 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@attribute [Route(RouteConstants.Profile.MagicWallet)]
@attribute [Authorize]
<PageTitle>کیف‌پول جادویی</PageTitle>
<MudContainer MaxWidth="MaxWidth.Medium" Class="py-6">
<MudStack Spacing="3">
<PageHeader Title="🪄 کیف‌پول جادویی" BackHref="@RouteConstants.Profile.Wallet" />
@if (_isLoading)
{
<MudPaper Elevation="2" Class="pa-6 rounded-lg text-center">
<MudProgressCircular Color="Color.Primary" Indeterminate="true" />
<MudText Class="mt-3">در حال بارگذاری...</MudText>
</MudPaper>
}
else if (_status.WalletMode != 1)
{
@* ═══ حالت عادی — Magic فعال نیست ═══ *@
<MudPaper Elevation="2" Class="pa-6 rounded-lg text-center">
<MudIcon Icon="@Icons.Material.Filled.Lock" Color="Color.Default" Size="Size.Large" Style="font-size: 64px;" />
<MudText Typo="Typo.h5" Class="mt-4">کیف‌پول جادویی فعال نیست</MudText>
<MudText Typo="Typo.body1" Class="mt-2 mud-text-secondary">
برای فعال شدن کیف‌پول جادویی، ابتدا پکیج پایه را خریداری کنید و سپس
تمام موجودی اصلی خود را از فروشگاه خرج کنید. وقتی موجودی اصلی به صفر برسد،
کیف‌پول جادویی فعال می‌شود.
</MudText>
<MudButton Variant="Variant.Filled" Color="Color.Primary" Class="mt-4 rounded-pill"
Href="@RouteConstants.Profile.Wallet"
StartIcon="@Icons.Material.Filled.AccountBalanceWallet">
بازگشت به کیف پول
</MudButton>
</MudPaper>
}
else
{
@* ═══ حالت جادویی فعال ═══ *@
@* ── G4: هشدار تنظیمات پکیج‌بیس (Q28) ── *@
<MudAlert Severity="Severity.Warning" Variant="Variant.Text" Dense="true" Icon="@Icons.Material.Filled.Warning">
سقف واریز و ضریب اعتبار کیف‌پول جادویی بر اساس پکیج شما تنظیم شده است. پکیج‌های بالاتر سقف و ضریب بیشتری دارند.
</MudAlert>
@* ─── وضعیت و پیشرفت ─── *@
<MudPaper Elevation="2" Class="pa-5 rounded-xl" Style="background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%); color: white;">
<MudStack Spacing="2">
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
<MudIcon Icon="@Icons.Material.Filled.AutoAwesome" Size="Size.Large" />
<MudText Typo="Typo.h5">حالت جادویی فعال</MudText>
</MudStack>
<MudGrid Spacing="2">
<MudItem xs="6" sm="3">
<MudText Typo="Typo.caption" Style="opacity:0.8">موجودی فعلی</MudText>
<MudText Typo="Typo.h6">@FormatPrice(_status.Balance)</MudText>
</MudItem>
<MudItem xs="6" sm="3">
<MudText Typo="Typo.caption" Style="opacity:0.8">مجموع واریزی</MudText>
<MudText Typo="Typo.h6">@FormatPrice(_status.MagicTotalDeposited)</MudText>
</MudItem>
<MudItem xs="6" sm="3">
<MudText Typo="Typo.caption" Style="opacity:0.8">مجموع اعتبار</MudText>
<MudText Typo="Typo.h6">@FormatPrice(_status.MagicTotalCredited)</MudText>
</MudItem>
<MudItem xs="6" sm="3">
<MudText Typo="Typo.caption" Style="opacity:0.8">سقف باقیمانده</MudText>
<MudText Typo="Typo.h6">@FormatPrice(_status.MagicRemainingDeposit)</MudText>
</MudItem>
</MudGrid>
@* نوار پیشرفت *@
<MudStack Spacing="0" Class="mt-1">
<MudStack Row="true" Justify="Justify.SpaceBetween">
<MudText Typo="Typo.caption" Style="opacity:0.8">پیشرفت سقف واریز</MudText>
<MudText Typo="Typo.caption" Style="opacity:0.8">@(_progressPercent.ToString("0"))%</MudText>
</MudStack>
<MudProgressLinear Value="@_progressPercent" Color="Color.Warning" Size="Size.Medium"
Rounded="true" Class="mt-1" Style="background: rgba(255,255,255,0.3);" />
</MudStack>
@if (_status.MagicActivatedAt.HasValue)
{
<MudText Typo="Typo.caption" Style="opacity:0.7">
فعال از: @_status.MagicActivatedAt.Value.MiladiToJalaliWithTime()
</MudText>
}
</MudStack>
</MudPaper>
@* ─── فرم شارژ ─── *@
@if (_status.MagicRemainingDeposit > 0)
{
<MudPaper Elevation="2" Class="pa-5 rounded-lg">
<MudText Typo="Typo.h6" Class="mb-3">
<MudIcon Icon="@Icons.Material.Filled.CreditCard" Class="ml-1" />
شارژ کیف‌پول جادویی
</MudText>
<MudAlert Severity="MudBlazor.Severity.Info" Dense="true" Class="mb-3" Icon="@Icons.Material.Filled.Info">
مبلغ واریزی شما <strong>×@_status.MagicMultiplier.ToString("0.#")</strong> به موجودی اضافه می‌شود.
مثلاً ۱۰ میلیون واریز = @FormatToman((long)(10_000_000 * (decimal)_status.MagicMultiplier)) اعتبار.
</MudAlert>
<MudStack Spacing="2">
<MudNumericField @bind-Value="_chargeAmount"
Label="مبلغ واریز (تومان)"
Variant="Variant.Outlined"
Min="10_000"
Max="@_status.MagicRemainingDeposit"
Format="N0"
Adornment="Adornment.Start"
AdornmentIcon="@Icons.Material.Filled.Payments"
HelperText="@($"حداکثر: {FormatPrice(_status.MagicRemainingDeposit)} (تومان)")" />
@if (_chargeAmount > 0)
{
<MudPaper Outlined="true" Class="pa-3 rounded-lg" Style="background: #f0fdf4;">
<MudStack Row="true" Justify="Justify.SpaceBetween">
<MudText Typo="Typo.body2">مبلغ واریز:</MudText>
<MudText Typo="Typo.body2">@FormatToman(_chargeAmount)</MudText>
</MudStack>
<MudStack Row="true" Justify="Justify.SpaceBetween">
<MudText Typo="Typo.body2" Color="Color.Success"><strong>اعتبار دریافتی (×@_status.MagicMultiplier.ToString("0.#")):</strong></MudText>
<MudText Typo="Typo.body2" Color="Color.Success"><strong>@FormatToman((long)(_chargeAmount * (decimal)_status.MagicMultiplier))</strong></MudText>
</MudStack>
</MudPaper>
}
@* دکمه‌های مبلغ سریع *@
<MudStack Row="true" Spacing="1" Class="flex-wrap">
@foreach (var preset in _presetAmounts)
{
if (preset <= _status.MagicRemainingDeposit)
{
<MudButton Variant="Variant.Outlined" Size="Size.Small"
Color="@(_chargeAmount == preset ? Color.Primary : Color.Default)"
OnClick="() => _chargeAmount = preset"
Class="rounded-pill">
@FormatToman(preset)
</MudButton>
}
}
</MudStack>
<MudButton Variant="Variant.Filled"
Color="Color.Primary"
Size="Size.Large"
FullWidth="true"
Disabled="@(_isProcessing || _chargeAmount < 10_000)"
OnClick="StartMagicCharge"
StartIcon="@Icons.Material.Filled.Payment"
Class="rounded-lg mt-2">
@if (_isProcessing)
{
<MudProgressCircular Size="Size.Small" Indeterminate="true" Class="me-2" />
<span>در حال انتقال به درگاه...</span>
}
else
{
<span>پرداخت با کارت بانکی</span>
}
</MudButton>
</MudStack>
</MudPaper>
}
else
{
<MudAlert Severity="MudBlazor.Severity.Warning" Class="rounded-lg">
سقف شارژ جادویی در این دور پر شده است.
با خرج کردن موجودی و خرید مجدد پکیج، سقف ریست می‌شود.
</MudAlert>
}
@* ─── قوانین ─── *@
<MudExpansionPanels Elevation="1" Class="rounded-lg">
<MudExpansionPanel Text="قوانین کیف‌پول جادویی" MaxHeight="500" IsInitiallyExpanded="false">
<MudList T="string" Dense="true">
<MudListItem T="string" Icon="@Icons.Material.Filled.CheckCircle" IconColor="Color.Success">
هر مبلغ واریزی ×@_status.MagicMultiplier.ToString("0.#") به موجودی اضافه می‌شود
</MudListItem>
<MudListItem T="string" Icon="@Icons.Material.Filled.CheckCircle" IconColor="Color.Success">
سقف واریز در هر دور: @FormatPrice(_status.MagicMaxDeposit)
</MudListItem>
<MudListItem T="string" Icon="@Icons.Material.Filled.CheckCircle" IconColor="Color.Success">
حداکثر اعتبار: @FormatPrice(_status.MagicMaxCredit)
</MudListItem>
<MudListItem T="string" Icon="@Icons.Material.Filled.Warning" IconColor="Color.Warning">
در حالت جادویی، کمیسیون و پاداش های دریافتی غیرفعال است
</MudListItem>
<MudListItem T="string" Icon="@Icons.Material.Filled.Info" IconColor="Color.Info">
بعد از اتمام سقف و خرج موجودی، با خرید مجدد پکیج دور جدید شروع می‌شود
</MudListItem>
</MudList>
</MudExpansionPanel>
</MudExpansionPanels>
}
@* ─── نتیجه پرداخت (اگه از callback برگشته) ─── *@
@if (_paymentResult != null)
{
<MudAlert Severity="@(_paymentResult == "success" ? MudBlazor.Severity.Success : MudBlazor.Severity.Error)"
Class="rounded-lg" Variant="Variant.Filled">
@if (_paymentResult == "success")
{
<span>شارژ جادویی با موفقیت انجام شد! ✅</span>
}
else
{
<span>پرداخت ناموفق بود. لطفاً دوباره تلاش کنید.</span>
}
</MudAlert>
}
</MudStack>
</MudContainer>