2026-03-18 13:32:36 +02:00
|
|
|
<x-report-layout :website="$website" :from="$from" :to="$to" title="Pages Report">
|
|
|
|
|
|
2026-03-19 18:42:19 +02:00
|
|
|
@if ($pages->isEmpty())
|
|
|
|
|
<div class="rounded-xl border border-gray-200 bg-white overflow-hidden">
|
|
|
|
|
<x-empty-state message="No page view data available for this period." />
|
|
|
|
|
</div>
|
|
|
|
|
@else
|
|
|
|
|
@php
|
|
|
|
|
$chartPages = $pages->take(10);
|
|
|
|
|
$chartLabels = $chartPages->pluck('path')->map(fn ($p) => strlen($p) > 30 ? substr($p, 0, 27) . '...' : $p)->values()->toArray();
|
|
|
|
|
$chartData = $chartPages->pluck('views')->values()->toArray();
|
|
|
|
|
@endphp
|
|
|
|
|
|
|
|
|
|
<div class="rounded-xl border border-gray-200 bg-white overflow-hidden mb-6">
|
|
|
|
|
<div class="px-6 py-4 border-b border-gray-200">
|
|
|
|
|
<h2 class="text-sm font-semibold text-gray-900">Top 10 Pages by Views</h2>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="p-6">
|
|
|
|
|
<div style="height: 280px;"><canvas id="pages-chart"></canvas></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="rounded-xl border border-gray-200 bg-white overflow-hidden">
|
2026-03-18 13:32:36 +02:00
|
|
|
<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">Page Path</th>
|
|
|
|
|
<th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Views</th>
|
|
|
|
|
<th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Unique Views</th>
|
|
|
|
|
<th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Avg. Time</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody class="divide-y divide-gray-200">
|
|
|
|
|
@foreach ($pages as $row)
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="px-6 py-3 text-sm text-gray-900 font-mono max-w-md truncate">{{ $row->path }}</td>
|
|
|
|
|
<td class="px-6 py-3 text-sm text-gray-900 text-right">{{ number_format($row->views) }}</td>
|
|
|
|
|
<td class="px-6 py-3 text-sm text-gray-900 text-right">{{ number_format($row->unique_views) }}</td>
|
|
|
|
|
<td class="px-6 py-3 text-sm text-gray-900 text-right">{{ $row->avg_time !== null ? gmdate('i:s', (int) round($row->avg_time)) : '—' }}</td>
|
|
|
|
|
</tr>
|
|
|
|
|
@endforeach
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
2026-03-19 18:42:19 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<x-slot name="scripts">
|
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/chart.js@4/dist/chart.umd.min.js"></script>
|
|
|
|
|
<script>
|
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
|
new Chart(document.getElementById('pages-chart'), {
|
|
|
|
|
type: 'bar',
|
|
|
|
|
data: {
|
|
|
|
|
labels: @json($chartLabels),
|
|
|
|
|
datasets: [{
|
|
|
|
|
label: 'Views',
|
|
|
|
|
data: @json($chartData),
|
|
|
|
|
backgroundColor: ['#6366f1', '#10b981', '#f59e0b', '#ef4444', '#8b5cf6', '#ec4899', '#14b8a6', '#6366f1', '#10b981', '#f59e0b'],
|
|
|
|
|
}]
|
|
|
|
|
},
|
|
|
|
|
options: {
|
|
|
|
|
indexAxis: 'y',
|
|
|
|
|
responsive: true,
|
|
|
|
|
maintainAspectRatio: false,
|
|
|
|
|
plugins: {
|
|
|
|
|
legend: { display: false },
|
|
|
|
|
tooltip: {
|
|
|
|
|
backgroundColor: 'rgba(17, 24, 39, 0.9)',
|
|
|
|
|
titleColor: '#f9fafb',
|
|
|
|
|
bodyColor: '#e5e7eb',
|
|
|
|
|
borderColor: 'rgba(75, 85, 99, 0.5)',
|
|
|
|
|
borderWidth: 1
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
scales: {
|
|
|
|
|
x: { grid: { color: 'rgba(0,0,0,0.05)' } },
|
|
|
|
|
y: { grid: { display: false } }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
</x-slot>
|
|
|
|
|
@endif
|
2026-03-18 13:32:36 +02:00
|
|
|
|
|
|
|
|
</x-report-layout>
|