<div class="card mb-3">
    <div class="card-header border-0">
        <h4 class="card-title">{{ translate($entityTitle) }}</h4>
    </div>
    <div class="table-responsive">
        <table class="table table-borderless table-thead-bordered table-nowrap card-table">
            <thead class="thead-light">
            <tr>
                <th>{{ translate($entityLabel) }}</th>
                <th class="text-right">{{ translate('Spend') }}</th>
                <th class="text-right">{{ translate('Clicks') }}</th>
                <th class="text-right">{{ translate('Add to Cart') }}</th>
                <th class="text-right">{{ translate('Purchase') }}</th>
                <th class="text-right">{{ translate('Purchase ROAS') }}</th>
                <th class="text-right">{{ translate('Delivered Orders') }}</th>
                <th class="text-right">{{ translate('Cost / Delivered') }}</th>
                <th class="text-right">{{ translate('Delivered ROAS') }}</th>
                <th class="text-right">{{ translate('Return Rate') }}</th>
                <th class="text-right">{{ translate('Profit ROAS') }}</th>
            </tr>
            </thead>
            <tbody>
            @forelse($entityRows as $row)
                <tr>
                    <td>
                        <strong>{{ $row[$entityNameKey] }}</strong>
                        <div class="text-muted fs-12">
                            {{ $row[$entityIdKey] ?: translate('ID unavailable') }}
                        </div>
                    </td>
                    <td class="text-right">{{ $money($row['spend']) }}</td>
                    <td class="text-right">{{ number_format($row['clicks']) }}</td>
                    <td class="text-right">{{ number_format($row['add_to_cart'], 0) }}</td>
                    <td class="text-right">{{ number_format($row['purchases'], 0) }}</td>
                    <td class="text-right">{{ $roas($row['purchase_roas']) }}</td>
                    <td class="text-right">{{ $row['delivered_orders'] }}</td>
                    <td class="text-right">
                        {{ $row['cost_per_delivered_order'] === null
                            ? translate('N/A')
                            : $money($row['cost_per_delivered_order']) }}
                    </td>
                    <td class="text-right font-weight-bold text-success">
                        {{ $roas($row['delivered_roas']) }}
                    </td>
                    <td class="text-right">{{ number_format($row['return_rate'], 2) }}%</td>
                    <td class="text-right">{{ $roas($row['profit_roas']) }}</td>
                </tr>
            @empty
                <tr>
                    <td colspan="11" class="text-center py-4">{{ translate($emptyMessage) }}</td>
                </tr>
            @endforelse
            </tbody>
        </table>
    </div>
</div>
