Overview
The Price List module provides a comprehensive interface for searching and managing product catalogs with real-time inventory data. It connects to SQL Server views and offers advanced filtering, search, and export capabilities. Controller:ListaPreciosController (app/Http/Controllers/ListaPreciosController.php:13)Model:
ListaPrecio (app/Models/ListaPrecio.php:8)Service:
ListaPreciosService (app/Services/ListaPreciosService.php)Vue Components:
resources/js/Pages/ListaPrecios/Index.vueresources/js/Pages/ListaPrecios/Partials/SearchBar.vueresources/js/Pages/ListaPrecios/Partials/ProductTable.vueresources/js/Pages/ListaPrecios/Partials/ProductFilters.vue
Key Features
Advanced Search
Search across multiple fields: code, reference, description, type, class, group, subgroup
Dynamic Filters
Filter by Type (Tipo), Class (Clase), Group (Grupo) with cascading options
Inventory Tracking
Real-time stock information with filter for products with available inventory
Export Options
Export to CSV or Excel with applied filters
Data Model
TheListaPrecio model connects to SQL Server view dbo.Senco_View_listaprecios_inventario:
Product Attributes
- Tipo: Product type/line
- Clase: Product class
- Grupo: Product group
- Subgrupo: Product subgroup
- Referencia: Product reference code
- Cod Max: Unique product code (primary key)
- Descripcion: Product description
- MLiCaja: Milliliters per box
- CJiCRTN: Boxes per carton
- Precio: Product price
- Minimo: Minimum price
- 30CJ: Price for 30 boxes
- 60CJ: Price for 60 boxes
- 100CJ: Price for 100 boxes
- Inventario: Current inventory
Model Scopes
The model provides query scopes for efficient filtering (ListaPrecio.php:70-169):search($search): Multi-field search with case-insensitive collationfilterByTipo($tipo): Filter by typefilterByClase($clase): Filter by classfilterByGrupo($grupo): Filter by groupfilterByLinea($linea): Alias for filterByTipowithStock(): Products with inventory > 0orderByField($field, $direction): Custom sorting with special handling
API Endpoints
View Price List
search: Search termtipo: Filter by typeclase: Filter by classgrupo: Filter by grouplinea: Alias for tiposolo_con_stock: Boolean - show only products with inventoryorder_by: Sort field (default: ‘Tipo’)order_direction: ‘asc’ or ‘desc’ (default: ‘asc’)per_page: Results per page (default: 15)
productos: Paginated product resultstipos: Available types for filterclases: Available classes for filtergrupos: Available groups for filterestadisticas: Product statisticsfilters: Current filter values
ver-lista-precios
AJAX Search
Get Product Details
codigo: Product code (Cod Max)
Get Related Products
Export to CSV/Excel
- Same as main view endpoint
export_type: ‘csv’ or ‘excel’
Filename Format:
lista_precios_senco_YYYY-MM-DD_HHMMSS.csv
Implementation: ListaPreciosController.php:98-129
Export to PDF
Get Filter Options
Get Dynamic Filters
tipo: Selected type (to get relevant classes)clase: Selected class (to get relevant groups)
Get Statistics
User Interface
The price list interface consists of modular Vue components:Main View (Index.vue)
- Debounced search with 500ms delay
- Real-time filter updates with preserveState
- Pagination controls
- Export buttons
- Loading states
Search Bar Component
- Full-text search input
- Search across multiple fields
- Clear search button
Product Filters Component
- Type dropdown (Tipo/Línea)
- Class dropdown (Clase)
- Group dropdown (Grupo)
- Stock filter checkbox
- Dynamic filter cascading
- Clear all filters button
Product Table Component
- Sortable columns
- Product details modal
- Inventory status indicators
- Price tiers display
- Packaging information
Special Features
Case-Insensitive Search
All searches use SQL Server collationLatin1_General_CI_AI for accent-insensitive, case-insensitive matching:
Custom Sorting
When sorting by Type in ascending order, “ELEMENTOS DE SUJECION” appears first:Inventory Status
Products include anestado_inventario accessor:
sin_stock: Inventory = 0bajo: Inventory < 10medio: Inventory < 50alto: Inventory >= 50
Route Configuration
All price list routes require thever-lista-precios permission (routes/web.php:196-224):
Performance Optimization
The service layer (
ListaPreciosService) handles data sanitization, query optimization, and caching of filter options to minimize database queries.Database Connection: This module uses the
sqlsrv connection defined in config/database.php. Ensure SQL Server drivers are properly configured.