@using Indotalent.Features.Setting.SystemUser @using Indotalent.Features.Setting.SystemUser.Cqrs @using MudBlazor @using Indotalent.Shared.Utils @inject SystemUserService SystemUserService @inject ISnackbar Snackbar Add New User Fill in the account details and security settings for the new user. Primary Information Full Name Email Address (as Username) Password Phone Number SSO Identifiers Firebase ID Keycloak ID Azure ID AWS ID Other SSO ID 1 Other SSO ID 2 Other SSO ID 3 Account Settings & Status General availability of the account in the system. Mark email as verified without requiring user action. Mark phone number as verified. Enforce Two-Factor Authentication for this user. Allow account to be locked after failed attempts. Manual Lockout Until Set this only if you want to pre-lock this new account. Cancel @if (_processing) { Processing... } else { Create User } @code { [Parameter] public EventCallback OnCancel { get; set; } [Parameter] public EventCallback OnSuccess { get; set; } private MudForm _form = default!; private CreateSystemUserRequest _model = new() { IsActive = true, LockoutEnabled = true }; private CreateSystemUserValidator _validator = new(); private DateTime? _lockoutDate; private bool _processing = false; private void OnEmailChanged(string value) { _model.Email = value; _model.UserName = value; } private async Task Submit() { await _form.Validate(); if (!_form.IsValid) return; _processing = true; try { if (_lockoutDate.HasValue) { _model.LockoutEnd = new DateTimeOffset(_lockoutDate.Value, TimeSpan.Zero); } else { _model.LockoutEnd = null; } var response = await SystemUserService.CreateSystemUserAsync(_model); await Task.Delay(500); if (response != null && response.IsSuccess) { Snackbar.Add("User created successfully", Severity.Success); await OnSuccess.InvokeAsync(); } } catch (Exception ex) { Snackbar.Add($"Error: {ex.Message}", Severity.Error); } finally { _processing = false; } } }