+ CheckedChanged="Context.AllColumnsCheckChanged">
@foreach (var field in Context.Fields)
{
@@ -41,33 +41,33 @@
}
+ Loading="@Loading" LoadingProgressColor="@Color.Secondary" ChildRowContent="@ChildRowContent">
@if (_canCreate)
{
@L["Create"]
+ OnClick="(() => InvokeModal())" StartIcon="@Icons.Material.Filled.Add"
+ IconColor="Color.Surface">@L["Create"]
}
@if (_canExport)
{
@L["Export"]
+ OnClick="(() => ExportAsync())" StartIcon="@Icons.Material.Filled.ImportExport"
+ Style="margin-left: 5px;" IconColor="Color.Surface">@L["Export"]
}
@L["Reload"]
+ StartIcon="@Icons.Material.Filled.Refresh" IconColor="Color.Surface" Color="Color.Secondary"
+ Style="margin-left: 5px;">@L["Reload"]
@if (_canSearch && !_advancedSearchExpanded)
{
+ Placeholder="@($"{L["Search for"]} {Context.EntityNamePlural}")" Adornment="Adornment.End"
+ AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0 mb-3"
+ TextChanged="OnSearchStringChanged">
}
@@ -110,37 +110,33 @@
}
}
-
- @if (ActionsContent is not null)
+
+ @if (HasActions)
{
- @ActionsContent(context)
- }
- else if (HasActions)
- {
-
- @if (CanUpdateEntity(context))
- {
- InvokeModal(context))">@L["Edit"]
- }
- @if (CanDeleteEntity(context))
- {
- Delete(context))">@L["Delete"]
- }
- @if (ExtraActions is not null)
- {
- @ExtraActions(context)
- }
-
- }
- else
- {
-
- @L["No Allowed Actions"]
-
+ if (CanUpdateEntity(context))
+ {
+
+ InvokeModal(context))" Icon="@Icons.Material.Outlined.Edit" Color="Color.Default" Size="Size.Small" />
+
+ }
+ @if (CanDeleteEntity(context))
+ {
+
+ Delete(context))" Icon="@Icons.Material.Outlined.Delete" Color="Color.Default" Size="Size.Small" />
+
+ }
+ @if (ActionsContent is not null)
+ {
+ @ActionsContent(context)
+ }
+ @if (ExtraActions is not null)
+ {
+
+
+ @ExtraActions(context)
+
+
+ }
}
diff --git a/src/Client/Pages/Identity/Users/Users.razor b/src/Client/Pages/Identity/Users/Users.razor
index f2d93ec9..25fcdc0c 100644
--- a/src/Client/Pages/Identity/Users/Users.razor
+++ b/src/Client/Pages/Identity/Users/Users.razor
@@ -5,16 +5,22 @@
-
+
@L["View Profile"]
@if (_canViewRoles)
{
- @L["Manage Roles"]
+ @L["View Role"]
}
+ @if (!Context.AddEditModal.IsCreate)
+ {
+
+
+
+ }
@@ -26,21 +32,24 @@
+ Label="@L["Email"]" />
-
+
-
-
-
-
-
-
+ Label="@L["Phone Number"]" />
+ @if (Context.AddEditModal.IsCreate)
+ {
+
+
+
+
+
+
+ }
\ No newline at end of file
diff --git a/src/Client/Pages/Identity/Users/Users.razor.cs b/src/Client/Pages/Identity/Users/Users.razor.cs
index c0417399..67fc30ef 100644
--- a/src/Client/Pages/Identity/Users/Users.razor.cs
+++ b/src/Client/Pages/Identity/Users/Users.razor.cs
@@ -2,6 +2,7 @@
using FSH.BlazorWebAssembly.Client.Infrastructure.ApiClient;
using FSH.BlazorWebAssembly.Client.Infrastructure.Auth;
using FSH.WebApi.Shared.Authorization;
+using Mapster;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
@@ -13,25 +14,27 @@ public partial class Users
{
[CascadingParameter]
protected Task AuthState { get; set; } = default!;
+
[Inject]
protected IAuthorizationService AuthService { get; set; } = default!;
[Inject]
protected IUsersClient UsersClient { get; set; } = default!;
- protected EntityClientTableContext Context { get; set; } = default!;
+ protected EntityClientTableContext Context { get; set; } = default!;
private bool _canExportUsers;
private bool _canViewRoles;
// Fields for editform
protected string Password { get; set; } = string.Empty;
+
protected string ConfirmPassword { get; set; } = string.Empty;
+ private readonly bool _passwordTogleFormVisibility;
private bool _passwordVisibility;
private InputType _passwordInput = InputType.Password;
private string _passwordInputIcon = Icons.Material.Filled.VisibilityOff;
-
protected override async Task OnInitializedAsync()
{
var user = (await AuthState).User;
@@ -43,8 +46,8 @@ protected override async Task OnInitializedAsync()
entityNamePlural: L["Users"],
entityResource: FSHResource.Users,
searchAction: FSHAction.View,
- updateAction: string.Empty,
- deleteAction: string.Empty,
+ updateAction: FSHAction.Update,
+ deleteAction: FSHAction.Delete,
fields: new()
{
new(user => user.FirstName, L["First Name"]),
@@ -64,7 +67,9 @@ protected override async Task OnInitializedAsync()
|| user.Email?.Contains(searchString, StringComparison.OrdinalIgnoreCase) == true
|| user.PhoneNumber?.Contains(searchString, StringComparison.OrdinalIgnoreCase) == true
|| user.UserName?.Contains(searchString, StringComparison.OrdinalIgnoreCase) == true,
- createFunc: user => UsersClient.CreateAsync(user),
+ createFunc: async user => await UsersClient.CreateAsync(user.Adapt()),
+ updateFunc: async (id, user) => await UsersClient.UpdateUserAsync(id.ToString(), user),
+ deleteFunc: async id => await UsersClient.DeleteAsync(id.ToString()),
hasExtraActionsFunc: () => true,
exportAction: string.Empty);
}
@@ -92,4 +97,10 @@ private void TogglePasswordVisibility()
Context.AddEditModal.ForceRender();
}
+
+ public class UserViewModel : UpdateUserRequest
+ {
+ public string? Password { get; set; }
+ public string? ConfirmPassword { get; set; }
+ }
}
\ No newline at end of file
diff --git a/src/Client/Shared/NavMenu.razor b/src/Client/Shared/NavMenu.razor
index 9ccb1ba2..f4d71a36 100644
--- a/src/Client/Shared/NavMenu.razor
+++ b/src/Client/Shared/NavMenu.razor
@@ -45,7 +45,7 @@
}
@if (_canViewRoles)
{
- @L["Roles"]
+ @L["Roles"]
}
@if(_canViewTenants)
{
diff --git a/src/Client/wwwroot/css/fsh.css b/src/Client/wwwroot/css/fsh.css
index a44b6344..7e03f9ff 100644
--- a/src/Client/wwwroot/css/fsh.css
+++ b/src/Client/wwwroot/css/fsh.css
@@ -69,4 +69,10 @@
}
.fsh-nav-child {
padding-left: 10px !important;
-}
\ No newline at end of file
+}
+.fsh-td-action {
+ white-space: nowrap;
+}
+ .fsh-td-action .mud-menu {
+ display: block;
+ }
\ No newline at end of file