<?php if (isset($component)) { $__componentOriginale0f1cdd055772eb1d4a99981c240763e = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginale0f1cdd055772eb1d4a99981c240763e = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin-layout','data' => ['title' => 'Auditoria — OPCON']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin-layout'); ?>
<?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(['title' => 'Auditoria — OPCON']); ?>

<div style="max-width:960px;">

    
    <div style="margin-bottom:1.5rem;">
        <h1 style="font-size:1.375rem; font-weight:700; color:#1e3a5f; margin:0;">Auditoria do Sistema</h1>
        <p style="font-size:0.8125rem; color:#64748b; margin:0.25rem 0 0;">Registro completo de ações realizadas pelos usuários</p>
    </div>

    
    <form method="GET" action="<?php echo e(route('admin.auditoria')); ?>"
          style="background:#fff; border-radius:16px; border:1px solid #e2e8f0; padding:1rem 1.25rem; margin-bottom:1.25rem; display:flex; flex-wrap:wrap; gap:0.75rem; align-items:flex-end;">

        <div style="flex:1; min-width:160px;">
            <label style="display:block; font-size:0.75rem; font-weight:600; color:#374151; margin-bottom:0.375rem;">Usuário</label>
            <select name="user_id"
                    style="width:100%; padding:0.5rem 0.75rem; border:1px solid #e2e8f0; border-radius:8px; font-size:0.875rem; font-family:inherit; color:#1e3a5f; background:#fff; outline:none;">
                <option value="">Todos</option>
                <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $u): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($u->id); ?>" <?php echo e(request('user_id') == $u->id ? 'selected' : ''); ?>><?php echo e($u->name); ?></option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </select>
        </div>

        <div style="flex:1; min-width:140px;">
            <label style="display:block; font-size:0.75rem; font-weight:600; color:#374151; margin-bottom:0.375rem;">Tipo de ação</label>
            <select name="acao"
                    style="width:100%; padding:0.5rem 0.75rem; border:1px solid #e2e8f0; border-radius:8px; font-size:0.875rem; font-family:inherit; color:#1e3a5f; background:#fff; outline:none;">
                <option value="">Todas</option>
                <?php $__currentLoopData = ['lead','contrato','demanda','kanban','usuario','login','config']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ac): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($ac); ?>" <?php echo e(request('acao') === $ac ? 'selected' : ''); ?>><?php echo e(ucfirst($ac)); ?></option>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </select>
        </div>

        <div style="flex:1; min-width:140px;">
            <label style="display:block; font-size:0.75rem; font-weight:600; color:#374151; margin-bottom:0.375rem;">Data</label>
            <input type="date" name="data" value="<?php echo e(request('data')); ?>"
                   style="width:100%; padding:0.5rem 0.75rem; border:1px solid #e2e8f0; border-radius:8px; font-size:0.875rem; font-family:inherit; color:#1e3a5f; outline:none; box-sizing:border-box;">
        </div>

        <div style="display:flex; gap:0.5rem;">
            <button type="submit"
                    style="padding:0.5rem 1rem; background:#1e3a5f; color:#fff; border:none; border-radius:8px; font-size:0.875rem; font-weight:600; cursor:pointer; font-family:inherit; white-space:nowrap; transition:background 0.15s;"
                    onmouseover="this.style.background='#162d4a'" onmouseout="this.style.background='#1e3a5f'">
                Filtrar
            </button>
            <?php if(request()->hasAny(['user_id','acao','data'])): ?>
                <a href="<?php echo e(route('admin.auditoria')); ?>"
                   style="padding:0.5rem 0.875rem; border:1px solid #e2e8f0; border-radius:8px; font-size:0.875rem; color:#64748b; text-decoration:none; background:#fff; white-space:nowrap; transition:background 0.15s;"
                   onmouseover="this.style.background='#f8fafc'" onmouseout="this.style.background='#fff'">
                    Limpar
                </a>
            <?php endif; ?>
        </div>
    </form>

    
    <div style="background:#fff; border-radius:16px; border:1px solid #e2e8f0; overflow:hidden;">

        <?php if($logs->isEmpty()): ?>
            <div style="padding:3rem; text-align:center;">
                <div style="font-size:2rem; margin-bottom:0.5rem;">📋</div>
                <p style="font-size:0.9375rem; font-weight:600; color:#1e3a5f; margin:0;">Nenhum registro encontrado</p>
                <p style="font-size:0.8125rem; color:#94a3b8; margin:0.5rem 0 0;">Tente ajustar os filtros.</p>
            </div>
        <?php else: ?>
            <div style="overflow-x:auto;">
                <table style="width:100%; border-collapse:collapse; font-size:0.8125rem;">
                    <thead>
                        <tr style="background:#f8fafc; border-bottom:1px solid #e2e8f0;">
                            <th style="padding:0.75rem 1rem; text-align:left; font-size:0.6875rem; font-weight:700; text-transform:uppercase; letter-spacing:0.05em; color:#94a3b8; white-space:nowrap;">Data/Hora</th>
                            <th style="padding:0.75rem 1rem; text-align:left; font-size:0.6875rem; font-weight:700; text-transform:uppercase; letter-spacing:0.05em; color:#94a3b8;">Usuário</th>
                            <th style="padding:0.75rem 1rem; text-align:left; font-size:0.6875rem; font-weight:700; text-transform:uppercase; letter-spacing:0.05em; color:#94a3b8;">Ação</th>
                            <th style="padding:0.75rem 1rem; text-align:left; font-size:0.6875rem; font-weight:700; text-transform:uppercase; letter-spacing:0.05em; color:#94a3b8;">Descrição</th>
                            <th style="padding:0.75rem 1rem; text-align:left; font-size:0.6875rem; font-weight:700; text-transform:uppercase; letter-spacing:0.05em; color:#94a3b8; white-space:nowrap;">IP</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $__currentLoopData = $logs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $log): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr style="border-bottom:1px solid #f8fafc; transition:background 0.1s;"
                                onmouseover="this.style.background='#f8fafc'" onmouseout="this.style.background='transparent'">
                                <td style="padding:0.6875rem 1rem; color:#64748b; white-space:nowrap;">
                                    <?php echo e($log->created_at->format('d/m/Y')); ?><br>
                                    <span style="font-size:0.75rem; color:#94a3b8;"><?php echo e($log->created_at->format('H:i')); ?></span>
                                </td>
                                <td style="padding:0.6875rem 1rem;">
                                    <?php if($log->user): ?>
                                        <div style="display:flex; align-items:center; gap:0.5rem;">
                                            <div style="width:28px; height:28px; border-radius:50%; background:#1e3a5f; color:#fff; display:flex; align-items:center; justify-content:center; font-size:0.6875rem; font-weight:700; flex-shrink:0;">
                                                <?php echo e(strtoupper(substr($log->user->name, 0, 2))); ?>

                                            </div>
                                            <span style="font-weight:600; color:#1e3a5f; white-space:nowrap;"><?php echo e($log->user->name); ?></span>
                                        </div>
                                    <?php else: ?>
                                        <span style="color:#94a3b8;">Sistema</span>
                                    <?php endif; ?>
                                </td>
                                <td style="padding:0.6875rem 1rem;">
                                    <span style="display:inline-flex; align-items:center; gap:0.25rem; font-size:0.75rem; font-weight:600; padding:0.2rem 0.625rem; border-radius:100px; background:#f1f5f9; color:#374151;">
                                        <?php echo e($log->icone); ?> <?php echo e($log->acao); ?>

                                    </span>
                                </td>
                                <td style="padding:0.6875rem 1rem; color:#374151; max-width:300px;">
                                    <?php echo e($log->descricao); ?>

                                    <?php if($log->dados && count($log->dados)): ?>
                                        <button onclick="this.nextElementSibling.style.display = this.nextElementSibling.style.display === 'none' ? 'block' : 'none'; this.textContent = this.textContent === '▼ detalhes' ? '▲ fechar' : '▼ detalhes';"
                                                style="display:block; font-size:0.6875rem; color:#2563eb; background:none; border:none; cursor:pointer; padding:0.125rem 0; font-family:inherit;">
                                            ▼ detalhes
                                        </button>
                                        <div style="display:none; margin-top:0.375rem; padding:0.5rem; background:#f8fafc; border-radius:6px; font-size:0.6875rem; color:#64748b; white-space:pre-wrap; font-family:monospace; max-width:280px; overflow-x:auto;"><?php echo e(json_encode($log->dados, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)); ?></div>
                                    <?php endif; ?>
                                </td>
                                <td style="padding:0.6875rem 1rem; color:#94a3b8; font-size:0.75rem; white-space:nowrap;"><?php echo e($log->ip ?? '—'); ?></td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                </table>
            </div>

            
            <?php if($logs->hasPages()): ?>
                <div style="padding:0.875rem 1rem; border-top:1px solid #f1f5f9; display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:0.5rem;">
                    <p style="font-size:0.8125rem; color:#94a3b8; margin:0;">
                        Mostrando <?php echo e($logs->firstItem()); ?>–<?php echo e($logs->lastItem()); ?> de <?php echo e($logs->total()); ?> registros
                    </p>
                    <div style="display:flex; gap:0.25rem;">
                        <?php if($logs->onFirstPage()): ?>
                            <span style="padding:0.375rem 0.75rem; border:1px solid #e2e8f0; border-radius:7px; font-size:0.8125rem; color:#cbd5e1; cursor:not-allowed;">← Anterior</span>
                        <?php else: ?>
                            <a href="<?php echo e($logs->previousPageUrl()); ?>"
                               style="padding:0.375rem 0.75rem; border:1px solid #e2e8f0; border-radius:7px; font-size:0.8125rem; color:#64748b; text-decoration:none; transition:all 0.15s;"
                               onmouseover="this.style.background='#f8fafc'" onmouseout="this.style.background='transparent'">← Anterior</a>
                        <?php endif; ?>
                        <?php if($logs->hasMorePages()): ?>
                            <a href="<?php echo e($logs->nextPageUrl()); ?>"
                               style="padding:0.375rem 0.75rem; border:1px solid #e2e8f0; border-radius:7px; font-size:0.8125rem; color:#64748b; text-decoration:none; transition:all 0.15s;"
                               onmouseover="this.style.background='#f8fafc'" onmouseout="this.style.background='transparent'">Próximo →</a>
                        <?php else: ?>
                            <span style="padding:0.375rem 0.75rem; border:1px solid #e2e8f0; border-radius:7px; font-size:0.8125rem; color:#cbd5e1; cursor:not-allowed;">Próximo →</span>
                        <?php endif; ?>
                    </div>
                </div>
            <?php endif; ?>
        <?php endif; ?>
    </div>

    <p style="font-size:0.75rem; color:#94a3b8; margin-top:0.875rem; text-align:center;">
        Registros mantidos por 90 dias · Total no período: <?php echo e($logs->total()); ?>

    </p>
</div>

 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginale0f1cdd055772eb1d4a99981c240763e)): ?>
<?php $attributes = $__attributesOriginale0f1cdd055772eb1d4a99981c240763e; ?>
<?php unset($__attributesOriginale0f1cdd055772eb1d4a99981c240763e); ?>
<?php endif; ?>
<?php if (isset($__componentOriginale0f1cdd055772eb1d4a99981c240763e)): ?>
<?php $component = $__componentOriginale0f1cdd055772eb1d4a99981c240763e; ?>
<?php unset($__componentOriginale0f1cdd055772eb1d4a99981c240763e); ?>
<?php endif; ?>
<?php /**PATH C:\ProjetosWeb\OPCON\resources\views\pages\admin\auditoria.blade.php ENDPATH**/ ?>