diff --git a/app/Http/Livewire/ReversarCompra.php b/app/Http/Livewire/ReversarCompra.php index 24df868..8e70557 100644 --- a/app/Http/Livewire/ReversarCompra.php +++ b/app/Http/Livewire/ReversarCompra.php @@ -18,15 +18,17 @@ class ReversarCompra extends Component use WithPagination; public $buscar; + public $fecha_desde; + public $fecha_hasta; public $confirmando_id = null; - protected $listeners = ['confirmarReversar']; - public function render() { $consulta = Historiale::with('vendedor', 'cliente', 'tarifa.servicio', 'promocion', 'cuentas') ->where('estado', 'activo') ->orderBy('id', 'DESC') + ->when(!empty($this->fecha_desde), fn($q) => $q->whereDate('created_at', '>=', $this->fecha_desde)) + ->when(!empty($this->fecha_hasta), fn($q) => $q->whereDate('created_at', '<=', $this->fecha_hasta)) ->when(!empty($this->buscar), function ($query) { $query->where(function ($q) { $q->where('id', 'ILIKE', '%' . $this->buscar . '%') diff --git a/resources/views/livewire/reversar-compra.blade.php b/resources/views/livewire/reversar-compra.blade.php index b27c375..95de274 100644 --- a/resources/views/livewire/reversar-compra.blade.php +++ b/resources/views/livewire/reversar-compra.blade.php @@ -1,8 +1,15 @@