The Settings page (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Edwin950821/BodegaX/llms.txt
Use this file to discover all available pages before exploring further.
/settings) is the primary user management dashboard for BodegaX administrators. When the page initializes, it automatically fetches every registered user from the backend and renders them in a scrollable table, giving admins a real-time view of who has access to the warehouse system. Three operations are available per user — create, edit, and delete — each backed by its own REST endpoint on the Spring Boot API running at http://localhost:8080.
How the User List Loads
Every time the Settings component mounts,ngOnInit triggers getUsers(), which issues a GET request to /admin/all and populates the usuarios array that drives the template table.
getUsers() is called again so the table always reflects the current state of the database.
User Table Layout
The table rendered insettings.component.html has four columns: Estado (status checkbox), Cliente (user name), a spacer, and Accion (edit and delete icon buttons). The table is displayed inside a scrollable container capped at 200 px in height.
Creating a New User
Clicking the Crear Usuario button callscrear(), which opens UserFormDialog without any pre-filled data, signalling a new-user flow. Note that crear() does not subscribe to afterClosed() — to see the newly created user in the table, navigate away and back, or use the edit flow, which does trigger a refresh.
Open the Create Dialog
Click the Crear Usuario button at the top of the Settings page. The
UserFormDialog modal appears with all fields blank.Fill in the User Form
Complete the five fields presented by the dialog:
Display name or business name for the user account (
nombre field sent to the API).National ID or document number (
id field sent to the API).Physical address of the user or business location (
direccion field sent to the API).Account password. Autocomplete is set to
new-password to prevent browser autofill.Must match Contraseña exactly; the dialog validates equality before sending the request.
Submit the Form
Click Registrarse.
UserFormDialog.register() validates that no required field is empty and that both password fields match, then issues a POST request:The
role field is always hard-coded to "user" when creating accounts through the Settings page or the self-registration form. To create an admin account, the role must be set directly in the PostgreSQL database or via a custom backend endpoint.Editing an Existing User
Clicking the edit icon on a table row callseditar(user), which opens UserFormDialog with the selected user’s data pre-populated. Unlike crear(), editar() subscribes to afterClosed() and re-calls getUsers() when the dialog closes, so the table updates immediately.
Click the Edit Icon
In the Accion column, click the pencil/edit icon next to the user you want to modify.
editar(user) passes the following data object to UserFormDialog:Modify the Fields
All five form fields are pre-filled with the existing values. Update whichever fields require changes. The
uuid is carried silently — it is not displayed but is sent with the update request to identify the record.Save Changes
Click Registrarse. Because
data.uuid is present, UserFormDialog.register() routes to the edit branch and issues a PUT request:Deleting a User
Clicking the trash icon on a table row callseliminar(user), which opens a ConfirmDialog before issuing any destructive request.
Click the Delete Icon
In the Accion column, click the trash icon for the target user. A
ConfirmDialog appears with the message: “Estas seguro que desea eliminar este registro?”Confirm the Deletion
Click Confirm in the dialog.
ConfirmDialog.confirm() closes the modal and returns true to the afterClosed() observer.DELETE Request Fires
The Settings component checks that
r == true and issues a DELETE request, sending the full user object in the request body:Self-Registration via /register
In addition to admin-created accounts, BodegaX exposes a public self-registration route at/register. This page is accessible without authentication and allows new warehouse clients to create their own user-role accounts.
Registration Fields
The
/register form collects the same five fields as the admin dialog: Nombre Del Negocio (username), Documento (id), Dirección (address), Contraseña (password), and Confirmar Contraseña (conpassword).Auto-Login After Registration
On a successful
POST /admin/create response, RegisterComponent displays a success message, then immediately posts the new credentials to POST /admin/login and calls AppService.logIn(res), storing the session and navigating to / without requiring a separate login step.register.component.ts:
Form Validation Rules
BothUserFormDialog and RegisterComponent enforce the same client-side validation before any HTTP request is made:
| Rule | Behavior |
|---|---|
| Required fields empty | Opens MessageDialog — “Por Favor Rellenar Todos Los Campos” |
| Passwords do not match | Opens MessageDialog — “La Contraseñas no coinciden” |
| UUID presence | If data.uuid exists → PUT /admin/edit; otherwise → POST /admin/create |
There is no client-side format enforcement (such as regex or length rules) on the
nombre, id, or direccion fields beyond the empty-field check. Any non-empty string is accepted by the frontend validation layer.