feat: página de comprobantes, búsqueda por email en conversaciones, quitar menús del bot

- Nueva página /chat/comprobantes: tabla paginada de solicitudes_recarga
  con búsqueda por email/nombre, filtros por estado y canal, botón "Ver chat"
- ShowConversaciones: búsqueda también por email del usuario autenticado
- ShowConversaciones: soporta ?conv=ID para abrir conversación desde comprobantes
- Nav: reemplaza "Menús del Bot" (no funcional) por "Comprobantes"
- SolicitudRecarga: relación user() agregada
- ChatController: método comprobantes() agregado

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro
2026-07-29 21:13:31 +00:00
co-authored by Claude Sonnet 4.6
parent 1572fb72cd
commit 60ddc4b9df
8 changed files with 184 additions and 5 deletions
+5
View File
@@ -14,6 +14,11 @@ class ChatController extends Controller
return view('chat.conversaciones');
}
public function comprobantes()
{
return view('chat.comprobantes');
}
public function menus()
{
return view('chat.menus');
@@ -0,0 +1,53 @@
<?php
namespace App\Http\Livewire\Chat;
use App\Models\ChatConversation;
use App\Models\SolicitudRecarga;
use Livewire\Component;
use Livewire\WithPagination;
class ShowComprobantes extends Component
{
use WithPagination;
public string $busqueda = '';
public string $filtroEstado = '';
public string $filtroCanal = '';
protected $queryString = [
'busqueda' => ['except' => ''],
'filtroEstado' => ['except' => ''],
'filtroCanal' => ['except' => ''],
];
public function updatingBusqueda(): void { $this->resetPage(); }
public function updatingFiltroEstado(): void { $this->resetPage(); }
public function updatingFiltroCanal(): void { $this->resetPage(); }
public function verChat(int $userId): void
{
$conv = ChatConversation::whereHas('contact', fn($q) => $q->where('user_id', $userId))
->orderByDesc('ultimo_mensaje_at')
->first();
if ($conv) {
$this->redirect(route('chat.conversaciones') . '?conv=' . $conv->id);
}
}
public function render()
{
$solicitudes = SolicitudRecarga::with('user')
->when($this->filtroEstado, fn($q) => $q->where('estado', $this->filtroEstado))
->when($this->filtroCanal, fn($q) => $q->where('canal', $this->filtroCanal))
->when($this->busqueda, fn($q) => $q->whereHas('user', fn($s) =>
$s->where('email', 'like', "%{$this->busqueda}%")
->orWhere('name', 'like', "%{$this->busqueda}%")
))
->orderByDesc('id')
->paginate(25);
return view('livewire.chat.show-comprobantes', compact('solicitudes'));
}
}
+11 -1
View File
@@ -15,6 +15,15 @@ class ShowConversaciones extends Component
public string $replyText = '';
public array $mensajes = [];
protected $queryString = ['convSelecId' => ['except' => null, 'as' => 'conv']];
public function mount(): void
{
if ($this->convSelecId) {
$this->cargarMensajes();
}
}
public function selectConv(int $convId): void
{
$this->convSelecId = $convId;
@@ -124,7 +133,8 @@ class ShowConversaciones extends Component
$q->whereHas('contact', function ($s) {
$s->where('nombre', 'like', "%{$this->busqueda}%")
->orWhere('telefono', 'like', "%{$this->busqueda}%")
->orWhere('canal_id', 'like', "%{$this->busqueda}%");
->orWhere('canal_id', 'like', "%{$this->busqueda}%")
->orWhereHas('user', fn($u) => $u->where('email', 'like', "%{$this->busqueda}%"));
});
})
->orderByDesc('ultimo_mensaje_at')