83 lines
5.6 KiB
PHP
83 lines
5.6 KiB
PHP
<div>
|
|
<div class="flex items-center justify-between mb-4">
|
|
<h1 class="text-2xl font-bold text-gray-800 flex items-center gap-2">
|
|
<svg class="w-7 h-7 text-green-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"/>
|
|
</svg>
|
|
Logs del Webhook
|
|
</h1>
|
|
<button wire:click="clearAll" wire:confirm="¿Eliminar TODOS los logs? Esta acción no se puede deshacer."
|
|
class="bg-red-500 hover:bg-red-600 text-white text-sm px-4 py-2 rounded-lg flex items-center gap-2 transition">
|
|
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>
|
|
Limpiar logs
|
|
</button>
|
|
</div>
|
|
|
|
<input wire:model.live.debounce.300ms="search" type="text" placeholder="Buscar en el payload..."
|
|
class="mb-4 border border-gray-300 rounded-lg px-4 py-2 text-sm w-64 focus:outline-none focus:ring-2 focus:ring-green-400">
|
|
|
|
<div class="bg-white rounded-xl shadow overflow-hidden">
|
|
<table class="w-full text-sm">
|
|
<thead class="bg-gray-50 border-b">
|
|
<tr>
|
|
<th class="px-4 py-3 text-left text-gray-600">ID</th>
|
|
<th class="px-4 py-3 text-left text-gray-600">Fecha</th>
|
|
<th class="px-4 py-3 text-center text-gray-600">HTTP</th>
|
|
<th class="px-4 py-3 text-left text-gray-600">Payload (preview)</th>
|
|
<th class="px-4 py-3 text-center text-gray-600">Acciones</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-100">
|
|
@forelse($logs as $log)
|
|
<tr class="hover:bg-gray-50">
|
|
<td class="px-4 py-3 text-gray-400 text-xs">{{ $log->id }}</td>
|
|
<td class="px-4 py-3 text-gray-600 text-xs">{{ $log->created_at?->format('d/m/Y H:i:s') }}</td>
|
|
<td class="px-4 py-3 text-center">
|
|
@if($log->status_code)
|
|
<span class="text-xs px-2 py-0.5 rounded-full {{ $log->status_code < 300 ? 'bg-green-100 text-green-700' : 'bg-red-100 text-red-600' }}">
|
|
{{ $log->status_code }}
|
|
</span>
|
|
@else
|
|
<span class="text-gray-400">—</span>
|
|
@endif
|
|
</td>
|
|
<td class="px-4 py-3 font-mono text-xs text-gray-500 max-w-md truncate">
|
|
{{ Str::limit($log->payload, 120) }}
|
|
</td>
|
|
<td class="px-4 py-3">
|
|
<div class="flex justify-center gap-2">
|
|
<button wire:click="viewLog({{ $log->id }})"
|
|
class="text-blue-500 hover:text-blue-700 transition" title="Ver detalle">
|
|
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/></svg>
|
|
</button>
|
|
<button wire:click="deleteLog({{ $log->id }})"
|
|
class="text-red-400 hover:text-red-600 transition" title="Eliminar">
|
|
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>
|
|
</button>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr><td colspan="5" class="px-4 py-8 text-center text-gray-400">No hay logs registrados</td></tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
<div class="p-3 border-t border-gray-100">{{ $logs->links() }}</div>
|
|
</div>
|
|
|
|
{{-- Modal detalle payload --}}
|
|
@if($viewId)
|
|
<div class="fixed inset-0 bg-black/60 z-50 flex items-center justify-center p-4">
|
|
<div class="bg-white rounded-2xl shadow-xl w-full max-w-3xl p-6 max-h-[80vh] flex flex-col">
|
|
<div class="flex justify-between items-center mb-4">
|
|
<h3 class="font-bold text-gray-800">Log #{{ $viewId }} — Payload completo</h3>
|
|
<button wire:click="clearView" class="text-gray-400 hover:text-gray-700">
|
|
<svg class="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
|
|
</button>
|
|
</div>
|
|
<pre class="overflow-auto flex-1 bg-gray-900 text-green-400 text-xs rounded-lg p-4 font-mono">{{ $viewPayload }}</pre>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div>
|