Relatório Detalhado – Indicadores de TI

Gerado em {{ now()->format('d/m/Y H:i') }} | Total: {{ $total }} chamados @if (!empty($filters['data_inicio']) || !empty($filters['data_fim'])) | Período: {{ !empty($filters['data_inicio']) ? \Carbon\Carbon::parse($filters['data_inicio'])->format('d/m/Y') : '—' }} a {{ !empty($filters['data_fim']) ? \Carbon\Carbon::parse($filters['data_fim'])->format('d/m/Y') : '—' }} @endif @if (!empty($filters['status'])) | Status: {{ __(\App\Models\IndicadoresTi\Chamado::STATUS[$filters['status']] ?? $filters['status']) }} @endif @if (!empty($filters['prioridade'])) | Prioridade: {{ __(\App\Models\IndicadoresTi\Chamado::PRIORIDADE[$filters['prioridade']] ?? $filters['prioridade']) }} @endif
@include('admin.indicadoresTi.reports.partials._kpi_card', [ 'value' => $total, 'label' => 'Total', 'bg' => '#f4f4f4', 'color' => '#111', 'width' => '20%', ]) @include('admin.indicadoresTi.reports.partials._kpi_card', [ 'value' => $porStatus['atendido'] ?? 0, 'label' => 'Atendidos', 'bg' => '#d1fae5', 'color' => '#065f46', 'width' => '20%', ]) @include('admin.indicadoresTi.reports.partials._kpi_card', [ 'value' => $porStatus['pendente'] ?? 0, 'label' => 'Pendentes', 'bg' => '#fef3c7', 'color' => '#92400e', 'width' => '20%', ]) @include('admin.indicadoresTi.reports.partials._kpi_card', [ 'value' => $porStatus['em_andamento'] ?? 0, 'label' => 'Em Andamento', 'bg' => '#dbeafe', 'color' => '#1e40af', 'width' => '20%', ]) @include('admin.indicadoresTi.reports.partials._kpi_card', [ 'value' => $porStatus['cancelado'] ?? 0, 'label' => 'Cancelados', 'bg' => '#f1f5f9', 'color' => '#475569', 'width' => '20%', ])
@php use App\Services\Reports\SvgChartBuilder; use App\Models\IndicadoresTi\Chamado; $chart = new SvgChartBuilder(); $statusColors = ['#4F46E5', '#F59E0B', '#10B981', '#6c757d']; $prioColors = ['#10B981', '#F59E0B', '#EF4444', '#8B5CF6']; $tipoColors = ['#4F46E5', '#10B981', '#F59E0B', '#EF4444', '#06B6D4']; $canalColors = ['#8B5CF6', '#06B6D4', '#F59E0B', '#10B981']; $statusData = []; foreach (Chamado::STATUS as $v => $l) { if (($porStatus[$v] ?? 0) > 0) { $statusData[__($l)] = $porStatus[$v]; } } $prioData = []; foreach (Chamado::PRIORIDADE as $v => $l) { if (($porPrioridade[$v] ?? 0) > 0) { $prioData[__($l)] = $porPrioridade[$v]; } } $tipoData = []; foreach (Chamado::TIPO as $v => $l) { if (($porTipo[$v] ?? 0) > 0) { $tipoData[__($l)] = $porTipo[$v]; } } $canalData = []; foreach (Chamado::CANAL as $v => $l) { if (($porCanal[$v] ?? 0) > 0) { $canalData[__($l)] = $porCanal[$v]; } } $setorData = collect($porSetor) ->sortByDesc('total') ->take(10) ->mapWithKeys(fn($r) => [$r['nome'] => $r['total']]) ->toArray(); $svgStatus = $chart->donutChart($statusData, 90, $statusColors); $svgPrio = $chart->donutChart($prioData, 90, $prioColors); $svgTipo = $chart->donutChart($tipoData, 90, $tipoColors); $svgCanal = $chart->donutChart($canalData, 90, $canalColors); $svgSetores = $chart->horizontalBars($setorData, 680, max(count($setorData) * 16, 60)); @endphp @php $donuts = [ [ 'svg' => $svgStatus, 'title' => 'Por Status', 'items' => Chamado::STATUS, 'counts' => $porStatus, 'colors' => $statusColors, ], [ 'svg' => $svgPrio, 'title' => 'Por Prioridade', 'items' => Chamado::PRIORIDADE, 'counts' => $porPrioridade, 'colors' => $prioColors, ], [ 'svg' => $svgTipo, 'title' => 'Por Tipo', 'items' => Chamado::TIPO, 'counts' => $porTipo, 'colors' => $tipoColors, ], [ 'svg' => $svgCanal, 'title' => 'Por Canal', 'items' => Chamado::CANAL, 'counts' => $porCanal, 'colors' => $canalColors, ], ]; @endphp @foreach ($donuts as $idx => $d) @php $borderR = $idx < 3 ? 'border-right:1px solid #e5e7eb;' : ''; $padL = $idx > 0 ? 'padding-left:10px;' : ''; $padR = $idx < 3 ? 'padding-right:10px;' : ''; @endphp @endforeach
{{ $d['title'] }}
{!! $d['svg'] !!}
@php $ci = 0; @endphp @foreach ($d['items'] as $v => $l) @php $q = $d['counts'][$v] ?? 0; @endphp @if ($q > 0) @php $p = $total > 0 ? round($q / $total * 100, 1) : 0; @endphp @php $ci++; @endphp @endif @endforeach
{{ __($l) }} {{ $q }} ({{ $p }}%)
Volume por Setor
{!! $svgSetores !!}
Chamados por Setor
@forelse ($porSetor as $row) @php $pct = $total > 0 ? round($row['total'] / $total * 100, 1) : 0; @endphp @empty @endforelse
Setor Total Atend. Pend. Em And. %
{{ $row['nome'] }} {{ $row['total'] }} {{ $row['atendidos'] }} {{ $row['pendentes'] }} {{ $row['em_andamento'] }} {{ $pct }}%
Nenhum dado encontrado.
TOTAL {{ $total }} {{ $porStatus['atendido'] ?? 0 }} {{ $porStatus['pendente'] ?? 0 }} {{ $porStatus['em_andamento'] ?? 0 }} 100%
Chamados por Assunto
@forelse ($porAssunto as $row) @empty @endforelse
Assunto Setor Total Atend. %
{{ $row['nome'] }} {{ $row['setor'] }} {{ $row['total'] }} {{ $row['atendidos'] }} {{ $total > 0 ? round(($row['total'] / $total) * 100, 1) : 0 }}%
Nenhum dado encontrado.
Chamados por Subassunto
@forelse ($porSubassunto as $row) @empty @endforelse
Assunto › Subassunto Total Atend. %
{{ $row['chave'] }} {{ $row['total'] }} {{ $row['atendidos'] }} {{ $total > 0 ? round(($row['total'] / $total) * 100, 1) : 0 }}%
Nenhum dado encontrado.