This commit is contained in:
MeysamMoghaddam
2025-10-20 20:55:55 +03:30
parent 566ec21555
commit 4c022f18c6
5 changed files with 40 additions and 9 deletions

View File

@@ -1,6 +1,9 @@
using Blazored.LocalStorage;
using FrontOffice.Main.Shared;
using FrontOffice.Main.Utilities;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.WebUtilities;
using MudBlazor;
namespace FrontOffice.Main;
@@ -23,6 +26,27 @@ public partial class App
{
// Store referral code in local storage
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();
}
}
}
}

View File

@@ -64,7 +64,7 @@
<!-- Personal Information Tab -->
<MudTabPanel Text="اطلاعات شخصی" Icon="@Icons.Material.Filled.Person">
<div class="pa-4">
<MudForm @ref="_personalForm" Model="_userProfile" Validation="@(_personalValidator.ValidateValue)">
<MudForm @ref="_personalForm" Model="_updateUserRequest" Validation="@(_personalValidator.ValidateValue)">
<MudGrid Spacing="3">
<MudItem xs="12" md="6">
<MudTextField @bind-Value="_updateUserRequest.FirstName"

View File

@@ -104,9 +104,12 @@
}
</DialogContent>
<DialogActions>
@if (!HideCancelButton)
{
<MudButton Variant="Variant.Text"
OnClick="Cancel"
Disabled="_isBusy">لغو</MudButton>
}
@if (_currentStep == AuthStep.Phone)
{
<MudButton Variant="Variant.Filled"

View File

@@ -11,6 +11,9 @@ namespace FrontOffice.Main.Shared;
public partial class AuthDialog : IDisposable
{
[Parameter]
public bool HideCancelButton { get; set; } = false;
private enum AuthStep { Phone, Verify }
private const int DefaultResendCooldown = 120;
public const int MaxVerificationAttempts = 5;
@@ -439,5 +442,5 @@ public partial class AuthDialog : IDisposable
_resendTimer?.Dispose();
_resendTimer = null;
}
private string GetDialogTitle() => _currentStep == AuthStep.Phone ? "ورود به حساب کاربری" : "تأیید رمز پویا";
private string GetDialogTitle() => _currentStep == AuthStep.Phone ? "ورود/ثبت‌نام به حساب کاربری" : "تأیید رمز پویا";
}

View File

@@ -48,6 +48,7 @@ public partial class MainLayout
if (!result.Canceled)
{
await CheckAuthStatus();
Snackbar.Add(GlobalConstants.SuccessMsg, Severity.Success);
StateHasChanged();
}
}