u
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
using Blazored.LocalStorage;
|
using Blazored.LocalStorage;
|
||||||
|
using FrontOffice.Main.Shared;
|
||||||
|
using FrontOffice.Main.Utilities;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
using Microsoft.AspNetCore.WebUtilities;
|
using Microsoft.AspNetCore.WebUtilities;
|
||||||
|
using MudBlazor;
|
||||||
|
|
||||||
namespace FrontOffice.Main;
|
namespace FrontOffice.Main;
|
||||||
|
|
||||||
@@ -23,6 +26,27 @@ public partial class App
|
|||||||
{
|
{
|
||||||
// Store referral code in local storage
|
// Store referral code in local storage
|
||||||
await LocalStorage.SetItemAsync("referral:code", referralCode);
|
await LocalStorage.SetItemAsync("referral:code", referralCode);
|
||||||
|
|
||||||
|
var options = new DialogOptions
|
||||||
|
{
|
||||||
|
BackdropClick = false,
|
||||||
|
CloseOnEscapeKey = false
|
||||||
|
};
|
||||||
|
|
||||||
|
var parameters = new DialogParameters<AuthDialog>
|
||||||
|
{
|
||||||
|
{ x => x.HideCancelButton, true }
|
||||||
|
};
|
||||||
|
var dialog = await DialogService.ShowAsync<AuthDialog>("ورود به حساب کاربری", parameters, options);
|
||||||
|
var result = await dialog.Result;
|
||||||
|
|
||||||
|
if (!result.Canceled)
|
||||||
|
{
|
||||||
|
Snackbar.Add(GlobalConstants.SuccessMsg, Severity.Success);
|
||||||
|
await Task.Delay(1000);
|
||||||
|
Navigation.NavigateTo(Navigation.Uri, forceLoad: true);
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
<!-- Personal Information Tab -->
|
<!-- Personal Information Tab -->
|
||||||
<MudTabPanel Text="اطلاعات شخصی" Icon="@Icons.Material.Filled.Person">
|
<MudTabPanel Text="اطلاعات شخصی" Icon="@Icons.Material.Filled.Person">
|
||||||
<div class="pa-4">
|
<div class="pa-4">
|
||||||
<MudForm @ref="_personalForm" Model="_userProfile" Validation="@(_personalValidator.ValidateValue)">
|
<MudForm @ref="_personalForm" Model="_updateUserRequest" Validation="@(_personalValidator.ValidateValue)">
|
||||||
<MudGrid Spacing="3">
|
<MudGrid Spacing="3">
|
||||||
<MudItem xs="12" md="6">
|
<MudItem xs="12" md="6">
|
||||||
<MudTextField @bind-Value="_updateUserRequest.FirstName"
|
<MudTextField @bind-Value="_updateUserRequest.FirstName"
|
||||||
|
|||||||
@@ -60,8 +60,8 @@
|
|||||||
Dense="true"
|
Dense="true"
|
||||||
Elevation="0"
|
Elevation="0"
|
||||||
Class="mb-2">
|
Class="mb-2">
|
||||||
@(_errorMessage)
|
@(_errorMessage)
|
||||||
</MudAlert>
|
</MudAlert>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (!string.IsNullOrWhiteSpace(_infoMessage))
|
@if (!string.IsNullOrWhiteSpace(_infoMessage))
|
||||||
@@ -70,8 +70,8 @@
|
|||||||
Dense="true"
|
Dense="true"
|
||||||
Elevation="0"
|
Elevation="0"
|
||||||
Class="mb-2">
|
Class="mb-2">
|
||||||
@(_infoMessage)
|
@(_infoMessage)
|
||||||
</MudAlert>
|
</MudAlert>
|
||||||
}
|
}
|
||||||
|
|
||||||
<MudStack Spacing="2">
|
<MudStack Spacing="2">
|
||||||
@@ -104,9 +104,12 @@
|
|||||||
}
|
}
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<MudButton Variant="Variant.Text"
|
@if (!HideCancelButton)
|
||||||
OnClick="Cancel"
|
{
|
||||||
Disabled="_isBusy">لغو</MudButton>
|
<MudButton Variant="Variant.Text"
|
||||||
|
OnClick="Cancel"
|
||||||
|
Disabled="_isBusy">لغو</MudButton>
|
||||||
|
}
|
||||||
@if (_currentStep == AuthStep.Phone)
|
@if (_currentStep == AuthStep.Phone)
|
||||||
{
|
{
|
||||||
<MudButton Variant="Variant.Filled"
|
<MudButton Variant="Variant.Filled"
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ namespace FrontOffice.Main.Shared;
|
|||||||
|
|
||||||
public partial class AuthDialog : IDisposable
|
public partial class AuthDialog : IDisposable
|
||||||
{
|
{
|
||||||
|
[Parameter]
|
||||||
|
public bool HideCancelButton { get; set; } = false;
|
||||||
|
|
||||||
private enum AuthStep { Phone, Verify }
|
private enum AuthStep { Phone, Verify }
|
||||||
private const int DefaultResendCooldown = 120;
|
private const int DefaultResendCooldown = 120;
|
||||||
public const int MaxVerificationAttempts = 5;
|
public const int MaxVerificationAttempts = 5;
|
||||||
@@ -439,5 +442,5 @@ public partial class AuthDialog : IDisposable
|
|||||||
_resendTimer?.Dispose();
|
_resendTimer?.Dispose();
|
||||||
_resendTimer = null;
|
_resendTimer = null;
|
||||||
}
|
}
|
||||||
private string GetDialogTitle() => _currentStep == AuthStep.Phone ? "ورود به حساب کاربری" : "تأیید رمز پویا";
|
private string GetDialogTitle() => _currentStep == AuthStep.Phone ? "ورود/ثبتنام به حساب کاربری" : "تأیید رمز پویا";
|
||||||
}
|
}
|
||||||
@@ -48,6 +48,7 @@ public partial class MainLayout
|
|||||||
if (!result.Canceled)
|
if (!result.Canceled)
|
||||||
{
|
{
|
||||||
await CheckAuthStatus();
|
await CheckAuthStatus();
|
||||||
|
Snackbar.Add(GlobalConstants.SuccessMsg, Severity.Success);
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user