@extends('adminlte::page') @section('title', 'Logs') @section('content_header') @stop @section('content') @php $filtroNivel = $filtros['nivel'] ?? ''; $resultadoCount = $logs->total(); $nivelLabels = [ 'warning' => 'Aviso', 'error' => 'Erro', 'debug' => 'Debug', 'critical' => 'Crítico', ]; $nivelPills = [ 'warning' => ['icon' => 'fa-exclamation-triangle', 'class' => 'warning'], 'error' => ['icon' => 'fa-times-circle', 'class' => 'error'], 'debug' => ['icon' => 'fa-bug', 'class' => 'debug'], 'critical' => ['icon' => 'fa-skull-crossbones', 'class' => 'critical'], ]; $errosCriticos = ($stats['error'] ?? 0) + ($stats['critical'] ?? 0); $chartDias = (int) ($filtros['chart_dias'] ?? 14); $chartQueryBase = request()->except(['chart_dias', 'chart_inicio', 'chart_fim', 'page']); @endphp
@if(($instalacoesShipperParado ?? collect())->isNotEmpty()) @endif {{-- Hero --}}

Monitoramento

Central de logs

@if($temFiltros ?? false) {{ number_format($resultadoCount, 0, ',', '.') }} registro(s) com filtros aplicados · {{ number_format($stats['total'] ?? 0, 0, ',', '.') }} não resolvido(s) no escopo @else {{ number_format($resultadoCount, 0, ',', '.') }} eventos não resolvidos · push automático das APIs tenant (POST /api/v1/logs/receber) @endif

{{-- KPIs — somente não resolvidos --}}

{{ number_format($stats['total'] ?? 0, 0, ',', '.') }}

Não resolvidos

{{ number_format($stats['error'] ?? 0, 0, ',', '.') }}

Erros (pendentes)

{{ number_format($stats['warning'] ?? 0, 0, ',', '.') }}

Avisos (pendentes)

{{ number_format($stats['critical'] ?? 0, 0, ',', '.') }}

Críticos (pendentes)

@if(($bugsPendentes ?? 0) > 0 && empty($filtroNivel)) {{ $bugsPendentes }} bug(s) pendente(s) — gerar relatório para correção no Cursor @endif @if($errosCriticos > 0 && empty($filtroNivel)) {{ $errosCriticos }} erro(s)/crítico(s) não resolvido(s) no escopo — clique para filtrar @endif {{-- Gráfico diário --}}

Logs por dia

{{ \Carbon\Carbon::parse($chart['inicio'])->format('d/m/Y') }} – {{ \Carbon\Carbon::parse($chart['fim'])->format('d/m/Y') }}
@foreach([7 => '7 dias', 14 => '14 dias', 30 => '30 dias', 60 => '60 dias'] as $dias => $label) {{ $label }} @endforeach
@foreach(request()->except(['chart_inicio', 'chart_fim', 'chart_dias', 'page']) as $key => $value) @if(is_scalar($value) && $value !== '') @endif @endforeach
Não resolvidos Resolvidos
{{-- Filtros --}}

Filtros e busca

@foreach($nivelPills as $nivel => $meta) @php $isActive = $filtroNivel === $nivel; $pillUrl = $isActive ? route('logs.index', request()->except('nivel', 'page')) : route('logs.index', array_merge(request()->except('nivel', 'page'), ['nivel' => $nivel])); @endphp {{ strtoupper($nivelLabels[$nivel] ?? $nivel) }} @endforeach
@if($temFiltros ?? false)
Filtros ativos: @if($filtroNivel) Nível: {{ $nivelLabels[$filtroNivel] ?? $filtroNivel }} @endif @if($filtros['instalacao_id'] ?? null) @php $instSel = $instalacoes->firstWhere('id', (int) $filtros['instalacao_id']); @endphp Instalação: {{ $instSel->nome ?? $filtros['instalacao_id'] }} @endif @if($filtros['data'] ?? null) Data: {{ \Carbon\Carbon::parse($filtros['data'])->format('d/m/Y') }} @endif @if($filtros['busca'] ?? null) Busca: {{ Str::limit($filtros['busca'], 40) }} @endif Limpar todos
@endif
@if($filtroNivel) @endif @if($filtros['chart_dias'] ?? null) @endif @if($filtros['chart_inicio'] ?? null) @endif @if($filtros['chart_fim'] ?? null) @endif
Limpar
{{-- Tabela --}}

Eventos de log

{{ number_format($resultadoCount, 0, ',', '.') }} registro(s)
@if($logs->isNotEmpty())
@foreach($logs as $log) @php $tipoClass = in_array($log->tipo, ['info', 'warning', 'error', 'debug', 'critical'], true) ? $log->tipo : 'default'; @endphp @endforeach
Timestamp Instalação Nível Mensagem Ações
{{ $log->created_at->format('d/m/Y') }} {{ $log->created_at->format('H:i:s') }} {{ $log->instalacao->nome ?? 'N/A' }} {{ strtoupper($log->tipo) }} {{ Str::limit($log->mensagem_viewer, 200) }} @if($log->contexto) {{ Str::limit($log->contexto_viewer, 120) }} @endif
@if($logs->hasPages())
Exibindo {{ $logs->firstItem() }}–{{ $logs->lastItem() }} de {{ $logs->total() }}
{{ $logs->appends(request()->query())->onEachSide(1)->links() }}
@endif
@else
@if($temFiltros ?? false)

Nenhum log encontrado com os filtros aplicados.

Limpar filtros @else

Ainda não há logs registrados. As instalações enviam eventos via POST /api/v1/logs/receber.

@endif
@endif
@stop @section('css') @stop @section('js') @stop