> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rocky.global/llms.txt
> Use this file to discover all available pages before exploring further.

# FILTRO STATUS PARTICIPANTES

# Participant Filtering and Search System - Supervisor Role

## Implementation Summary

A complete participant filtering and search system optimized for the supervisor role has been implemented, with the following features:

## Implemented Features

### 1. **Dynamic Status Filter**

* Dropdown with all available statuses
* Participant count per status
* Filtering without reloading the page (AJAX)
* Button to clear filters

### 2. **Participant Search**

* Real-time search by name, email, or locator
* 500ms debounce to optimize queries
* Search within the JSON `details` field
* Button to clear search

### 3. **Optimized Pagination**

* Limit of 50 participants per page
* Dynamic navigation without reload
* Real-time updated pagination information

### 4. **Filtered Export**

* "Status" field included in the export options
* **Export respects applied filters**: only exports filtered participants
* Readable format: "PAGADO" for status "OK"
* Descriptive file names with applied filters
* Integration with the existing optimized export system

### 5. **Performance Optimizations**

#### Backend:

* **Optimized queries**: Only selects necessary fields
* **Statistics cache**: 5-minute cache for status counts
* **Database indexes**: Composite indexes for fast queries
* **LEFT JOIN**: To avoid data loss if there is no associated order
* **Optimized search**: Specific indexes for locator searches

#### Frontend:

* **Asynchronous loading**: Filters applied via AJAX
* **Search debounce**: 500ms to avoid excessive queries
* **Loading indicators**: Visual feedback during operations
* **Dynamic update**: No page reloads
* **Error handling**: Notifications for the user

## Files Modified

### 1. Controller

* `app/Http/Controllers/Eventos/EventosController.php`
  * `indexParticipants()` method optimized with search
  * Support for AJAX requests
  * Status statistics cache
  * Export with applied filters

### 2. View

* `resources/views/eventos/participants/index.blade.php`
  * Status filter and search interface
  * Dynamic table with JavaScript
  * Export modal updated with filter information

### 3. Export

* `app/Exports/ParticipantsExportOptimized.php`
  * Status field included in export
  * Support for status and search filters
  * Optimized data mapping

### 4. Routes

* `routes/eventos.php`
  * New route for AJAX filtering

### 5. Database

* New migration: `2025_09_23_235950_add_indexes_to_eventos_x_usuarios_for_status_filter.php`
  * Composite indexes for filter optimization
* New migration: `2025_09_24_000517_add_search_indexes_to_eventos_x_usuarios.php`
  * Indexes for search optimization

## Technical Features

### Optimizations for Large Datasets:

1. **Pagination**: Maximum 50 records per page
2. **Indexes**: Optimized queries with composite indexes
3. **Cache**: Statistics cached for 5 minutes
4. **Specific select**: Only necessary fields in queries
5. **LEFT JOIN**: Avoids data loss

### User Interface:

1. **No reloads**: Fully dynamic filtering
2. **Visual feedback**: Loading indicators and states
3. **Contextual information**: Counters and statistics
4. **Responsive**: Works on mobile devices

## Usage

1. **Access participants**: Supervisors are automatically redirected
2. **Filter by status**: Use the "Filter by Status" dropdown
3. **Search participants**: Use the "Search participants" field (name, email, locator)
4. **Clear filters**: "Clear Filters" button (removes filters and search)
5. **Export filtered**: The modal shows which filters are applied and exports only those results
6. **Navigate pages**: Dynamic pagination at the bottom

## Performance

* **Optimized queries** for events with 30,000+ participants
* **Intelligent cache** reduces repetitive queries
* **Efficient pagination** avoids server overload
* **Database indexes** speed up status filtering

## Compatibility

* Compatible with the existing optimized export system
* Maintains drawer functionality to view details
* Integrated with the existing notification system
* Works with the export validation middleware
