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>
|
<ItemGroup>
|
||||||
<PackageReference Include="DateTimeConverterCL" Version="1.0.0" />
|
<PackageReference Include="DateTimeConverterCL" Version="1.0.0" />
|
||||||
<!-- Replace all FrontOffice.BFF protobuf packages with CMS protobuf -->
|
<!-- Replace all FrontOffice.BFF protobuf packages with CMS protobuf -->
|
||||||
<PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.181" />
|
<!-- <PackageReference Include="Foursat.CMSMicroservice.Protobuf" Version="0.0.181" />-->
|
||||||
<!-- <ProjectReference Include="../../../CMS/src/CMSMicroservice.Protobuf/CMSMicroservice.Protobuf.csproj" />-->
|
<ProjectReference Include="../../../CMS/src/CMSMicroservice.Protobuf/CMSMicroservice.Protobuf.csproj" />
|
||||||
<PackageReference Include="MudBlazor" Version="8.14.0" />
|
<PackageReference Include="MudBlazor" Version="8.14.0" />
|
||||||
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
|
<PackageReference Include="Blazored.LocalStorage" Version="4.5.0" />
|
||||||
<PackageReference Include="Mapster" Version="7.4.0" />
|
<PackageReference Include="Mapster" Version="7.4.0" />
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ else
|
|||||||
<MudGrid Spacing="4" Justify="Justify.Center">
|
<MudGrid Spacing="4" Justify="Justify.Center">
|
||||||
@foreach (var license in _licenseImages)
|
@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">
|
<MudCard Elevation="2" Class="h-100">
|
||||||
<MudCardMedia Image="@license.ImagePath" Height="250" />
|
<MudCardMedia Image="@license.ImagePath" Height="250" />
|
||||||
<MudCardContent>
|
<MudCardContent>
|
||||||
|
|||||||
@@ -214,13 +214,25 @@
|
|||||||
<MudText Typo="Typo.subtitle1" Color="Color.Primary"><b>پرداخت مستقیم</b></MudText>
|
<MudText Typo="Typo.subtitle1" Color="Color.Primary"><b>پرداخت مستقیم</b></MudText>
|
||||||
</MudStack>
|
</MudStack>
|
||||||
<MudText Typo="Typo.body2" Class="mud-text-secondary">پرداخت آنی از طریق درگاه بانکی</MudText>
|
<MudText Typo="Typo.body2" Class="mud-text-secondary">پرداخت آنی از طریق درگاه بانکی</MudText>
|
||||||
|
@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"
|
<MudButton Variant="Variant.Filled" Disabled="true" Color="Color.Primary" FullWidth="true"
|
||||||
StartIcon="@Icons.Material.Filled.Payment" OnClick="DirectPayment">
|
StartIcon="@Icons.Material.Filled.Payment" OnClick="DirectPayment">
|
||||||
پرداخت با کارت بانکی(بزودی)
|
پرداخت با کارت بانکی(بزودی)
|
||||||
</MudButton>
|
</MudButton>
|
||||||
|
}
|
||||||
</MudStack>
|
</MudStack>
|
||||||
</MudPaper>
|
</MudPaper>
|
||||||
|
|
||||||
|
@if (_purchaseCycleCount == 0)
|
||||||
|
{
|
||||||
<MudPaper Elevation="0" Class="pa-4 rounded-lg" Style="border: 2px solid var(--mud-palette-tertiary);">
|
<MudPaper Elevation="0" Class="pa-4 rounded-lg" Style="border: 2px solid var(--mud-palette-tertiary);">
|
||||||
<MudStack Spacing="2">
|
<MudStack Spacing="2">
|
||||||
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
|
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
|
||||||
@@ -234,6 +246,13 @@
|
|||||||
</MudButton>
|
</MudButton>
|
||||||
</MudStack>
|
</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">
|
<MudButton Variant="Variant.Text" Color="Color.Default" FullWidth="true" OnClick="ClosePurchaseOptions">
|
||||||
بستن
|
بستن
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ public partial class Index
|
|||||||
// Purchase Options Bottom Sheet
|
// Purchase Options Bottom Sheet
|
||||||
private bool _showPurchaseBottomSheet;
|
private bool _showPurchaseBottomSheet;
|
||||||
private bool _isProcessingPayment;
|
private bool _isProcessingPayment;
|
||||||
|
private int _purchaseCycleCount; // تعداد دورهای خرید — اگر > 0 فقط IPG مجاز
|
||||||
|
|
||||||
// Dashboard Tiles
|
// Dashboard Tiles
|
||||||
private readonly List<DashTile> _dashTiles = new()
|
private readonly List<DashTile> _dashTiles = new()
|
||||||
@@ -148,6 +149,11 @@ public partial class Index
|
|||||||
var discount = FormatPrice(b.DiscountBalance);
|
var discount = FormatPrice(b.DiscountBalance);
|
||||||
_walletNetwork = FormatPrice(b.NetworkBalance);
|
_walletNetwork = FormatPrice(b.NetworkBalance);
|
||||||
_walletDiscount = discount;
|
_walletDiscount = discount;
|
||||||
|
|
||||||
|
// بارگذاری تعداد دورهای خرید برای کنترل روشهای پرداخت
|
||||||
|
var magicStatus = await WalletService.GetMagicWalletStatusAsync();
|
||||||
|
_purchaseCycleCount = magicStatus.PurchaseCycleCount;
|
||||||
|
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace FrontOffice.Main.Pages.Profile;
|
|||||||
|
|
||||||
public partial class MagicWallet : ComponentBase
|
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 _isLoading = true;
|
||||||
private bool _isProcessing;
|
private bool _isProcessing;
|
||||||
private long _chargeAmount;
|
private long _chargeAmount;
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ public record MagicWalletStatus(
|
|||||||
long MagicMaxDeposit,
|
long MagicMaxDeposit,
|
||||||
long MagicRemainingDeposit,
|
long MagicRemainingDeposit,
|
||||||
long Balance,
|
long Balance,
|
||||||
DateTime? MagicActivatedAt
|
DateTime? MagicActivatedAt,
|
||||||
|
int PurchaseCycleCount
|
||||||
);
|
);
|
||||||
|
|
||||||
public class WalletService
|
public class WalletService
|
||||||
@@ -212,12 +213,13 @@ public class WalletService
|
|||||||
response.MagicMaxDeposit,
|
response.MagicMaxDeposit,
|
||||||
response.MagicRemainingDeposit,
|
response.MagicRemainingDeposit,
|
||||||
response.Balance,
|
response.Balance,
|
||||||
activatedAt
|
activatedAt,
|
||||||
|
response.PurchaseCycleCount
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
catch
|
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