
<div class="w-full" style="font-size:14px; display:flex; flex-direction:column; gap:14px;">

    <?php if (isset($component)) { $__componentOriginal2544aeb3df80db4e8cf42f27632fe7f3 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal2544aeb3df80db4e8cf42f27632fe7f3 = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.cabecera','data' => ['rotulo' => 'Monitorización','titulo' => 'Acciones del panel','descripcion' => 'Todo lo que se ha hecho en el panel y lo que ha hecho el sistema por su cuenta. Los filtros van en la URL: se puede pegar el enlace de una búsqueda.']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('cabecera'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['rotulo' => 'Monitorización','titulo' => 'Acciones del panel','descripcion' => 'Todo lo que se ha hecho en el panel y lo que ha hecho el sistema por su cuenta. Los filtros van en la URL: se puede pegar el enlace de una búsqueda.']); ?>

         <?php $__env->slot('icono', null, []); ?> 
            <?php if (isset($component)) { $__componentOriginalb86967db162ccc0bceeb1ac50f169b8f = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalb86967db162ccc0bceeb1ac50f169b8f = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.nav-icon','data' => ['name' => 'clipboard','tint' => 'orange']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('nav-icon'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'clipboard','tint' => 'orange']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalb86967db162ccc0bceeb1ac50f169b8f)): ?>
<?php $attributes = $__attributesOriginalb86967db162ccc0bceeb1ac50f169b8f; ?>
<?php unset($__attributesOriginalb86967db162ccc0bceeb1ac50f169b8f); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalb86967db162ccc0bceeb1ac50f169b8f)): ?>
<?php $component = $__componentOriginalb86967db162ccc0bceeb1ac50f169b8f; ?>
<?php unset($__componentOriginalb86967db162ccc0bceeb1ac50f169b8f); ?>
<?php endif; ?>
         <?php $__env->endSlot(); ?>
     <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal2544aeb3df80db4e8cf42f27632fe7f3)): ?>
<?php $attributes = $__attributesOriginal2544aeb3df80db4e8cf42f27632fe7f3; ?>
<?php unset($__attributesOriginal2544aeb3df80db4e8cf42f27632fe7f3); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal2544aeb3df80db4e8cf42f27632fe7f3)): ?>
<?php $component = $__componentOriginal2544aeb3df80db4e8cf42f27632fe7f3; ?>
<?php unset($__componentOriginal2544aeb3df80db4e8cf42f27632fe7f3); ?>
<?php endif; ?>

    <?php echo $__env->make('livewire.monitoring.components.menu', ['selected' => 'system'], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>

    
    <div class="flex flex-col gap-3 rounded-xl border p-3 px-4"
         style="background:var(--surface-card); border-color:var(--border-subtle);">

        <div class="flex flex-wrap items-center gap-3">
            <div class="flex min-w-[240px] flex-1 items-center gap-2 rounded-lg border px-3 py-1.5"
                 style="border-color:var(--border-default); background:var(--surface-page);">
                <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="var(--text-subtle)" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" class="flex-none"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
                <input type="text" wire:model.live.debounce.300ms="busqueda"
                       placeholder="Cliente, dominio, motivo…"
                       class="min-w-0 flex-1 border-none bg-transparent p-0 text-[13px] focus:ring-0"
                       style="color:var(--text-body);">
                <div wire:loading wire:target="busqueda" class="flex-none">
                    <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="var(--text-subtle)" stroke-width="2" class="animate-spin"><path d="M21 12a9 9 0 1 1-6.22-8.56"/></svg>
                </div>
            </div>

            <div class="flex flex-none items-center gap-2">
                <span class="text-[11px] font-semibold uppercase tracking-[0.04em]" style="color:var(--text-subtle);">
                    Quién
                </span>
                
                <select wire:model.live="usuario"
                        class="rounded-lg border py-1.5 pl-2.5 pr-9 text-[12.5px] font-semibold focus:ring-0"
                        style="border-color:var(--border-default); background:var(--surface-page); color:var(--text-body);">
                    <option value="">Todos</option>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $responsables; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $id => $nombre): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($id); ?>"><?php echo e($nombre); ?></option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($hayDeSistema): ?>
                        <option value="0">Tarea programada o API</option>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </select>
            </div>

            <div class="flex flex-none gap-0.5 rounded-lg border p-[3px]"
                 style="background:var(--surface-page); border-color:var(--border-default);">
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = ['' => 'Todos'] + \App\Models\Monitoring\Log::NIVELES; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $clave => $etiqueta): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <button type="button" wire:click="$set('nivel', '<?php echo e($clave); ?>')"
                            class="rounded-md px-3 py-[5px] text-[12.5px] font-semibold transition-colors"
                            style="<?php echo \Illuminate\Support\Arr::toCssStyles([
                                'background:var(--neutral-800); color:#fff' => $nivel === (string) $clave,
                                'background:transparent; color:var(--text-muted)' => $nivel !== (string) $clave,
                            ]) ?>">
                        <?php echo e($etiqueta); ?>

                    </button>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </div>
        </div>

        <div class="flex flex-wrap items-center gap-3 border-t pt-3" style="border-color:var(--divider);">
            <div class="flex flex-none items-center gap-2">
                <span class="text-[11px] font-semibold uppercase tracking-[0.04em]" style="color:var(--text-subtle);">
                    Acción
                </span>
                <select wire:model.live="codigo"
                        class="rounded-lg border py-1.5 pl-2.5 pr-9 text-[12.5px] font-semibold focus:ring-0"
                        style="border-color:var(--border-default); background:var(--surface-page); color:var(--text-body);">
                    <option value="">Cualquiera</option>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $codigosUsados; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $codigoUsado): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <option value="<?php echo e($codigoUsado); ?>">
                            <?php echo e(\App\Models\Monitoring\Log::CODIGOS[$codigoUsado] ?? 'Código ' . $codigoUsado); ?>

                        </option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </select>
            </div>

            <div class="flex flex-none items-center gap-2">
                <span class="text-[11px] font-semibold uppercase tracking-[0.04em]" style="color:var(--text-subtle);">
                    Fechas
                </span>
                <input type="date" wire:model.live="desde" aria-label="Desde"
                       class="rounded-lg border px-2.5 py-1.5 text-[12.5px] focus:ring-0"
                       style="border-color:var(--border-default); background:var(--surface-page); color:var(--text-body);">
                <span class="text-[12px]" style="color:var(--text-subtle);">→</span>
                <input type="date" wire:model.live="hasta" aria-label="Hasta"
                       class="rounded-lg border px-2.5 py-1.5 text-[12.5px] focus:ring-0"
                       style="border-color:var(--border-default); background:var(--surface-page); color:var(--text-body);">
            </div>

            <div class="ml-auto flex flex-none items-center gap-2.5 text-[12.5px]" style="color:var(--text-muted);">
                <span>
                    <strong class="font-bold" style="color:var(--text-strong);"><?php echo e($filas->total()); ?></strong>
                    <?php echo e($filas->total() === 1 ? 'entrada' : 'entradas'); ?>

                </span>
                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($hayFiltros): ?>
                    <button type="button" wire:click="limpiarFiltros"
                            class="inline-flex items-center gap-1.5 border-none bg-transparent p-0 text-[12.5px] font-semibold hover:underline"
                            style="color:var(--text-link);">
                        <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="flex-none"><circle cx="12" cy="12" r="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>
                        Limpiar filtros
                    </button>
                <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
            </div>
        </div>
    </div>

    <section class="overflow-hidden rounded-xl border"
             style="background:var(--surface-card); border-color:var(--border-subtle);">

        <div class="px-5 pb-2.5 pt-3.5">
            <h2 style="font-family:'Plus Jakarta Sans',sans-serif; font-size:15px; font-weight:700; color:var(--text-strong); margin:0;">
                Acciones del panel
            </h2>
            <div class="mt-0.5 text-[12px]" style="color:var(--text-muted);">
                Lo último primero. «Tarea programada o API» significa que no lo hizo una persona.
            </div>
        </div>

        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($filas->isNotEmpty()): ?>
            <div class="mon-log-grid hidden border-b px-5 py-1.5 text-[11px] font-semibold uppercase tracking-[0.06em] lg:grid"
                 style="color:var(--text-muted); border-color:var(--divider);">
                <span>Cuándo</span><span>Quién</span><span>Nivel</span><span>Qué pasó</span>
            </div>

            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $filas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $fila): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <?php
                    $esPersona = $fila->user !== null;
                    [$colorNivel, $fondoNivel] = match ($fila->level) {
                        'danger' => ['var(--danger-500)', 'var(--danger-50)'],
                        'warning' => ['var(--warning-500)', 'var(--warning-50)'],
                        default => ['var(--neutral-600)', 'var(--surface-sunken)'],
                    };
                    $enlace = $fila->enlace();
                ?>

                <div class="mon-log-grid items-center border-b px-5 py-2 text-[12.5px] transition-colors hover:bg-[var(--surface-alt)]"
                     style="border-color:var(--divider);">

                    <span class="whitespace-nowrap font-mono text-[11.5px]" style="color:var(--text-muted);">
                        <?php echo e($fila->created_at?->format('d/m/Y H:i') ?? '—'); ?>

                    </span>

                    <div class="flex min-w-0 items-center gap-2">
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($esPersona): ?>
                            <span class="flex h-6 w-6 flex-none items-center justify-center rounded-full text-[9.5px] font-bold"
                                  style="background:var(--teal-100); color:var(--teal-700);">
                                <?php echo e(\Illuminate\Support\Str::of($fila->user->name)->explode(' ')->take(2)->map(fn ($p) => mb_strtoupper(mb_substr($p, 0, 1)))->implode('')); ?>

                            </span>
                            <span class="truncate font-semibold" style="color:var(--text-strong);">
                                <?php echo e($fila->user->name); ?>

                            </span>
                        <?php else: ?>
                            
                            <span class="flex h-6 w-6 flex-none items-center justify-center rounded-full"
                                  style="background:var(--surface-sunken); color:var(--text-subtle);">
                                <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M12 1v4"/><path d="M12 19v4"/><path d="m4.2 4.2 2.8 2.8"/><path d="m17 17 2.8 2.8"/><path d="M1 12h4"/><path d="M19 12h4"/><path d="m4.2 19.8 2.8-2.8"/><path d="m17 7 2.8-2.8"/></svg>
                            </span>
                            <span class="truncate" style="color:var(--text-muted);">Tarea programada o API</span>
                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                    </div>

                    <span>
                        <span class="rounded-full px-2 py-px text-[10.5px] font-semibold"
                              style="color:<?php echo e($colorNivel); ?>; background:<?php echo e($fondoNivel); ?>;">
                            <?php echo e(\App\Models\Monitoring\Log::NIVELES[$fila->level] ?? $fila->level); ?>

                        </span>
                    </span>

                    <div class="min-w-0">
                        <div class="font-semibold" style="color:var(--text-strong);">
                            <?php echo e($fila->descripcion); ?>

                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($enlace): ?>
                                
                                <a href="<?php echo e($enlace); ?>" wire:navigate
                                   class="ml-1 text-[11.5px] font-semibold" style="color:var(--text-link);">
                                    Ver ficha
                                </a>
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </div>
                        <div class="text-[11.5px]" style="color:var(--text-muted);"><?php echo e($fila->msg); ?></div>
                    </div>
                </div>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($filas->hasPages()): ?>
                <div class="px-5 py-2.5"><?php echo e($filas->links()); ?></div>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
        <?php else: ?>
            <div class="border-t px-5 pb-4 pt-3.5 text-[12.5px]" style="border-color:var(--divider); color:var(--text-muted);">
                Ninguna entrada con estos filtros.
            </div>
        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
    </section>

    
    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('admin.configs.edit')): ?>
        <section class="flex flex-wrap items-center justify-between gap-4 rounded-xl border border-dashed px-5 py-3"
                 style="border-color:var(--border-default);">
            <div class="max-w-[760px] text-[12px] leading-[1.5]" style="color:var(--text-subtle);">
                <strong class="font-semibold" style="color:var(--text-muted);">Limpiar el registro</strong>
                — borra filas de <span class="font-mono">logs</span> acotando por fechas, nivel,
                código y usuario. Nada las caduca solas: esto
                <strong class="font-semibold">es la auditoría</strong>, y ponerle un plazo
                automático sería tirar pruebas por un número que nadie ha decidido. El borrado
                queda apuntado aquí mismo.
            </div>
            <button type="button" wire:click="abrirLimpieza"
                    class="flex-none rounded-lg border px-3 py-1.5 text-[12.5px] font-semibold"
                    style="border-color:var(--border-default); background:var(--surface-page); color:var(--danger-500);">
                Limpiar el registro…
            </button>
        </section>
    <?php endif; ?>
</div><?php /**PATH /var/www/html/resources/views/livewire/monitoring/system-log.blade.php ENDPATH**/ ?>