Skip to main content

Price List Overview

Search and filter product price lists with advanced filtering options, statistics, and export capabilities.

Search Products

Search and filter products from the price list.
GET /lista-precios/search

Authentication & Permissions

Authorization
string
required
Valid session or Sanctum token
Requires:
  • ver-lista-precios permission

Query Parameters

Search term for product description or code
tipo
string
Product type/line filter
linea
string
Alias for tipo (product line)
clase
string
Product class filter
grupo
string
Product group filter
solo_con_stock
boolean
Filter to show only products with available inventory
order_by
string
default:"Descripcion"
Column to order by
order_direction
string
default:"asc"
Order direction (asc/desc)
per_page
integer
default:"50"
Results per page

Response

data
array
Array of product objects
current_page
integer
Current page number
per_page
integer
Results per page
total
integer
Total number of results
last_page
integer
Last page number

Product Object

Codigo
string
Product code
Descripcion
string
Product description
Tipo
string
Product type/line
Clase
string
Product class
Grupo
string
Product group
Precio
number
Product price
Inventario
number
Available inventory

Example Request

curl -X GET "https://your-domain.com/lista-precios/search?search=tornillo&tipo=Ferreteria&solo_con_stock=true&per_page=20" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Example Response

{
  "current_page": 1,
  "data": [
    {
      "Codigo": "TORN-001",
      "Descripcion": "Tornillo hexagonal 1/4 x 2\"",
      "Tipo": "Ferreteria",
      "Clase": "Tornilleria",
      "Grupo": "Hexagonal",
      "Precio": 150.50,
      "Inventario": 500
    },
    {
      "Codigo": "TORN-002",
      "Descripcion": "Tornillo phillips 3/8 x 1.5\"",
      "Tipo": "Ferreteria",
      "Clase": "Tornilleria",
      "Grupo": "Phillips",
      "Precio": 175.00,
      "Inventario": 350
    }
  ],
  "per_page": 20,
  "total": 45,
  "last_page": 3
}

Get Product Details

Retrieve detailed information about a specific product.
GET /lista-precios/producto/{codigo}

Path Parameters

codigo
string
required
Product code

Example Request

curl -X GET https://your-domain.com/lista-precios/producto/TORN-001 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Response

Returns complete product object or 404 if not found.
{
  "Codigo": "TORN-001",
  "Descripcion": "Tornillo hexagonal 1/4 x 2\"",
  "Tipo": "Ferreteria",
  "Clase": "Tornilleria",
  "Grupo": "Hexagonal",
  "Precio": 150.50,
  "Inventario": 500
}
Retrieve products related to a specific product.
GET /lista-precios/relacionados/{codigo}

Path Parameters

codigo
string
required
Product code

Response

productos
array
Array of related products
total
integer
Total number of related products

Example Request

curl -X GET https://your-domain.com/lista-precios/relacionados/TORN-001 \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Get Filter Options

Retrieve available filter options for the price list.
GET /lista-precios/api/filtros

Response

tipos
array
Available product types/lines
clases
array
Available product classes
grupos
array
Available product groups
estadisticas
object
Statistics about the product catalog

Example Response

{
  "tipos": ["Ferreteria", "Electricidad", "Plomeria"],
  "clases": ["Tornilleria", "Cables", "Tuberias"],
  "grupos": ["Hexagonal", "Phillips", "PVC"],
  "estadisticas": {
    "total_productos": 1250,
    "con_stock": 980,
    "sin_stock": 270
  }
}

Get Dynamic Filters

Get filter options based on selected tipo/clase.
GET /lista-precios/api/filtros-dinamicos

Query Parameters

tipo
string
Selected product type
clase
string
Selected product class

Response

clases
array
Classes available for selected tipo
grupos
array
Groups available for selected tipo/clase combination

Example Request

curl -X GET "https://your-domain.com/lista-precios/api/filtros-dinamicos?tipo=Ferreteria&clase=Tornilleria" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Accept: application/json"

Get Statistics

Retrieve price list statistics.
GET /lista-precios/api/estadisticas

Response

estadisticas
object
Statistics object
timestamp
string
ISO 8601 timestamp

Example Response

{
  "estadisticas": {
    "total_productos": 1250,
    "con_stock": 980,
    "sin_stock": 270,
    "total_tipos": 15,
    "total_clases": 45,
    "total_grupos": 120
  },
  "timestamp": "2026-03-04T10:30:00-05:00"
}

Export Price List

Export filtered price list to CSV.
GET /lista-precios/export

Query Parameters

Same as search endpoint:
search
string
Search term
tipo
string
Product type filter
clase
string
Product class filter
grupo
string
Product group filter
solo_con_stock
boolean
Only products with stock
export_type
string
default:"csv"
Export format (csv or excel)

Response

Returns a streamed CSV file download. Content-Type: text/csv; charset=utf-8 Filename: lista_precios_senco_{timestamp}.csv

Example Request

curl -X GET "https://your-domain.com/lista-precios/export?tipo=Ferreteria&export_type=csv" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -o price_list.csv

Export to PDF

Export price list to PDF format.
GET /lista-precios/pdf

Query Parameters

Same filtering parameters as search.

Response

Returns PDF file stream. Content-Type: application/pdf

Example Request

curl -X GET "https://your-domain.com/lista-precios/pdf?tipo=Ferreteria" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -o price_list.pdf

Implementation Notes

Source: app/Http/Controllers/ListaPreciosController.php

Service Layer

The controller uses ListaPreciosService for business logic:
  • sanitizarParametros() - Sanitize input parameters
  • getProductos() - Get paginated products
  • getFiltrosData() - Get filter options
  • getProductoDetalle() - Get product details
  • exportarCSV() - Generate CSV export
  • exportarExcel() - Generate Excel export
  • getProductosRelacionados() - Get related products
  • getClasesByTipo() - Get classes for a type
  • getGruposByTipoClase() - Get groups for type/class

Middleware

All routes require:
  • auth middleware
  • permission:ver-lista-precios

Build docs developers (and LLMs) love