{{-- Nội dung thống kê đối tác (/report/partners) - được nạp lại bằng AJAX mỗi lần lọc (#gridForm). Bố cục: 4 thẻ KPI -> nguồn tiền -> xu hướng theo ngày -> lưới biểu đồ top / cơ cấu. Dùng chung class .crm-stats__* và Chart.js với trang thống kê doanh thu (statistics/ajax.blade.php). --}} @php $summary = $stats['summary']; $payout = $stats['payout']; $paidOutInRange = array_sum(array_column($payout['methods'], 'value')); $sourceIcons = ['Tiền mặt' => 'fas fa-money-bill-wave', 'Thẻ' => 'far fa-credit-card', 'Chuyển khoản' => 'fas fa-university', 'Trả góp' => 'fas fa-calendar-check']; $sourceMax = max(1, max(array_column($stats['sources'], 'value') ?: [0])); $panels = [ 'topRevenue' => ['title' => 'Top 5 đối tác doanh thu cao nhất', 'icon' => 'fas fa-trophy', 'rows' => $stats['topRevenue'], 'key' => 'paid'], 'topCommission' => ['title' => 'Top 5 đối tác hoa hồng cao nhất', 'icon' => 'fas fa-percent', 'rows' => $stats['topCommission'], 'key' => 'value'], 'topAvgOrder' => ['title' => 'Top 5 đối tác trung bình đơn cao nhất', 'icon' => 'fas fa-balance-scale', 'rows' => $stats['topAvgOrder'], 'key' => 'value'], 'topVouchers' => ['title' => 'Top 5 voucher hiệu quả nhất', 'icon' => 'fas fa-ticket-alt', 'rows' => $stats['topVouchers'], 'key' => 'value'], 'byType' => ['title' => 'Thực thu theo loại đối tác', 'icon' => 'fas fa-users', 'rows' => $stats['byType'], 'key' => 'value'], 'payout' => ['title' => 'Tình hình chi trả hoa hồng (toàn thời gian)', 'icon' => 'fas fa-money-check-alt', 'rows' => $payout['status'], 'key' => 'value'], ]; @endphp