@extends('layouts.site') @section('menu') @include('sites.admin.menu_admin') @endsection @section('title', 'Panel Administratora') @php $stats = $dashboardStats ?? []; $sourceReady = (bool) ($stats['source_ready'] ?? false); $errorMessage = (string) ($stats['error'] ?? ''); $totalDb = (int) ($stats['total_db'] ?? 0); $activeDb = (int) ($stats['active_db'] ?? 0); $proBonoDb = (int) ($stats['pro_bono_db'] ?? 0); $inactiveDb = max($totalDb - $activeDb, 0); $activePercent = $totalDb > 0 ? round(($activeDb / $totalDb) * 100, 1) : 0.0; $proBonoPercent = $totalDb > 0 ? round(($proBonoDb / $totalDb) * 100, 1) : 0.0; $areas = $areasStats ?? []; $areasReady = (bool) ($areas['source_ready'] ?? false); $areasError = (string) ($areas['error'] ?? ''); $areasModeLabel = (string) ($areas['mode_label'] ?? 'Wszystkie przypisania'); $areasTotalLinks = (int) ($areas['total_links'] ?? 0); $areasDistinct = (int) ($areas['distinct_areas'] ?? 0); $areasRows = (array) ($areas['rows'] ?? []); $palette = ['#2e6fa9', '#48a36f', '#f4b940', '#d96b4f', '#8a5ed0', '#3db8c2', '#bd4a8e', '#617184']; $areasChartTotal = 0; foreach ($areasRows as $row) { $areasChartTotal += (int) ($row['count'] ?? 0); } $areaLegend = []; foreach ($areasRows as $index => $row) { $count = (int) ($row['count'] ?? 0); if ($count < 1) { continue; } $color = $palette[$index % count($palette)]; $percent = $areasChartTotal > 0 ? round(($count / $areasChartTotal) * 100, 2) : 0; $areaLegend[] = [ 'lp' => $index + 1, 'label' => (string) ($row['label'] ?? ('Obszar ID: ' . ($row['obszar_id'] ?? '?'))), 'count' => $count, 'percent' => $percent, 'color' => $color, ]; } $donutRadius = 42; $donutCircumference = 2 * pi() * $donutRadius; $activeStroke = $donutCircumference * ($activePercent / 100); $proBonoStroke = $donutCircumference * ($proBonoPercent / 100); $areaSegmentsSvg = []; $currentOffsetPercent = 0.0; foreach ($areaLegend as $legendRow) { $segmentPercent = (float) $legendRow['percent']; if ($segmentPercent <= 0) { continue; } $segmentLength = $donutCircumference * ($segmentPercent / 100); $segmentOffset = $donutCircumference * ($currentOffsetPercent / 100); $areaSegmentsSvg[] = [ 'color' => (string) $legendRow['color'], 'length' => $segmentLength, 'offset' => $segmentOffset, ]; $currentOffsetPercent += $segmentPercent; } @endphp @section('content')
@if (!$sourceReady) @else
DB aktywne {{ $activeDb }}
DB Pro bono {{ $proBonoDb }}
{{ $activePercent }}%
Aktywne / wszystkie
{{ $proBonoPercent }}%
Pro bono / wszystkie
@endif Lacznie baz: {{ $totalDb }}, nieaktywne: {{ $inactiveDb }}
@if (!$areasReady) @else
{{ $areasModeLabel }}
Przypisania: {{ $areasTotalLinks }}
Obszary uzyte: {{ $areasDistinct }}
@foreach($areaSegmentsSvg as $segment) @endforeach
{{ $areasChartTotal }}
Suma pokazanych przypisan
@forelse($areaLegend as $row) @empty @endforelse
Lp Obszar Ilosc
{{ $row['lp'] }} {{ $row['label'] }} {{ $row['count'] }}
Brak danych do wyswietlenia.
@endif Widok pokazuje do 8 najczesciej przypisywanych obszarow.
Pole 3
miejsce na kolejny widget
Pole 4
miejsce na kolejny widget
Pole 5
miejsce na kolejny widget
Pole 6
miejsce na kolejny widget
@endsection @section('navbar') ADM - Panel Administratora Lokalnego @endsection