Merge branch 'kub-stage' into production
Build and Deploy to Production / build-and-deploy (push) Successful in 6m24s
Build and Deploy to Production / build-and-deploy (push) Successful in 6m24s
This commit is contained in:
@@ -35,6 +35,40 @@
|
|||||||
</MudAlert>
|
</MudAlert>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@if (_authLoaded && !_isClubMemberActive)
|
||||||
|
{
|
||||||
|
<MudAlert Severity="MudBlazor.Severity.Warning" Class="rounded-lg" Variant="Variant.Outlined">
|
||||||
|
<MudStack Spacing="2">
|
||||||
|
<MudText>
|
||||||
|
برای شارژ کیف پول اصلی ابتدا باید پکیج را خریداری کرده و قرارداد باشگاه مشتریان را امضا کنید.
|
||||||
|
</MudText>
|
||||||
|
<MudStack Row="true" Spacing="1" Class="flex-wrap">
|
||||||
|
@if (!_hasPurchasedPackage)
|
||||||
|
{
|
||||||
|
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Primary"
|
||||||
|
Href="@RouteConstants.Package.List"
|
||||||
|
StartIcon="@Icons.Material.Filled.CardGiftcard">
|
||||||
|
مشاهده پکیجها
|
||||||
|
</MudButton>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Primary"
|
||||||
|
Href="@RouteConstants.Club.Membership"
|
||||||
|
StartIcon="@Icons.Material.Filled.Handshake">
|
||||||
|
امضای قرارداد باشگاه
|
||||||
|
</MudButton>
|
||||||
|
}
|
||||||
|
<MudButton Size="Size.Small" Variant="Variant.Text"
|
||||||
|
Href="@RouteConstants.Profile.Wallet">
|
||||||
|
بازگشت به کیف پول
|
||||||
|
</MudButton>
|
||||||
|
</MudStack>
|
||||||
|
</MudStack>
|
||||||
|
</MudAlert>
|
||||||
|
}
|
||||||
|
else if (_authLoaded)
|
||||||
|
{
|
||||||
<MudPaper Elevation="2" Class="pa-5 rounded-lg">
|
<MudPaper Elevation="2" Class="pa-5 rounded-lg">
|
||||||
<MudText Typo="Typo.h6" Class="mb-3">
|
<MudText Typo="Typo.h6" Class="mb-3">
|
||||||
<MudIcon Icon="@Icons.Material.Filled.AccountBalanceWallet" Class="ml-1" />
|
<MudIcon Icon="@Icons.Material.Filled.AccountBalanceWallet" Class="ml-1" />
|
||||||
@@ -122,5 +156,6 @@
|
|||||||
</MudList>
|
</MudList>
|
||||||
</MudExpansionPanel>
|
</MudExpansionPanel>
|
||||||
</MudExpansionPanels>
|
</MudExpansionPanels>
|
||||||
|
}
|
||||||
</MudStack>
|
</MudStack>
|
||||||
</MudContainer>
|
</MudContainer>
|
||||||
|
|||||||
@@ -7,10 +7,15 @@ namespace FrontOffice.Main.Pages.Profile;
|
|||||||
|
|
||||||
public partial class ChargeCreditWallet : ComponentBase
|
public partial class ChargeCreditWallet : ComponentBase
|
||||||
{
|
{
|
||||||
|
[Inject] private AuthService AuthService { get; set; } = default!;
|
||||||
|
|
||||||
private bool _isProcessing;
|
private bool _isProcessing;
|
||||||
private long _chargeAmount;
|
private long _chargeAmount;
|
||||||
private string? _paymentResult;
|
private string? _paymentResult;
|
||||||
private string? _pendingReturnUrl;
|
private string? _pendingReturnUrl;
|
||||||
|
private bool _isClubMemberActive;
|
||||||
|
private bool _hasPurchasedPackage;
|
||||||
|
private bool _authLoaded;
|
||||||
|
|
||||||
private readonly long[] _presetAmounts = { 500_000, 1_000_000, 5_000_000, 10_000_000, 20_000_000, 50_000_000 };
|
private readonly long[] _presetAmounts = { 500_000, 1_000_000, 5_000_000, 10_000_000, 20_000_000, 50_000_000 };
|
||||||
|
|
||||||
@@ -23,7 +28,7 @@ public partial class ChargeCreditWallet : ComponentBase
|
|||||||
[SupplyParameterFromQuery(Name = "returnUrl")]
|
[SupplyParameterFromQuery(Name = "returnUrl")]
|
||||||
public string? ReturnUrlQueryParam { get; set; }
|
public string? ReturnUrlQueryParam { get; set; }
|
||||||
|
|
||||||
protected override void OnInitialized()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
_paymentResult = PaymentQueryParam;
|
_paymentResult = PaymentQueryParam;
|
||||||
|
|
||||||
@@ -32,11 +37,27 @@ public partial class ChargeCreditWallet : ComponentBase
|
|||||||
|
|
||||||
if (CreditChargeNavigation.IsValidReturnUrl(ReturnUrlQueryParam))
|
if (CreditChargeNavigation.IsValidReturnUrl(ReturnUrlQueryParam))
|
||||||
_pendingReturnUrl = ReturnUrlQueryParam;
|
_pendingReturnUrl = ReturnUrlQueryParam;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var userInfo = await AuthService.GetUserAuthInfo();
|
||||||
|
_isClubMemberActive = userInfo.IsClubMemberActive;
|
||||||
|
_hasPurchasedPackage = userInfo.HasPurchasedPackage;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
_isClubMemberActive = false;
|
||||||
|
_hasPurchasedPackage = false;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_authLoaded = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
{
|
{
|
||||||
if (firstRender && !string.IsNullOrEmpty(_pendingReturnUrl))
|
if (firstRender && !string.IsNullOrEmpty(_pendingReturnUrl) && _isClubMemberActive)
|
||||||
{
|
{
|
||||||
await CreditChargeNavigation.SaveReturnUrlAsync(JSRuntime, _pendingReturnUrl);
|
await CreditChargeNavigation.SaveReturnUrlAsync(JSRuntime, _pendingReturnUrl);
|
||||||
}
|
}
|
||||||
@@ -46,6 +67,14 @@ public partial class ChargeCreditWallet : ComponentBase
|
|||||||
|
|
||||||
private async Task StartCreditCharge()
|
private async Task StartCreditCharge()
|
||||||
{
|
{
|
||||||
|
if (!_isClubMemberActive)
|
||||||
|
{
|
||||||
|
Snackbar.Add(
|
||||||
|
"برای شارژ کیف پول اصلی ابتدا باید پکیج را خریداری کرده و قرارداد باشگاه مشتریان را امضا کنید.",
|
||||||
|
Severity.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_chargeAmount <= 0 || _isProcessing) return;
|
if (_chargeAmount <= 0 || _isProcessing) return;
|
||||||
|
|
||||||
_isProcessing = true;
|
_isProcessing = true;
|
||||||
|
|||||||
@@ -39,15 +39,55 @@
|
|||||||
</MudButton>
|
</MudButton>
|
||||||
|
|
||||||
<!-- دکمه شارژ کیفپول اصلی -->
|
<!-- دکمه شارژ کیفپول اصلی -->
|
||||||
<MudButton Variant="Variant.Filled"
|
@if (_isClubMemberActive)
|
||||||
Color="Color.Primary"
|
{
|
||||||
Size="Size.Large"
|
<MudButton Variant="Variant.Filled"
|
||||||
FullWidth="true"
|
Color="Color.Primary"
|
||||||
StartIcon="@Icons.Material.Filled.AccountBalanceWallet"
|
Size="Size.Large"
|
||||||
Href="@RouteConstants.Profile.ChargeCreditWallet"
|
FullWidth="true"
|
||||||
Class="rounded-lg">
|
StartIcon="@Icons.Material.Filled.AccountBalanceWallet"
|
||||||
شارژ کیفپول اصلی
|
Href="@RouteConstants.Profile.ChargeCreditWallet"
|
||||||
</MudButton>
|
Class="rounded-lg">
|
||||||
|
شارژ کیفپول اصلی
|
||||||
|
</MudButton>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<MudPaper Elevation="0" Class="pa-3 rounded-lg" Outlined="true">
|
||||||
|
<MudStack Spacing="2">
|
||||||
|
<MudButton Variant="Variant.Filled"
|
||||||
|
Color="Color.Primary"
|
||||||
|
Size="Size.Large"
|
||||||
|
FullWidth="true"
|
||||||
|
StartIcon="@Icons.Material.Filled.AccountBalanceWallet"
|
||||||
|
Disabled="true"
|
||||||
|
Class="rounded-lg">
|
||||||
|
شارژ کیفپول اصلی
|
||||||
|
</MudButton>
|
||||||
|
<MudAlert Severity="Severity.Warning" Dense="true" Variant="Variant.Outlined">
|
||||||
|
برای شارژ کیف پول اصلی ابتدا باید پکیج را خریداری کرده و قرارداد باشگاه مشتریان را امضا کنید.
|
||||||
|
</MudAlert>
|
||||||
|
<MudStack Row="true" Spacing="1" Class="flex-wrap">
|
||||||
|
@if (!_hasPurchasedPackage)
|
||||||
|
{
|
||||||
|
<MudButton Size="Size.Small" Variant="Variant.Outlined" Color="Color.Primary"
|
||||||
|
Href="@RouteConstants.Package.List"
|
||||||
|
StartIcon="@Icons.Material.Filled.CardGiftcard">
|
||||||
|
مشاهده پکیجها
|
||||||
|
</MudButton>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<MudButton Size="Size.Small" Variant="Variant.Outlined" Color="Color.Primary"
|
||||||
|
Href="@RouteConstants.Club.Membership"
|
||||||
|
StartIcon="@Icons.Material.Filled.Handshake">
|
||||||
|
امضای قرارداد باشگاه
|
||||||
|
</MudButton>
|
||||||
|
}
|
||||||
|
</MudStack>
|
||||||
|
</MudStack>
|
||||||
|
</MudPaper>
|
||||||
|
}
|
||||||
|
|
||||||
<!-- دکمه شارژ کیفپول اعتباری -->
|
<!-- دکمه شارژ کیفپول اعتباری -->
|
||||||
<MudButton Variant="Variant.Filled"
|
<MudButton Variant="Variant.Filled"
|
||||||
|
|||||||
@@ -6,13 +6,29 @@ namespace FrontOffice.Main.Pages.Profile;
|
|||||||
|
|
||||||
public partial class Wallet : ComponentBase
|
public partial class Wallet : ComponentBase
|
||||||
{
|
{
|
||||||
|
[Inject] private AuthService AuthService { get; set; } = default!;
|
||||||
|
|
||||||
private (string Credit, string Discount, string Network) _balances = ("-", "-", "-");
|
private (string Credit, string Discount, string Network) _balances = ("-", "-", "-");
|
||||||
private List<WalletTransaction> _txs = new();
|
private List<WalletTransaction> _txs = new();
|
||||||
private string? _filterReferenceId;
|
private string? _filterReferenceId;
|
||||||
private string _filterType = "all";
|
private string _filterType = "all";
|
||||||
|
private bool _isClubMemberActive;
|
||||||
|
private bool _hasPurchasedPackage;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var userInfo = await AuthService.GetUserAuthInfo();
|
||||||
|
_isClubMemberActive = userInfo.IsClubMemberActive;
|
||||||
|
_hasPurchasedPackage = userInfo.HasPurchasedPackage;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
_isClubMemberActive = false;
|
||||||
|
_hasPurchasedPackage = false;
|
||||||
|
}
|
||||||
|
|
||||||
var b = await WalletService.GetBalancesAsync();
|
var b = await WalletService.GetBalancesAsync();
|
||||||
_balances = (FormatPrice(b.CreditBalance), FormatPrice(b.DiscountBalance), FormatPrice(b.NetworkBalance));
|
_balances = (FormatPrice(b.CreditBalance), FormatPrice(b.DiscountBalance), FormatPrice(b.NetworkBalance));
|
||||||
_txs = await WalletService.GetTransactionsAsync();
|
_txs = await WalletService.GetTransactionsAsync();
|
||||||
|
|||||||
@@ -125,11 +125,26 @@ public partial class CheckoutSummary : ComponentBase
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
var shortfall = totalRequired - walletBalance;
|
var shortfall = totalRequired - walletBalance;
|
||||||
|
var allowCharge = false;
|
||||||
|
var hasPurchasedPackage = false;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var userInfo = await AuthService.GetUserAuthInfo();
|
||||||
|
allowCharge = userInfo.IsClubMemberActive;
|
||||||
|
hasPurchasedPackage = userInfo.HasPurchasedPackage;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
allowCharge = false;
|
||||||
|
}
|
||||||
|
|
||||||
var parameters = new DialogParameters<InsufficientCreditDialog>
|
var parameters = new DialogParameters<InsufficientCreditDialog>
|
||||||
{
|
{
|
||||||
{ x => x.CurrentBalance, walletBalance },
|
{ x => x.CurrentBalance, walletBalance },
|
||||||
{ x => x.RequiredAmount, totalRequired },
|
{ x => x.RequiredAmount, totalRequired },
|
||||||
{ x => x.ShortfallAmount, shortfall }
|
{ x => x.ShortfallAmount, shortfall },
|
||||||
|
{ x => x.AllowChargeCredit, allowCharge },
|
||||||
|
{ x => x.HasPurchasedPackage, hasPurchasedPackage }
|
||||||
};
|
};
|
||||||
|
|
||||||
var dialog = await DialogService.ShowAsync<InsufficientCreditDialog>(
|
var dialog = await DialogService.ShowAsync<InsufficientCreditDialog>(
|
||||||
@@ -143,7 +158,7 @@ public partial class CheckoutSummary : ComponentBase
|
|||||||
});
|
});
|
||||||
|
|
||||||
var result = await dialog.Result;
|
var result = await dialog.Result;
|
||||||
if (result is { Canceled: false } && result.Data is long chargeShortfall)
|
if (allowCharge && result is { Canceled: false } && result.Data is long chargeShortfall)
|
||||||
{
|
{
|
||||||
var chargeAmount = CreditChargeNavigation.NormalizeChargeAmount(chargeShortfall);
|
var chargeAmount = CreditChargeNavigation.NormalizeChargeAmount(chargeShortfall);
|
||||||
Navigation.NavigateTo(CreditChargeNavigation.BuildChargeUrl(
|
Navigation.NavigateTo(CreditChargeNavigation.BuildChargeUrl(
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@using FrontOffice.Main.Utilities
|
||||||
|
|
||||||
<MudDialog>
|
<MudDialog>
|
||||||
<TitleContent>
|
<TitleContent>
|
||||||
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
|
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
|
||||||
@@ -7,9 +9,19 @@
|
|||||||
</TitleContent>
|
</TitleContent>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<MudStack Spacing="2">
|
<MudStack Spacing="2">
|
||||||
<MudText Typo="Typo.body2" Class="mud-text-secondary">
|
@if (AllowChargeCredit)
|
||||||
برای تکمیل این سفارش، موجودی اصلی شما کافی نیست. میتوانید کیف پول را شارژ کنید و سپس سفارش را ثبت کنید.
|
{
|
||||||
</MudText>
|
<MudText Typo="Typo.body2" Class="mud-text-secondary">
|
||||||
|
برای تکمیل این سفارش، موجودی اصلی شما کافی نیست. میتوانید کیف پول را شارژ کنید و سپس سفارش را ثبت کنید.
|
||||||
|
</MudText>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<MudAlert Severity="Severity.Warning" Dense="true" Variant="Variant.Outlined">
|
||||||
|
برای شارژ کیف پول اصلی ابتدا باید پکیج را خریداری کرده و قرارداد باشگاه مشتریان را امضا کنید.
|
||||||
|
</MudAlert>
|
||||||
|
}
|
||||||
|
|
||||||
<MudPaper Outlined="true" Class="pa-3 rounded-lg">
|
<MudPaper Outlined="true" Class="pa-3 rounded-lg">
|
||||||
<MudStack Spacing="1">
|
<MudStack Spacing="1">
|
||||||
<MudStack Row="true" Justify="Justify.SpaceBetween">
|
<MudStack Row="true" Justify="Justify.SpaceBetween">
|
||||||
@@ -31,12 +43,33 @@
|
|||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<MudButton OnClick="Cancel">بستن</MudButton>
|
<MudButton OnClick="Cancel">بستن</MudButton>
|
||||||
<MudButton Variant="Variant.Filled"
|
@if (AllowChargeCredit)
|
||||||
Color="Color.Primary"
|
{
|
||||||
StartIcon="@Icons.Material.Filled.Payment"
|
<MudButton Variant="Variant.Filled"
|
||||||
OnClick="GoToCharge">
|
Color="Color.Primary"
|
||||||
شارژ حساب اصلی
|
StartIcon="@Icons.Material.Filled.Payment"
|
||||||
</MudButton>
|
OnClick="GoToCharge">
|
||||||
|
شارژ حساب اصلی
|
||||||
|
</MudButton>
|
||||||
|
}
|
||||||
|
else if (!HasPurchasedPackage)
|
||||||
|
{
|
||||||
|
<MudButton Variant="Variant.Filled"
|
||||||
|
Color="Color.Primary"
|
||||||
|
StartIcon="@Icons.Material.Filled.CardGiftcard"
|
||||||
|
OnClick="GoToPackages">
|
||||||
|
مشاهده پکیجها
|
||||||
|
</MudButton>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<MudButton Variant="Variant.Filled"
|
||||||
|
Color="Color.Primary"
|
||||||
|
StartIcon="@Icons.Material.Filled.Handshake"
|
||||||
|
OnClick="GoToClubMembership">
|
||||||
|
امضای قرارداد باشگاه
|
||||||
|
</MudButton>
|
||||||
|
}
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</MudDialog>
|
</MudDialog>
|
||||||
|
|
||||||
@@ -53,9 +86,28 @@
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public long ShortfallAmount { get; set; }
|
public long ShortfallAmount { get; set; }
|
||||||
|
|
||||||
|
/// <summary>اگر false باشد، به صفحه شارژ هدایت نمیشود.</summary>
|
||||||
|
[Parameter]
|
||||||
|
public bool AllowChargeCredit { get; set; } = true;
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public bool HasPurchasedPackage { get; set; }
|
||||||
|
|
||||||
private void Cancel() => MudDialog.Cancel();
|
private void Cancel() => MudDialog.Cancel();
|
||||||
|
|
||||||
private void GoToCharge() => MudDialog.Close(DialogResult.Ok(ShortfallAmount));
|
private void GoToCharge() => MudDialog.Close(DialogResult.Ok(ShortfallAmount));
|
||||||
|
|
||||||
|
private void GoToPackages()
|
||||||
|
{
|
||||||
|
MudDialog.Cancel();
|
||||||
|
Navigation.NavigateTo(RouteConstants.Package.List);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GoToClubMembership()
|
||||||
|
{
|
||||||
|
MudDialog.Cancel();
|
||||||
|
Navigation.NavigateTo(RouteConstants.Club.Membership);
|
||||||
|
}
|
||||||
|
|
||||||
private static string FormatPrice(long price) => string.Format("{0:N0} تومان", price);
|
private static string FormatPrice(long price) => string.Format("{0:N0} تومان", price);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user