Overview
The User Management module allows administrators to control who has access to Sistema Venta. You can create new user accounts, assign roles, update user information, and deactivate accounts as needed.Accessing User Management
Navigate to the Usuarios (Users) section from the main menu. You’ll see a table displaying all users with their details.User List View
The user table displays the following information:User Information
- Nombre Completo: Full name
- Correo: Email address
- Rol: Assigned role (e.g., Administrador, Empleado)
User Status
- Estado: Active or Inactive
- Acciones: Edit and delete buttons
Search and Filter
Use the search bar at the top of the user table to quickly find users by:- Name
- Email address
- Role
- Status
usuario.component.ts:53-56).
Pagination
The user list supports pagination with configurable page sizes:- 5 users per page
- 10 users per page
- 20 users per page
Creating a New User
Open User Form
Click the Nuevo Usuario (New User) button at the top of the page. This opens a modal dialog with the user creation form.
Fill User Details
Enter the required information:
- Nombre Completo: User’s full name
- Correo: Valid email address (used for login)
- Rol: Select from available roles (dropdown populated from database)
- Clave: Password for the user account
- Estado: Active (1) or Inactive (0)
All fields are required. The save button remains disabled until the form is completely filled out with valid data.
Editing a User
Modify User Information
The user form opens pre-filled with existing data. You can update:
- Full name
- Email address
- Assigned role
- Password
- Active status
Deleting a User
Confirm Deletion
A confirmation dialog appears showing:
- Title: “¿Desea eliminar el usuario?” (Do you want to delete the user?)
- User’s full name
- Si, eliminar (Yes, delete) button
- No, volver (No, go back) button
User Roles
Sistema Venta supports role-based access control. When creating or editing a user, you assign them a role that determines their permissions:- Administrador: Full system access
- Empleado: Limited access based on role configuration
- Custom Roles: As configured in your system
Rol service and displayed in a dropdown menu (modal-usuario.component.ts:48-53).
User Status Management
Each user has an active status that controls access:Active (Activo)
Status = 1User can log in and access the system according to their role permissions.
Inactive (No activo)
Status = 0User account is disabled. Login attempts will fail even with correct credentials.
API Endpoints
The User Management module interacts with these API endpoints:Best Practices
Email Uniqueness
Ensure each user has a unique email address. The email is used as the login identifier.
Strong Passwords
Encourage users to create strong passwords with a mix of characters, numbers, and symbols.
Role Assignment
Carefully assign roles based on job responsibilities. Review permissions regularly.
Regular Audits
Periodically review the user list to deactivate accounts of employees who no longer need access.
Related Components
- Component:
usuario.component.ts- Main user list and management logic - Modal:
modal-usuario.component.ts- User creation/editing form - Service:
usuario.service.ts- API integration for user operations - Interface:
usuario.ts- User data structure
Troubleshooting
Can't create user - save button disabled
Can't create user - save button disabled
User deleted but still appears
User deleted but still appears
Refresh the page or wait a moment. The list refreshes automatically after deletion, but network latency may cause a brief delay.
Can't see role options in dropdown
Can't see role options in dropdown
This indicates the role service isn’t returning data. Check:
- API server is running
/Rol/Listaendpoint is accessible- Database contains role records
Password field shows dots/asterisks
Password field shows dots/asterisks
This is intentional for security. Click the eye icon to toggle password visibility while entering or editing.