100 lines
5.6 KiB
PHP
100 lines
5.6 KiB
PHP
<x-report-layout :website="$website" :from="$from" :to="$to" title="Technology Report">
|
|
|
|
<div class="space-y-6">
|
|
{{-- Device Type --}}
|
|
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg p-6">
|
|
<h3 class="text-base font-semibold text-gray-900 mb-4">Device Type</h3>
|
|
@if ($devices->isNotEmpty())
|
|
@php $totalDevices = $devices->sum('visitors'); @endphp
|
|
<div class="grid gap-4 sm:grid-cols-3 mb-4">
|
|
@foreach ($devices as $row)
|
|
<div class="rounded-lg border border-gray-200 p-4 text-center">
|
|
<div class="text-2xl font-bold text-gray-900">{{ $totalDevices > 0 ? round(($row->visitors / $totalDevices) * 100, 1) : 0 }}%</div>
|
|
<div class="text-sm text-gray-500 capitalize mt-1">{{ $row->device_type ?? 'Unknown' }}</div>
|
|
<div class="text-xs text-gray-400">{{ number_format($row->visitors) }} visitors</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
@else
|
|
<p class="text-sm text-gray-500 py-4 text-center">No device data available.</p>
|
|
@endif
|
|
</div>
|
|
|
|
<div class="grid gap-6 lg:grid-cols-2">
|
|
{{-- Browsers --}}
|
|
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg p-6">
|
|
<h3 class="text-base font-semibold text-gray-900 mb-4">Browsers</h3>
|
|
@if ($browsers->isNotEmpty())
|
|
@php $totalBrowsers = $browsers->sum('visitors'); @endphp
|
|
<div class="space-y-3">
|
|
@foreach ($browsers as $row)
|
|
<div>
|
|
<div class="flex justify-between text-sm mb-1">
|
|
<span class="text-gray-900">{{ $row->browser }}</span>
|
|
<span class="text-gray-500">{{ number_format($row->visitors) }} ({{ $totalBrowsers > 0 ? round(($row->visitors / $totalBrowsers) * 100, 1) : 0 }}%)</span>
|
|
</div>
|
|
<div class="w-full bg-gray-100 rounded-full h-2">
|
|
<div class="bg-indigo-500 h-2 rounded-full" style="width: {{ $totalBrowsers > 0 ? ($row->visitors / $totalBrowsers) * 100 : 0 }}%"></div>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
@else
|
|
<p class="text-sm text-gray-500 py-4 text-center">No browser data available.</p>
|
|
@endif
|
|
</div>
|
|
|
|
{{-- Operating Systems --}}
|
|
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg p-6">
|
|
<h3 class="text-base font-semibold text-gray-900 mb-4">Operating Systems</h3>
|
|
@if ($operatingSystems->isNotEmpty())
|
|
@php $totalOS = $operatingSystems->sum('visitors'); @endphp
|
|
<div class="space-y-3">
|
|
@foreach ($operatingSystems as $row)
|
|
<div>
|
|
<div class="flex justify-between text-sm mb-1">
|
|
<span class="text-gray-900">{{ $row->os }}</span>
|
|
<span class="text-gray-500">{{ number_format($row->visitors) }} ({{ $totalOS > 0 ? round(($row->visitors / $totalOS) * 100, 1) : 0 }}%)</span>
|
|
</div>
|
|
<div class="w-full bg-gray-100 rounded-full h-2">
|
|
<div class="bg-emerald-500 h-2 rounded-full" style="width: {{ $totalOS > 0 ? ($row->visitors / $totalOS) * 100 : 0 }}%"></div>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
@else
|
|
<p class="text-sm text-gray-500 py-4 text-center">No OS data available.</p>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Screen Resolutions --}}
|
|
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg p-6">
|
|
<h3 class="text-base font-semibold text-gray-900 mb-4">Screen Resolutions</h3>
|
|
@if ($resolutions->isNotEmpty())
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full divide-y divide-gray-200">
|
|
<thead class="bg-gray-50">
|
|
<tr>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Resolution</th>
|
|
<th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Visitors</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-200">
|
|
@foreach ($resolutions as $row)
|
|
<tr>
|
|
<td class="px-6 py-3 text-sm text-gray-900 font-mono">{{ $row->screen_resolution }}</td>
|
|
<td class="px-6 py-3 text-sm text-gray-900 text-right">{{ number_format($row->visitors) }}</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@else
|
|
<p class="text-sm text-gray-500 py-4 text-center">No screen resolution data available.</p>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
</x-report-layout>
|