Skip to main content

Documentation 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.

Despachos (also referred to as Salidas) are the outbound movement records that capture the delivery of warehouse materials to employees. Accessible at /salidas, each Despacho documents who received the materials, why they were requested, and which specific stock items were issued in what quantities. Once created, a dispatch can be exported as a formal signed PDF acta — a physical document that serves as the official record of the handover.

Data Model

The Salida schema represents a single dispatch record.
id_salida
number
required
Auto-generated primary key for the dispatch.
numero_salida
string
required
Human-readable dispatch number (e.g. SAL-001). Must be unique.
fecha_salida
string
required
ISO-8601 date string for when the dispatch occurred (e.g. 2025-01-20).
existencia_validada
boolean
required
Indicates whether available stock was confirmed before issuing the dispatch. Set to true when a warehouse operator has verified that the requested quantities are in stock.
motivo_solicitud
string | null
Free-text explanation of why the materials are being dispatched (e.g. "Mantenimiento mensual"). Optional.
fk_id_empleado_recibe
number
required
Foreign key referencing the employee (empleados) who is receiving the dispatched materials.
fk_id_gerente_finanzas
number | null
Foreign key referencing the finance manager responsible for approving or reviewing the dispatch. Optional; set to null when no finance review is required.
fk_id_presidente
number | null
Foreign key referencing the president for high-level approval. Optional; set to null when presidential sign-off is not required.
observacion
string | null
Additional free-text notes about the dispatch. Optional.

Workflow

A Despacho moves through a defined lifecycle from initial creation to final signed documentation.
1

Create the Dispatch

A warehouse operator opens the Nueva Salida de Almacén dialog at /salidas, enters the dispatch number, date, and selects the employee who will receive the materials (fk_id_empleado_recibe). A reason (motivo_solicitud) may be provided to document the purpose of the request.
2

Validate Stock Availability

Before adding material lines, the operator checks the Existencia Validada checkbox to confirm that the requested items are physically available in the warehouse. Setting existencia_validada to true signals that a stock check has been performed and the dispatch is cleared to proceed.
3

Add Material Lines

Materials are selected from the live existencias list, which shows each item alongside its current available quantity (cantidad_actual). The operator enters the Cantidad for each item and clicks Agregar to add it to the dispatch table. Each stock entry (existencia) can only appear once per dispatch. Both cantidad_solicitada and cantidad_entregada are recorded per line.
4

Link Approvers (Optional)

If the dispatch requires formal sign-off, fk_id_gerente_finanzas and fk_id_presidente can be linked to the record to associate the relevant approvers before or after creation.
5

Submit and Generate the PDF Acta

Clicking Guardar Salida persists the dispatch and decrements stock quantities on the backend. After saving, download the PDF acta from the dispatch list to obtain the formal signed document for physical records.
Saving a Despacho automatically decreases the warehouse stock (existencias) quantities for every material line in the dispatch. No separate stock adjustment step is needed.

PDF Generation

Each dispatch can be exported as a formatted PDF acta that serves as the official handover document. The download is triggered via the downloadSalidaPdf function in the salidas API client. How it works:
  1. Calls GET /salidas/:id/pdf with responseType: 'blob' to receive the binary PDF data.
  2. Creates a temporary in-memory object URL from the response blob.
  3. Programmatically clicks a hidden <a> element to trigger the browser’s native file download.
  4. The file is saved as acta-salida-{id}.pdf (e.g. acta-salida-42.pdf).
  5. Cleans up by removing the temporary DOM element and revoking the object URL.
import { downloadSalidaPdf } from '@/features/salidas/api/salidas'

// Trigger download for dispatch with id_salida = 42
await downloadSalidaPdf(42)
// → saves "acta-salida-42.pdf" to the user's Downloads folder
In the dispatch list view, each row exposes a PDF button (with a FileDown icon) that calls downloadSalidaPdf directly with the row’s id_salida.
Download the PDF immediately after creating the dispatch to have the signed acta ready for physical filing. The PDF reflects the dispatch data at the time of the request — including material lines, employee recipient, and any associated approver references.

API Operations

List All Dispatches

Returns all Salida records in the system.
GET /salidas
[
  {
    "id_salida": 42,
    "numero_salida": "SAL-001",
    "fecha_salida": "2025-01-20",
    "existencia_validada": true,
    "motivo_solicitud": "Mantenimiento mensual",
    "fk_id_empleado_recibe": 7,
    "fk_id_gerente_finanzas": 2,
    "fk_id_presidente": null,
    "observacion": null
  }
]

Create a Dispatch

Creates a new Despacho and its material detail lines in a single request. The backend decrements warehouse stock for all materials in detalles.
POST /salidas
Request body:
{
  "numero_salida": "SAL-001",
  "fecha_salida": "2025-01-20",
  "existencia_validada": true,
  "motivo_solicitud": "Mantenimiento mensual",
  "fk_id_empleado_recibe": 7,
  "fk_id_gerente_finanzas": 2,
  "observacion": null,
  "detalles": [
    {
      "fk_id_existencia": 11,
      "cantidad_solicitada": 10,
      "cantidad_entregada": 10
    }
  ]
}
numero_salida
string
required
Unique dispatch number (e.g. SAL-001).
fecha_salida
string
required
Dispatch date in YYYY-MM-DD format.
existencia_validada
boolean
Whether stock availability was confirmed prior to dispatch. Defaults to false.
motivo_solicitud
string
Reason for the material request. Optional.
fk_id_empleado_recibe
number
required
ID of the employee receiving the materials.
fk_id_gerente_finanzas
number
ID of the finance manager approver. Optional.
fk_id_presidente
number
ID of the presidential approver. Optional.
observacion
string
Additional notes. Optional; pass null to omit.
detalles
array
required
Array of stock-line items to dispatch. Each element requires fk_id_existencia (number — the existencia record ID, not fk_id_material), cantidad_solicitada (number > 0), and cantidad_entregada (number > 0). Minimum one item required.

Download PDF Acta

Returns the binary PDF document for the specified dispatch. The client must set responseType: 'blob' to handle the binary response correctly.
GET /salidas/:id/pdf
id
number
required
The id_salida of the dispatch whose acta should be downloaded.
Response: Binary PDF blob. The frontend downloadSalidaPdf(id) function handles blob-to-file conversion automatically and saves the file as acta-salida-{id}.pdf.
Requesting the PDF for a dispatch id that does not exist will return an error. Always confirm the dispatch was successfully created before attempting to download its acta.

Build docs developers (and LLMs) love