65 lines
3.9 KiB
PHP
65 lines
3.9 KiB
PHP
<x-report-layout :website="$website" :from="$from" :to="$to" title="Geographic Report">
|
|
|
|
<div class="space-y-6">
|
|
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg p-6">
|
|
<h3 class="text-base font-semibold text-gray-900 mb-4">Visitors by Country</h3>
|
|
@if ($countries->isEmpty())
|
|
<p class="text-sm text-gray-500 py-8 text-center">No geographic data available for this period.</p>
|
|
@else
|
|
<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">Country</th>
|
|
<th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Visitors</th>
|
|
<th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">%</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-200">
|
|
@php $totalCountry = $countries->sum('visitors'); @endphp
|
|
@foreach ($countries as $row)
|
|
<tr>
|
|
<td class="px-6 py-3 text-sm text-gray-900">{{ $row->country }}</td>
|
|
<td class="px-6 py-3 text-sm text-gray-900 text-right">{{ number_format($row->visitors) }}</td>
|
|
<td class="px-6 py-3 text-sm text-gray-500 text-right">{{ $totalCountry > 0 ? round(($row->visitors / $totalCountry) * 100, 1) : 0 }}%</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
|
|
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg p-6">
|
|
<h3 class="text-base font-semibold text-gray-900 mb-4">Visitors by City</h3>
|
|
@if ($cities->isEmpty())
|
|
<p class="text-sm text-gray-500 py-8 text-center">No city-level data available.</p>
|
|
@else
|
|
<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">City</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Region</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Country</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 ($cities as $row)
|
|
<tr>
|
|
<td class="px-6 py-3 text-sm text-gray-900">{{ $row->city }}</td>
|
|
<td class="px-6 py-3 text-sm text-gray-500">{{ $row->region }}</td>
|
|
<td class="px-6 py-3 text-sm text-gray-500">{{ $row->country }}</td>
|
|
<td class="px-6 py-3 text-sm text-gray-900 text-right">{{ number_format($row->visitors) }}</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
</x-report-layout>
|