Materials are the core items tracked by Corpointa’s inventory system. Each material record captures a human-readable description, its classification category, the unit of measure used to count it, and an optional physical storage location. The module is accessible at theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/EricMartinez758/corpointa-frontend/llms.txt
Use this file to discover all available pages before exploring further.
/materiales route and provides a full-featured data table with search, filters, and inline dialogs for creating, editing, and deleting records.
Data Model
TheMaterial type is derived from the Zod schema defined in src/features/materiales/data/schema.ts.
Field Reference
| Field | Type | Constraints | Description |
|---|---|---|---|
id_material | number | Auto-assigned | Primary key. |
descripcion | string | Required, max 50 chars | Human-readable name of the material. |
fk_id_categoria | number | Required | Foreign key to the categorias table. |
fk_id_medida | number | Required | Foreign key to the unidades-medidas table. |
ubicacion | string | null | Optional, max 30 chars | Physical storage location (shelf, bin, room, etc.). |
fk_id_usuario_crea | number | Read-only | ID of the user who created the record. |
fecha_creacion | string | Read-only | ISO timestamp of record creation. |
fecha_actualizacion | string | null | Read-only | ISO timestamp of last update. |
categoria_nombre | string | Read-only JOIN | Human-readable category name — populated by the API via JOIN, never sent on write. |
medida_nombre | string | Read-only JOIN | Human-readable unit name — populated by the API via JOIN, never sent on write. |
categoria_nombre and medida_nombre are resolved by the backend through a SQL JOIN and are included in GET responses for display purposes. Do not include them in POST or PUT request bodies — they will be ignored or may cause validation errors.Features
Searchable Data Table
The materials table supports column-level search and global filtering. Results update as you type, allowing quick lookup by description, category, or location.
Create Dialog
A modal form lets users enter a description, choose a category and unit of measure from dropdowns, and optionally specify a storage location. Client-side Zod validation runs before submission.
Edit Dialog
Clicking the edit action on any row opens the same form pre-populated with the material’s current values. Only the writable fields are sent to the API on save.
Delete Dialog
A confirmation dialog prevents accidental deletions. The record is removed via
DELETE /materiales/:id.API Operations
All functions live insrc/features/materiales/api/materiales.ts and use the shared apiClient (Axios instance with base URL and auth headers).
| Method | Endpoint | Function | Description |
|---|---|---|---|
GET | /materiales | getMateriales() | Returns all material records, each including categoria_nombre and medida_nombre via JOIN. |
GET | /materiales/:id | getMaterial(id) | Returns a single material by its id_material. |
POST | /materiales | createMaterial(data) | Creates a new material. Body must include descripcion, fk_id_categoria, and fk_id_medida. |
PUT | /materiales/:id | updateMaterial(id, data) | Updates an existing material. Same writable fields as POST. |
DELETE | /materiales/:id | deleteMaterial(id) | Permanently removes a material record. |
Create / Update Payload
For bothPOST and PUT, send only the writable fields. The id_material, categoria_nombre, medida_nombre, fk_id_usuario_crea, fecha_creacion, and fecha_actualizacion fields are excluded from the payload type: