Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Zapiony/PUCE_UZDI_2026/llms.txt

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

The Medidas module manages the catalogue of socio-educational measure types (medida_socioeducativa) that can be assigned to case files. Each catalogue entry defines a measure name and its standard duration in months. These catalogue records are referenced by expedientes through the mdso_id foreign key. Think of this module as the master list of available measure types — not the individual measure instances, which live inside each expediente.

Accessing the Module

  • Route: /app/medidas
  • Sidebar group: Gestión
  • Access: All authenticated roles can view, create, edit, and delete catalogue entries.

Table Features

On mount, MedidasView.vue loads all catalogue entries from GET /api/v1/medida-socioeducativa and applies all filtering and pagination client-side.
FeatureDetail
Rows per page8 (PAGE_SIZE = 8)
SearchMatches on nombre (measure name) or codigo (MED-NNNN display code)
ColumnsID (MED-NNNN) · Tipo de medida · Duración (meses) · Acciones
The search bar resets the current page to 1 on each keystroke (onSearchInput).

Auto-Generated Measure Codes

Like expediente codes, measure codes are computed client-side:
// medida.service.ts — getAll()
codigo: `MED-${String(m.id!).padStart(4, '0')}`
// e.g. MED-0007

Creating a Medida

1

Click 'Nueva medida'

Click the Nueva medida button (top-right toolbar). A md-size modal opens with a single Datos del catálogo section.
2

Fill the form

FieldTypeRequiredNotes
Nombre de la medidaTextDescriptive name, e.g. Libertad asistida (nombre)
Duración (meses)Number (min 1)Standard duration in months; leave blank if variable (duracion_meses)
The form uses two fields only. The Nombre de la medida field is the only required one — the save button is always enabled and the save handler sends duracion_meses: undefined when the duration field is left blank.
<!-- MedidasView.vue — modal form fields -->
<input class="f-ctl" v-model="form.nombre"
       placeholder="Ej: Libertad asistida" />
<input class="f-ctl" type="number" min="1"
       v-model="form.duracion"
       placeholder="Opcional. Ej: 12" />
3

Save the record

Click Guardar medida. The service sends:
POST /api/v1/medida-socioeducativa
Content-Type: application/json

{
  "nombre": "Libertad asistida",
  "duracion_meses": 12
}
On success the modal closes and cargarMedidas() refreshes the table.

Editing a Medida

1

Click the edit icon

Click the pencil icon in the Acciones column. The modal opens in edit mode, pre-filled from the selected row:
// MedidasView.vue — openEdit
Object.assign(form, {
  nombre:   row.nombre,
  duracion: row.duracion ?? '',
})
The modal title changes to Editar medida · MED-NNNN.
2

Modify fields

Update the name, the duration, or both.
3

Save changes

Click Guardar cambios. The service sends:
PATCH /api/v1/medida-socioeducativa/:id
Content-Type: application/json

{
  "nombre": "Libertad asistida actualizada",
  "duracion_meses": 18
}
Both nombre and duracion_meses are optional in the PATCH payload (Partial<MedidaPayload>), so you can update one field independently.

Deleting a Medida

1

Click the delete icon

Click the ban icon in the Acciones column. A small confirmation modal opens showing the measure name and code.
2

Confirm deletion

Click Eliminar registro. The service calls:
DELETE /api/v1/medida-socioeducativa/:id
The table refreshes on success.
A medida catalogue entry cannot be deleted while it is referenced by one or more expedientes (mdso_id foreign key constraint). The backend will return a 409 Conflict error. Remove or reassign all related expedientes first.

Field Reference

Field (form key)API keyTypeRequiredDescription
Nombre de la medidanombrestringHuman-readable measure type name
Duración (meses)duracion_mesesnumber | undefinedStandard duration; null stored if omitted

Service Layer Reference

All HTTP calls are delegated to medidaService (src/services/medida.service.ts):
// medida.service.ts
export const medidaService = {
  // GET /api/v1/medida-socioeducativa
  async getAll(): Promise<MedidaRow[]>,

  // POST /api/v1/medida-socioeducativa
  async create(payload: MedidaPayload): Promise<MedidaDto>,

  // PATCH /api/v1/medida-socioeducativa/:id
  async update(id: number, payload: Partial<MedidaPayload>): Promise<MedidaDto>,

  // DELETE /api/v1/medida-socioeducativa/:id
  async remove(id: number): Promise<void>,
}
getAll() maps raw DTOs into display rows, adding the codigo (MED-NNNN) display code and normalising duracion_meses to null when absent.

Relationship to Expedientes

The Medidas catalogue feeds the Medida socioeducativa dropdown in the Expediente creation form (ExpedientesView.vue). The selected m.id is stored as mdso_id on the expediente record. When the expediente list is rendered, medida.nombre is resolved through the backend relation and displayed in the Medida column.
The Medidas module is a catalogue (master data), not an individual-measure tracker. Tracking the actual application of a measure — start date, end date, state — is done through the Expedientes module.

Dashboard Integration

Expedientes grouped by their linked medida.nombre drive the DashBarChart (“Expedientes por tipo de medida”) on the Dashboard. The top 5 measure types by count are displayed. Adding or editing measure names here directly updates those chart labels on the next dashboard load.

Build docs developers (and LLMs) love