@extends('layouts.app') @section('title', 'Tracking Klik') @section('content') @php $userName = Auth::user()->name ?? 'Admin'; $ranges = ['today' => 'Hari Ini', '7' => '7 Hari', '30' => '30 Hari', 'all' => 'Semua']; $targetLabels = ['whatsapp' => 'WhatsApp'] + collect($platforms)->map(fn ($p) => $p['label'])->all(); $nextDirFor = function ($key) use ($sort, $dir) { if ($sort !== $key) { return $key === 'name' ? 'asc' : 'desc'; } return $dir === 'asc' ? 'desc' : 'asc'; }; $sortUrl = function ($key) use ($nextDirFor, $range, $search) { return route('admin.tracking.index', array_filter([ 'range' => $range, 'q' => $search, 'sort' => $key, 'dir' => $nextDirFor($key), ], fn ($v) => $v !== null && $v !== '')); }; $sortIc = fn ($key) => $sort === $key ? ($dir === 'asc' ? '▲' : '▼') : '⇅'; $isSorted = fn ($key) => $sort === $key ? 'is-sorted' : ''; @endphp

Tracking Klik

Pantau berapa kali tombol WhatsApp dan link marketplace pada produk diklik pengunjung.

@foreach($ranges as $key => $label) {{ $label }} @endforeach
{{-- STATS --}}

Total Klik

{{ number_format($stats['total']) }}

Klik WhatsApp

{{ number_format($stats['whatsapp']) }}

Klik E-Commerce

{{ number_format($stats['ecommerce']) }}

Produk Diklik

{{ number_format($stats['products']) }}

{{-- TABLE --}}

{{ $products->total() }} produk

@foreach($platforms as $key => $pf) @endforeach @forelse($products as $p) @php $counts = $p->clickCounts; $maxTargetKey = $counts->sum() > 0 ? $counts->sortDesc()->keys()->first() : null; @endphp @foreach($platforms as $key => $pf) @endforeach @empty @endforelse
Produk {{ $sortIc('name') }} WhatsApp {{ $sortIc('whatsapp') }} {{ $pf['label'] }} {{ $sortIc($key) }} Total {{ $sortIc('total') }}
{{ $p->name }}
{{ $p->name }} Lihat di toko ↗
{{ number_format($counts->get('whatsapp', 0)) }} {{ number_format($counts->get($key, 0)) }} {{ number_format($p->totalClicks) }}
Belum ada data klik.
@if($products->hasPages())
{{ $products->links() }}
@endif
{{-- RECENT --}}
@endsection @push('head') @include('admin.partials.track-styles') @endpush