@php
    $title = admin_trans('offers_by_category');
    $icon = 'layout-grid';
@endphp

@extends('admin.analytics.base')

@section('analytics-content')
@if($data->isEmpty())
    <x-empty-state icon="layout-grid" :title="admin_trans('no_data')" />
@else
    <x-enhanced-table
        :headers="['category' => ['text' => 'Category', 'align' => 'auto'], 'offers' => ['text' => 'Offers Count', 'align' => 'center']]"
        :responsive="true"
    >
        @foreach($data as $item)
        <tr>
            <x-table-cell type="text"><span class="font-medium text-primary">{{ $item->category_name ?? 'N/A' }}</span></x-table-cell>
            <x-table-cell type="center"><span class="text-lg font-bold text-primary">{{ number_format($item->total) }}</span></x-table-cell>
        </tr>
        @endforeach
    </x-enhanced-table>

    @if($data->hasPages())
        <div class="mt-4"><x-pagination :paginator="$data" /></div>
    @endif
@endif
@endsection
