feat: Magic Wallet Phase 6 UI + purchase cycle controls
- FrontOffice.Main.csproj: switch to ProjectReference for CMS Protobuf - MagicWallet.razor.cs: update default record with PurchaseCycleCount - WalletService.cs: add PurchaseCycleCount to MagicWalletStatus record - Profile/Index.razor.cs: load _purchaseCycleCount from MagicWalletStatus - Profile/Index.razor: conditional purchase dialog (IPG vs Daya by cycle) - Licenses.razor: fix grid column size xs=6
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DateTimeConverterCL" Version="1.0.0" />
|
||||
<!-- Replace all FrontOffice.BFF protobuf packages with CMS protobuf -->
|
||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.181" />
|
||||
<!-- <ProjectReference Include="../../../CMS/src/CMSMicroservice.Protobuf/CMSMicroservice.Protobuf.csproj" />-->
|
||||
<!-- <PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.181" />-->
|
||||
<ProjectReference Include="../../../CMS/src/CMSMicroservice.Protobuf/CMSMicroservice.Protobuf.csproj" />
|
||||
<PackageReference Include="MudBlazor" Version="8.14.0" />
|
||||
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
|
||||
<PackageReference Include="Mapster" Version="7.4.0" />
|
||||
|
||||
@@ -37,7 +37,7 @@ else
|
||||
<MudGrid Spacing="4" Justify="Justify.Center">
|
||||
@foreach (var license in _licenseImages)
|
||||
{
|
||||
<MudItem xs="12" sm="6" md="4">
|
||||
<MudItem xs="6" sm="6" md="4">
|
||||
<MudCard Elevation="2" Class="h-100">
|
||||
<MudCardMedia Image="@license.ImagePath" Height="250" />
|
||||
<MudCardContent>
|
||||
|
||||
@@ -214,26 +214,45 @@
|
||||
<MudText Typo="Typo.subtitle1" Color="Color.Primary"><b>پرداخت مستقیم</b></MudText>
|
||||
</MudStack>
|
||||
<MudText Typo="Typo.body2" Class="mud-text-secondary">پرداخت آنی از طریق درگاه بانکی</MudText>
|
||||
<MudButton Variant="Variant.Filled" Disabled="true" Color="Color.Primary" FullWidth="true"
|
||||
StartIcon="@Icons.Material.Filled.Payment" OnClick="DirectPayment">
|
||||
پرداخت با کارت بانکی(بزودی)
|
||||
</MudButton>
|
||||
@if (_purchaseCycleCount > 0)
|
||||
{
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" FullWidth="true"
|
||||
StartIcon="@Icons.Material.Filled.Payment" OnClick="DirectPayment">
|
||||
پرداخت با کارت بانکی
|
||||
</MudButton>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudButton Variant="Variant.Filled" Disabled="true" Color="Color.Primary" FullWidth="true"
|
||||
StartIcon="@Icons.Material.Filled.Payment" OnClick="DirectPayment">
|
||||
پرداخت با کارت بانکی(بزودی)
|
||||
</MudButton>
|
||||
}
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
|
||||
<MudPaper Elevation="0" Class="pa-4 rounded-lg" Style="border: 2px solid var(--mud-palette-tertiary);">
|
||||
<MudStack Spacing="2">
|
||||
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
|
||||
<MudIcon Icon="@Icons.Material.Filled.Diamond" Color="Color.Tertiary" Size="Size.Medium" />
|
||||
<MudText Typo="Typo.subtitle1" Color="Color.Tertiary"><b>اعتبار الماسی دایا</b></MudText>
|
||||
@if (_purchaseCycleCount == 0)
|
||||
{
|
||||
<MudPaper Elevation="0" Class="pa-4 rounded-lg" Style="border: 2px solid var(--mud-palette-tertiary);">
|
||||
<MudStack Spacing="2">
|
||||
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
|
||||
<MudIcon Icon="@Icons.Material.Filled.Diamond" Color="Color.Tertiary" Size="Size.Medium" />
|
||||
<MudText Typo="Typo.subtitle1" Color="Color.Tertiary"><b>اعتبار الماسی دایا</b></MudText>
|
||||
</MudStack>
|
||||
<MudText Typo="Typo.body2" Class="mud-text-secondary">تأمین اعتبار از طریق خرید توکن الماس و دریافت وام</MudText>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Tertiary" FullWidth="true"
|
||||
StartIcon="@Icons.Material.Filled.AccountBalance" OnClick="DayaLoanPayment">
|
||||
تأمین اعتبار الماسی
|
||||
</MudButton>
|
||||
</MudStack>
|
||||
<MudText Typo="Typo.body2" Class="mud-text-secondary">تأمین اعتبار از طریق خرید توکن الماس و دریافت وام</MudText>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Tertiary" FullWidth="true"
|
||||
StartIcon="@Icons.Material.Filled.AccountBalance" OnClick="DayaLoanPayment">
|
||||
تأمین اعتبار الماسی
|
||||
</MudButton>
|
||||
</MudStack>
|
||||
</MudPaper>
|
||||
</MudPaper>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudAlert Severity="Severity.Info" Dense="true" Class="mt-1">
|
||||
از دور دوم به بعد، خرید پکیج فقط از طریق درگاه بانکی امکانپذیر است.
|
||||
</MudAlert>
|
||||
}
|
||||
|
||||
<MudButton Variant="Variant.Text" Color="Color.Default" FullWidth="true" OnClick="ClosePurchaseOptions">
|
||||
بستن
|
||||
|
||||
@@ -45,6 +45,7 @@ public partial class Index
|
||||
// Purchase Options Bottom Sheet
|
||||
private bool _showPurchaseBottomSheet;
|
||||
private bool _isProcessingPayment;
|
||||
private int _purchaseCycleCount; // تعداد دورهای خرید — اگر > 0 فقط IPG مجاز
|
||||
|
||||
// Dashboard Tiles
|
||||
private readonly List<DashTile> _dashTiles = new()
|
||||
@@ -148,6 +149,11 @@ public partial class Index
|
||||
var discount = FormatPrice(b.DiscountBalance);
|
||||
_walletNetwork = FormatPrice(b.NetworkBalance);
|
||||
_walletDiscount = discount;
|
||||
|
||||
// بارگذاری تعداد دورهای خرید برای کنترل روشهای پرداخت
|
||||
var magicStatus = await WalletService.GetMagicWalletStatusAsync();
|
||||
_purchaseCycleCount = magicStatus.PurchaseCycleCount;
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace FrontOffice.Main.Pages.Profile;
|
||||
|
||||
public partial class MagicWallet : ComponentBase
|
||||
{
|
||||
private MagicWalletStatus _status = new(0, 0, 0, 0, 0, 0, null);
|
||||
private MagicWalletStatus _status = new(0, 0, 0, 0, 0, 0, null, 0);
|
||||
private bool _isLoading = true;
|
||||
private bool _isProcessing;
|
||||
private long _chargeAmount;
|
||||
|
||||
@@ -32,7 +32,8 @@ public record MagicWalletStatus(
|
||||
long MagicMaxDeposit,
|
||||
long MagicRemainingDeposit,
|
||||
long Balance,
|
||||
DateTime? MagicActivatedAt
|
||||
DateTime? MagicActivatedAt,
|
||||
int PurchaseCycleCount
|
||||
);
|
||||
|
||||
public class WalletService
|
||||
@@ -212,12 +213,13 @@ public class WalletService
|
||||
response.MagicMaxDeposit,
|
||||
response.MagicRemainingDeposit,
|
||||
response.Balance,
|
||||
activatedAt
|
||||
activatedAt,
|
||||
response.PurchaseCycleCount
|
||||
);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return new MagicWalletStatus(0, 0, 0, 0, 0, 0, null);
|
||||
return new MagicWalletStatus(0, 0, 0, 0, 0, 0, null, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user