Skip to main content

Proveedor

Supplier/vendor entity.
interface Proveedor {
  id: string
  nombre: string
  activo: boolean
  created_at: string
}

Fields

id
string
Unique identifier (UUID)
nombre
string
Supplier name
activo
boolean
Whether the supplier is active (true) or deactivated (false)
created_at
string
Timestamp of creation (ISO 8601 format)

Producto

Product entity.
interface Producto {
  id: string
  nombre: string
  descripcion: string | null
  activo: boolean
  created_at: string
}

Fields

id
string
Unique identifier (UUID)
nombre
string
Product name
descripcion
string | null
Optional product description
activo
boolean
Whether the product is active
created_at
string
Timestamp of creation (ISO 8601 format)

Presentacion

Product presentation/packaging entity.
interface Presentacion {
  id: string
  nombre: string
  activo: boolean
  created_at: string
}

Fields

id
string
Unique identifier (UUID)
nombre
string
Presentation name (e.g., “Botella”, “Tambor”, “Saco”)
activo
boolean
Whether the presentation is active
created_at
string
Timestamp of creation (ISO 8601 format)

Destino

Destination/department entity.
interface Destino {
  id: string
  nombre: string
  activo: boolean
  created_at: string
}

Fields

id
string
Unique identifier (UUID)
nombre
string
Destination name (e.g., “Laboratorio”, “CEDIS”, “Producción”)
activo
boolean
Whether the destination is active
created_at
string
Timestamp of creation (ISO 8601 format)

Estatus

Requisition status entity with color coding.
interface Estatus {
  id: string
  nombre: string
  color_hex: string
  activo: boolean
  created_at: string
}

Fields

id
string
Unique identifier (UUID)
nombre
string
Status name (e.g., “Pendiente”, “En Proceso”, “Entregado”)
color_hex
string
Color hex code for visual representation (e.g., ‘#FF5733’, ‘#28A745’)
activo
boolean
Whether the status is active
created_at
string
Timestamp of creation (ISO 8601 format)

Example

const statusPendiente: Estatus = {
  id: 'uuid-1',
  nombre: 'Pendiente',
  color_hex: '#FFC107',
  activo: true,
  created_at: '2026-01-01T00:00:00Z'
}

const statusEntregado: Estatus = {
  id: 'uuid-2',
  nombre: 'Entregado',
  color_hex: '#28A745',
  activo: true,
  created_at: '2026-01-01T00:00:00Z'
}

Unidad

Unit of measurement entity.
interface Unidad {
  id: string
  nombre: string
  abreviatura: string
  activo: boolean
  created_at: string
}

Fields

id
string
Unique identifier (UUID)
nombre
string
Full unit name (e.g., “Kilogramo”, “Litro”, “Pieza”)
abreviatura
string
Unit abbreviation (e.g., “kg”, “L”, “pza”)
activo
boolean
Whether the unit is active
created_at
string
Timestamp of creation (ISO 8601 format)

Example

const unitKg: Unidad = {
  id: 'uuid-1',
  nombre: 'Kilogramo',
  abreviatura: 'kg',
  activo: true,
  created_at: '2026-01-01T00:00:00Z'
}

const unitLitro: Unidad = {
  id: 'uuid-2',
  nombre: 'Litro',
  abreviatura: 'L',
  activo: true,
  created_at: '2026-01-01T00:00:00Z'
}

Catalogos

Aggregated catalog data structure containing all catalog arrays.
interface Catalogos {
  proveedores: Proveedor[]
  productos: Producto[]
  presentaciones: Presentacion[]
  destinos: Destino[]
  estatus: Estatus[]
  unidades: Unidad[]
}

Fields

proveedores
Proveedor[]
Array of all suppliers
productos
Producto[]
Array of all products
presentaciones
Presentacion[]
Array of all presentations
destinos
Destino[]
Array of all destinations
estatus
Estatus[]
Array of all statuses
unidades
Unidad[]
Array of all units

Example

import type { Catalogos } from '@/types'
import { getCatalogos } from '@/lib/actions/requisiciones'

// Fetch all catalogs
const catalogos: Catalogos = await getCatalogos()

// Use in form select options
const proveedorOptions = catalogos.proveedores
  .filter(p => p.activo)
  .map(p => ({
    value: p.id,
    label: p.nombre
  }))

const unidadOptions = catalogos.unidades
  .filter(u => u.activo)
  .map(u => ({
    value: u.id,
    label: `${u.nombre} (${u.abreviatura})`
  }))

Common Patterns

Active vs Inactive

All catalog entities have an activo (active) boolean field. Inactive entries are typically:
  • Hidden from dropdowns and selectors
  • Preserved in historical records
  • Still queryable for reporting
// Filter for active entries only
const activeProviders = catalogos.proveedores.filter(p => p.activo)

// Show all entries in admin view
const allProviders = catalogos.proveedores

Color-Coded Statuses

The Estatus entity includes color information for visual representation:
function getStatusBadge(status: Estatus) {
  return (
    <span 
      className="badge" 
      style={{ 
        backgroundColor: status.color_hex,
        color: '#ffffff'
      }}
    >
      {status.nombre}
    </span>
  )
}

Build docs developers (and LLMs) love