From ad6fe03b70997d85122fedc341b9182cfb01951e Mon Sep 17 00:00:00 2001 From: Ho Ngoc Hai Date: Tue, 3 Mar 2026 10:19:22 +0700 Subject: [PATCH] feat(web-client): add users management page and enhance roles CRUD - Expand IamApiService with Users CRUD, Role mutations, role assignment methods - Create UserManagement.razor page at /admin/users with user list + role assignment - Enhance RolePermissions.razor with create/edit/delete role dialogs - Add Users nav item to AdminLayout sidebar - Add localization keys (vi-VN, en-US) for Users navigation --- .../Layout/AdminLayout.razor | 4 + .../Pages/Admin/Staff/RolePermissions.razor | 221 +++++++++- .../Pages/Admin/Staff/UserManagement.razor | 376 ++++++++++++++++++ .../Services/IamApiService.cs | 231 +++++++++++ .../wwwroot/locales/en-US.json | 1 + .../wwwroot/locales/vi-VN.json | 1 + 6 files changed, 825 insertions(+), 9 deletions(-) create mode 100644 apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Staff/UserManagement.razor diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/Layout/AdminLayout.razor b/apps/web-client-tpos-net/src/WebClientTpos.Client/Layout/AdminLayout.razor index d6de8040..99bddb81 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Client/Layout/AdminLayout.razor +++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/Layout/AdminLayout.razor @@ -88,6 +88,10 @@ @* ── QUẢN TRỊ ── *@ @L["Admin_Nav_SectionAdmin"] + + + @L["Admin_Nav_Users"] + @L["Admin_Nav_Roles"] diff --git a/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Staff/RolePermissions.razor b/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Staff/RolePermissions.razor index 15fe4836..d0e8e0d4 100644 --- a/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Staff/RolePermissions.razor +++ b/apps/web-client-tpos-net/src/WebClientTpos.Client/Pages/Admin/Staff/RolePermissions.razor @@ -2,11 +2,14 @@ @layout AdminLayout @inherits AdminBase @inject WebClientTpos.Client.Services.IamApiService IamService +@inject IDialogService DialogService +@inject ISnackbar Snackbar @using WebClientTpos.Client.Services +@using MudBlazor @* - EN: Role permissions — real roles from IAM Service API. - VI: Phân quyền — dữ liệu roles thật từ IAM Service API. + EN: Role permissions — real roles from IAM Service API with full CRUD. + VI: Phân quyền — dữ liệu roles thật từ IAM Service API với CRUD đầy đủ. *@ Phân quyền — GoodGo Admin @@ -18,7 +21,7 @@

Quản lý vai trò và quyền truy cập

- @@ -37,7 +40,7 @@ else if (!_roles.Any())
Chưa có vai trò nào - Vai trò sẽ được tạo khi hệ thống IAM hoạt động + Nhấn "Tạo vai trò" để bắt đầu
} else @@ -72,11 +75,32 @@ else @if (selected != null) {
-
+

Chi tiết — @selected.Name

+
+ @if (!selected.IsSystem) + { + + + } + else + { + + Vai trò hệ thống + + } +
@@ -106,7 +130,7 @@ else
} - @* Permission Groups — placeholder since IAM doesn't expose permissions yet *@ + @* Permission Groups — placeholder since IAM doesn't expose permissions per role yet *@
Quyền hạn
@@ -127,42 +151,221 @@ else
} +@* ═══ CREATE / EDIT DIALOG ═══ *@ +@if (_showDialog) +{ +
+
+

+ @(_isEditing ? "Sửa vai trò" : "Tạo vai trò mới") +

+
+
+ + +
+
+ +