Relatório Resumido – 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
@include('admin.indicadoresTi.reports.partials._kpi_card', [ 'value' => $total, 'label' => 'Total', 'bg' => '#f4f4f4', 'color' => '#111', 'width' => '25%', ]) @include('admin.indicadoresTi.reports.partials._kpi_card', [ 'value' => $porStatus['atendido'] ?? 0, 'label' => 'Atendidos', 'bg' => '#d1fae5', 'color' => '#065f46', 'width' => '25%', ]) @include('admin.indicadoresTi.reports.partials._kpi_card', [ 'value' => $porStatus['pendente'] ?? 0, 'label' => 'Pendentes', 'bg' => '#fef3c7', 'color' => '#92400e', 'width' => '25%', ]) @include('admin.indicadoresTi.reports.partials._kpi_card', [ 'value' => $porStatus['em_andamento'] ?? 0, 'label' => 'Em Andamento', 'bg' => '#dbeafe', 'color' => '#1e40af', 'width' => '25%', ])
@php use App\Services\Reports\SvgChartBuilder; use App\Models\IndicadoresTi\Chamado; $chart = new SvgChartBuilder(); $statusColors = ['#4F46E5', '#F59E0B', '#10B981', '#6c757d']; $statusData = []; foreach (Chamado::STATUS as $v => $l) { if (($porStatus[$v] ?? 0) > 0) { $statusData[__($l)] = $porStatus[$v]; } } $taxaAtend = $total > 0 ? round((($porStatus['atendido'] ?? 0) / $total) * 100, 1) : 0; $setorData = $porSetor ->sortByDesc('total') ->take(7) ->mapWithKeys(fn($r) => [$r['nome'] => $r['total']]) ->toArray(); $svgDonut = $chart->donutChart($statusData, 110, $statusColors); $svgGauge = $chart->gauge($porStatus['atendido'] ?? 0, max($total, 1), 100, '#10B981'); @endphp
Status dos Chamados
{!! $svgDonut !!} @php $ci = 0; @endphp @foreach (Chamado::STATUS as $v => $l) @php $q = $porStatus[$v] ?? 0; @endphp @if ($q > 0) @php $p = $total > 0 ? round($q / $total * 100, 1) : 0; @endphp
{{ __($l) }}: {{ $q }} ({{ $p }}%)
@php $ci++; @endphp @endif @endforeach
Taxa de Atendimento
{!! $svgGauge !!}
{{ $porStatus['atendido'] ?? 0 }} de {{ $total }}
Volume por Setor
@php $svgSetores = $chart->horizontalBars($setorData, 500, max(count($setorData) * 16, 60)); @endphp {!! $svgSetores !!}
Distribuição por Status
@foreach (Chamado::STATUS as $valor => $label) @php $qtd = $porStatus[$valor] ?? 0; @endphp @if ($qtd > 0) @php $cls = match ($valor) { 'atendido' => 'b-ok', 'pendente' => 'b-pen', 'em_andamento' => 'b-prog', default => 'b-canc', }; $pct = $total > 0 ? round(($qtd / $total) * 100, 1) : 0; @endphp @endif @endforeach
Status Qtd %
{{ __($label) }} {{ $qtd }} {{ $pct }}%
Total {{ $total }} 100%
@if ($porSetor->count())
Chamados por Setor
@foreach ($porSetor->sortByDesc('total') as $row) @php $pct = $total > 0 ? round($row['total'] / $total * 100, 1) : 0; @endphp @endforeach
Setor Total Atend. Pend. %
{{ $row['nome'] }} {{ $row['total'] }} {{ $row['atendidos'] }} {{ $row['pendentes'] }} {{ $pct }}%
@endif @if ($porSubassunto->count())
Por Assunto / Subassunto
@foreach ($porSubassunto->sortByDesc('total')->take(15) as $row) @php $pct = $total > 0 ? round($row['total'] / $total * 100, 1) : 0; @endphp @endforeach
Assunto › Subassunto Total Atendidos %
{{ $row['chave'] }} {{ $row['total'] }} {{ $row['atendidos'] }} {{ $pct }}%
@endif