Overview
GIMA provides a complete set of components for managing users in the system. These components work together to provide CRUD operations (Create, Read, Update, Delete) for user management.UserTable
The main container component that displays a table of users with search functionality and CRUD operations.Props
This component has no props - it manages its own state internally.Features
- Search Functionality: Filter users by name, email, or department
- User List Display: Shows all users in a formatted table
- Create New Users: Button to open modal for creating users
- Edit Users: Inline edit functionality for each user
- Delete Users: Remove users from the system
- State Management: Uses React hooks (
useState) to manage:- User list (initialized from
mockUsers) - Search query
- Modal open/closed state
- Currently editing user
- User list (initialized from
Import
Usage Example
State Structure
Key Functions
eliminarUsuario(id: string)
eliminarUsuario(id: string)
Removes a user from the list by filtering out the user with the matching ID.
abrirModalNuevo()
abrirModalNuevo()
Opens the modal for creating a new user by clearing the editing user state.
abrirModalEditar(user: User)
abrirModalEditar(user: User)
Opens the modal for editing an existing user.
guardarUsuario(userData: any)
guardarUsuario(userData: any)
Saves a user (either creates new or updates existing based on
usuarioEditando state).Search Filter
The component filters users based on name, email, or department:UserRow
A row component that displays individual user information in the table.Props
The user object to display in the row
Callback function to delete the user by ID
Callback function to edit the user
Interface
Import
Usage Example
Display Features
- Avatar with Initials: Shows user initials in a circular badge
- User Info: Displays name and email
- Role: Shows the user’s role
- Department: Displays department with a styled badge
- Status Badge: Shows “available” or “unavailable” with color coding (green/red)
- Action Buttons: Edit and Delete buttons
Styling
- Avatar:
#F0FDFAbackground with#0B2545text color - Status badges: Green (
bg-green-100 text-green-800) for available, Red (bg-red-100 text-red-800) for unavailable - Hover effect on table row:
hover:bg-gray-50
UserModal
A modal dialog component for creating and editing users.Props
Controls whether the modal is visible
Callback function to close the modal
Callback function to save the user data
The user to edit (null for creating a new user)
Interface
Import
Usage Example
Form Fields
The modal includes the following fields:- Nombre (Name) - Required text input
- Email - Required email input
- Rol (Role) - Dropdown with options:
- Administrador
- Técnico
- Supervisor
- Desarrollador
- Departamento (Department) - Dropdown with options:
- Infraestructura
- Laboratorios
- Desarrollo
- Soporte
- Marketing
- Finanzas
- Estado (Status) - Dropdown with options:
- Activo (Active)
- Inactivo (Inactive)
State Management
Auto-generated Initials
The modal automatically generates user initials from the name:Form Submission
Modal Modes
- Create Mode: When
userprop isnull, form fields are empty and modal title is “Nuevo usuario” - Edit Mode: When
userprop has a value, form fields are pre-filled and modal title is “Editar usuario”
Effect Hook
The modal usesuseEffect to populate fields when editing:
Component Relationships
Related Documentation
User Type
View the User interface and type definitions
User Management Feature
Learn about user management workflows
Data Service
User data management utilities
User Management Guide
Authentication and user roles guide