Change users page layout

This commit is contained in:
2025-11-04 15:46:20 +09:00
parent 9cf89a5ad6
commit eea085607b
2 changed files with 14 additions and 2 deletions

View File

@ -33,7 +33,7 @@
<RadzenAlert Visible="@hasError" AlertStyle="AlertStyle.Danger" Variant="Variant.Flat" Shade="Shade.Lighter" AllowClose="false">
@errorMessage
</RadzenAlert>
<RadzenDataGrid TItem="AppUserWithRole" Data="@usersWithRoles" RowSelect="@EditUserAsync" IsLoading="@isLoading" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true">
<RadzenDataGrid TItem="AppUserWithRole" Data="@usersWithRoles" IsLoading="@isLoading" AllowFiltering="true" AllowPaging="true" ShowPagingSummary="true" PageSizeOptions=@(new int[] { 5, 10, 20, 30 }) AllowSorting="true">
<Columns>
<RadzenDataGridColumn TItem="AppUserWithRole" Property="User.UserName" Title="Логин" />
<RadzenDataGridColumn TItem="AppUserWithRole" Property="Role.Name" Title="Роль" />
@ -41,6 +41,7 @@
<Template Context="userWithRole">
@if (userWithRole.User.Id != currentUserId)
{
<RadzenButton Click="@(() => EditUserAsync(userWithRole))" @onclick:stopPropagation="true" ButtonStyle="ButtonStyle.Primary" Icon="edit" Size="ButtonSize.Small" />
<RadzenButton Click="@(() => DeleteUserAsync(userWithRole))" @onclick:stopPropagation="true" ButtonStyle="ButtonStyle.Danger" Icon="close" Size="ButtonSize.Small" />
}
</Template>
@ -131,7 +132,7 @@
try
{
if (await DialogService.Confirm(
$"Вы уверены что хотите удалить пользователя '{userWithRole.User.UserName}'?",
GetDeleteMessage(userWithRole.User.UserName),
"Удаление пользователя",
new ConfirmOptions()
{
@ -162,6 +163,16 @@
}
}
RenderFragment GetDeleteMessage(string userName)
{
return __builder =>
{
<text>
Вы уверены что хотите удалить пользователя <b>@userName</b>?
</text>
};
}
async Task UpdateGridAsync()
{
isLoading = true;