N
Norberto Planchart

Administración de Perfiles Usuarios

LIVE DEMO
Generated using Instruct UI - An AI for Blazor UI Generation
## Overview A user profile management UI built with MudBlazor that provides a MudTable list, MudDialog-based editor and grouped permissions using expansion panels and checkboxes. ## What's implemented - User list table with avatar, role chip and action icons (edit/delete). - Dialog editor for user details (name, email, role) and permission assignment. - Validation on text fields and simple email check via MudForm. - Permission grouping by module/entity in MudExpansionPanels with MudCheckBox items. - Table paging via MudTablePager and Snackbar feedback on create/update/delete. ## Key components - MudTable, MudTablePager - MudDialog (UserEditDialog), IMudDialogInstance - MudForm, MudTextField, MudSelect - MudExpansionPanels, MudExpansionPanel - MudCheckBox, MudAvatar, MudChip, MudButton, MudIconButton - ISnackbar and IDialogService usage in the page code ## How it works - Data is kept in in-memory lists (_users, _roles, _allPermissions) loaded in OnInitialized. - OpenUserDialog clones the selected user into a DialogParameters object and opens UserEditDialog via DialogService. - The dialog binds inputs with @bind-Value to UserProfile properties and uses MudForm.Validate() to check required fields and a custom email validator. - Permissions are mapped into a Dictionary<string,bool> for two-way binding of checkboxes and recomposed into UserProfile.Permissions on submit. - UI interactions use MudTable breakpoints for responsiveness and Snackbar for user feedback. ## Styling - Uses MudBlazor components and theme tokens for spacing, color and elevation rather than utility CSS. - MudTable Breakpoint="Breakpoint.Sm" enables responsive table layout; MudPaper and MudStack provide container spacing. ## Reuse steps 1. Add the MudBlazor NuGet package and static assets (MudBlazor CSS) to the project. 2. Register MudBlazor services in Program.cs (AddMudServices / AddMudBlazorDialog service depending on setup). 3. Import MudBlazor namespace in _Imports.razor or components. 4. Copy the page, dialog and models; adjust namespaces and localization strings as needed. 5. Replace in-memory lists with backend services (inject a user/role/permission API) and return DialogResult with the edited model. ## Limitations & next steps - The example uses in-memory sample data; persistence and authentication/authorization are not implemented. - UserEditDialog currently calls MudDialog.Close() without returning a DialogResult or the edited UserProfile; dialog should close with MudDialog.Close(DialogResult.Ok(user)) to return data. Submit is async void which should be async Task to allow awaiting and error handling. - Permission grouping and large permission sets may need virtualization or search inside the panel for scalability. - Add server-side validation and role-based access checks before applying changes in production.