Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Hansel-Pan/sistema-de-informacion-web-para-un-gimnasio/llms.txt

Use this file to discover all available pages before exploring further.

Client management is the foundation of GymSys. Every person who trains at the gym must have a client record before they can be assigned payments or have their access tracked. The /clientes section lets staff list all registered members, register new ones, update existing records, and remove members who are no longer active.

Client Record Fields

Each client record stores the following fields:
FieldTypeDescription
idnumberAuto-incremented primary key assigned by the server
nombresstringFull name of the member
identificacionstringGovernment-issued ID number
celularstringMobile phone number
fecha_inscripciondateDate the member first enrolled
generoenumOne of Masculino, Femenino, or Otro
dias_restantesnumberRemaining membership days — computed and maintained server-side
en_gimnasiobooleanWhether the member is currently inside the gym — set server-side by the Access Control module
dias_restantes and en_gimnasio are server-computed fields. They are not editable through the client form; they are updated automatically when payments are recorded or entry/exit events are logged.

Listing Clients

Navigating to /clientes loads the full client roster. The page calls clientesApi.listar() on mount and renders every record in a table with the following columns: ID, Nombres, Identificación, Celular, Fecha Inscripción, Género, Días Rest., Estado, and Acciones. The Estado column shows a colour-coded badge:
  • Dentro (green) — en_gimnasio is true
  • Fuera (grey) — en_gimnasio is false
Each row includes two action buttons:
  • Editar — navigates to /clientes/editar/:id
  • Eliminar — opens a browser confirmation dialog; on confirmation calls clientesApi.eliminar(id)
// HTTP equivalent
GET http://localhost:3001/api/clientes

Creating a Client

Navigate to /clientes/nuevo or click + Nuevo Cliente from the client list or the dashboard quick-action shortcut. The registration form contains five fields, all of which are required:
FieldInput typeDefault value
Nombres completostext
Identificacióntext
Número de celulartext
Fecha de inscripcióndateToday’s date
GéneroselectMasculino
Client-side validation runs on submit. If any of nombres, identificacion, celular, or fecha_inscripcion is empty or blank, the form displays an “Todos los campos son obligatorios” error and does not call the API. On successful submission the form calls clientesApi.crear(form) and redirects to /clientes.
const handleSubmit = async (e) => {
  e.preventDefault();
  setError('');

  if (!form.nombres.trim() || !form.identificacion.trim() || !form.celular.trim() || !form.fecha_inscripcion) {
    setError('Todos los campos son obligatorios');
    return;
  }

  setLoading(true);
  try {
    if (esEdicion) {
      await clientesApi.actualizar(id, form);
    } else {
      await clientesApi.crear(form);
    }
    navigate('/clientes');
  } catch (e) {
    setError(e.message);
  } finally {
    setLoading(false);
  }
};
// HTTP equivalent
POST http://localhost:3001/api/clientes
Content-Type: application/json

{
  "nombres": "Juan Pérez",
  "identificacion": "1234567890",
  "celular": "3001234567",
  "fecha_inscripcion": "2024-01-15",
  "genero": "Masculino"
}

Editing a Client

Navigate to /clientes/editar/:id by clicking the Editar button on any row. The same ClienteForm component is rendered in edit mode (esEdicion = true). On mount, the form calls clientesApi.obtener(id) to fetch the existing record and pre-fills all five editable fields. The dias_restantes and en_gimnasio fields are not shown in the form because they are managed server-side. Validation rules are identical to creation. On success, clientesApi.actualizar(id, form) is called and the user is redirected back to /clientes.
// HTTP equivalents
GET  http://localhost:3001/api/clientes/:id
PUT  http://localhost:3001/api/clientes/:id
Content-Type: application/json

{
  "nombres": "Juan Pérez",
  "identificacion": "1234567890",
  "celular": "3001234567",
  "fecha_inscripcion": "2024-01-15",
  "genero": "Masculino"
}

Deleting a Client

Clicking Eliminar on any row triggers a browser confirm() dialog with the message:
¿Eliminar a “[nombres]”? Esta acción no se puede deshacer.
If confirmed, clientesApi.eliminar(id) is called. On success, the row is removed from the local state immediately without requiring a full page reload.
// HTTP equivalent
DELETE http://localhost:3001/api/clientes/:id
Deleting a client is permanent and cannot be undone. All associated payment records and access history stored server-side may also be affected. Always confirm with the staff member before proceeding.

API Reference

MethodCallHTTP Equivalent
List all clientsclientesApi.listar()GET /api/clientes
Get single clientclientesApi.obtener(id)GET /api/clientes/:id
Create clientclientesApi.crear(data)POST /api/clientes
Update clientclientesApi.actualizar(id, data)PUT /api/clientes/:id
Delete clientclientesApi.eliminar(id)DELETE /api/clientes/:id

Build docs developers (and LLMs) love